vB_Utilities
in package
Uses
vB_Trait_NoSerialize
vB_Utilities
Tags
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- extendMemoryLimit() : void
- Attempt to extend the memory limit
- extendMemoryLimitBytes() : mixed
- Extend the memory limit to a specific byte value
- getExceptionTrace() : mixed
- getStackTrace() : string
- Returns a stack trace as a string
- getTmpDir() : string|false
- Returns the temp directory that vBulletin should use.
- getTmpFileName() : string|false
- Generates a valid path and filename for a temp file. In the case of safe upload, this generates the filename, but not the file. In the case of tempnam(), the temp file is actually created.
- ini_size_to_bytes() : int
- Converts shorthand string version of a size to bytes, 8M = 8388608
- vbmkdir() : mixed
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
extendMemoryLimit()
Attempt to extend the memory limit
public
static extendMemoryLimit() : void
This function will extend the memory limit to 256M if a) The current limit is lower b) ini_set('memory_limit') actually works.
Part of the intent of this function is to allow adjusting the new limit centrally
instead of having it encoded in various files. Thus we deliberately do not pass
it as a parameter.
extendMemoryLimitBytes()
Extend the memory limit to a specific byte value
public
static extendMemoryLimitBytes(int $value) : mixed
Generally callers should use the extendMemoryLimit function. But in some cases we estimate how much memory is required and attempt to extend to that amount rather than just some arbitrary value. Like extendMemoryLimit this will only affect the limit if the value is higher than the current amount.
This function is not intended to be called with a constant value. We should keep the extention limit synced so that we can change it. There isn't much value in having different arbitrary limits for different processes (extending the limit doesn't automatically use more memory).
Parameters
- $value : int
-
-- the memory limit in bytes. Note that this does not accept php.ini strings such at '256M'. We do internal calcuations on the value before passing it to ini_set which will fail.
getExceptionTrace()
public
static getExceptionTrace(mixed $e) : mixed
Parameters
- $e : mixed
getStackTrace()
Returns a stack trace as a string
public
static getStackTrace() : string
Return values
string —Stack trace
getTmpDir()
Returns the temp directory that vBulletin should use.
public
static getTmpDir() : string|false
Return values
string|false —Path to the temp directory, or false if ini_get failed.
getTmpFileName()
Generates a valid path and filename for a temp file. In the case of safe upload, this generates the filename, but not the file. In the case of tempnam(), the temp file is actually created.
public
static getTmpFileName([mixed $entropy = '' ][, mixed $prefix = 'vb_' ][, mixed $suffix = '' ]) : string|false
Parameters
- $entropy : mixed = ''
- $prefix : mixed = 'vb_'
- $suffix : mixed = ''
Return values
string|false —The path and filename of the temp file, or bool false if it failed.
ini_size_to_bytes()
Converts shorthand string version of a size to bytes, 8M = 8388608
public
static ini_size_to_bytes(mixed $value) : int
Parameters
- $value : mixed
Return values
int —Value expanded to bytes
vbmkdir()
public
static vbmkdir(mixed $path[, mixed $mode = 0777 ]) : mixed
Parameters
- $path : mixed
- $mode : mixed = 0777