class vB_Utilities

vB_Utilities

Traits

Methods

__sleep()

No description

__wakeup()

No description

static 
vbmkdir($path, $mode = 0777)

No description

static integer
ini_size_to_bytes(string $value)

Converts shorthand string version of a size to bytes, 8M = 8388608

static none
extendMemoryLimit()

Attempt to extend the memory limit

static 
extendMemoryLimitBytes(int $value)

Extend the memory limit to a specific byte value

static string|false
getTmpFileName(string|int $entropy = '', string $prefix = 'vb_', string $suffix = '')

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.

static string|false
getTmpDir()

Returns the temp directory that vBulletin should use.

static string
getStackTrace()

Returns a stack trace as a string

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 23
static vbmkdir($path, $mode = 0777)

Parameters

$path
$mode

at line 57
static integer ini_size_to_bytes(string $value)

Converts shorthand string version of a size to bytes, 8M = 8388608

Parameters

string $value The value from ini_get that needs converted to bytes

Return Value

integer Value expanded to bytes

at line 92
static none extendMemoryLimit()

Attempt to extend the memory limit

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.

Return Value

none

at line 121
static extendMemoryLimitBytes(int $value)

Extend the memory limit to a specific byte value

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

int $value -- 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.

at line 154
static string|false getTmpFileName(string|int $entropy = '', string $prefix = 'vb_', string $suffix = '')

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.

Parameters

string|int $entropy Optional extra "entropy" for the md5 call, this would typically be an ID such as userid or avatarid, etc for the current record of whatever is being processed. If empty, it uses the current user's userid.
string $prefix An optional prefix for the file name. Depending on OS and if tempnam is used, only the first 3 chars of this will be used.
string $suffix An optional suffix for the file name, can be used to add a file extension if needed.

Return Value

string|false The path and filename of the temp file, or bool false if it failed.

at line 199
static string|false getTmpDir()

Returns the temp directory that vBulletin should use.

Return Value

string|false Path to the temp directory, or false if ini_get failed.

at line 224
static string getStackTrace()

Returns a stack trace as a string

Return Value

string Stack trace