OC_Helper¶
-
class
OC_Helper
¶ - Collection of useful functions
Source: lib/private/legacy/OC_Helper.php#53
Properties¶
Methods¶
-
public static
OC_Helper::
humanFileSize
($bytes)¶ - Make a human file size
Source: Parameters: - $bytes (int) file size in bytes
Returns: string a human readable file size
Makes 2048 to 2 kB.
-
public static
OC_Helper::
computerFileSize
($str)¶ - Make a computer file size
Source: Parameters: - $str (string) file size in human readable format
Returns: float | bool a file size in bytes
Makes 2kB to 2048.
Inspired by: https://www.php.net/manual/en/function.filesize.php#92418
-
public static
OC_Helper::
copyr
($src, $dest)¶ - Recursive copying of folders
Source: Parameters: - $src (string) source folder
- $dest (string) target folder
-
public static
OC_Helper::
rmdirr
($dir, $deleteSelf=\true)¶ - Recursive deletion of folders
Source: Parameters: - $dir (string) path to the folder
- $deleteSelf (bool) if set to false only the content of the folder will be deleted
Returns: bool
-
public static
OC_Helper::
getFileTemplateManager
()¶ Source: lib/private/legacy/OC_Helper.php#197 Deprecated: 18.0.0 Returns: \OC\Files\Type\TemplateManager
-
public static
OC_Helper::
canExecute
($name, $path=\false)¶ - detect if a given program is found in the search PATH
Source: Parameters: - $name (string)
- $path (bool)
Returns: bool true if executable program found in path
-
public static
OC_Helper::
streamCopy
($source, $target)¶ - copy the contents of one stream to another
Source: Parameters: - $source (resource)
- $target (resource)
Returns: array the number of bytes copied and result
-
public static
OC_Helper::
buildNotExistingFileName
($path, $filename)¶ - Adds a suffix to the name in case the file exists
Source: Parameters: - $path (string)
- $filename (string)
Returns: string
-
public static
OC_Helper::
buildNotExistingFileNameForView
($path, $filename, $view)¶ - Adds a suffix to the name in case the file exists
Source: Parameters: - $path (string)
- $filename (string)
Returns: string
-
public static
OC_Helper::
mb_array_change_key_case
($input, $case=\MB_CASE_LOWER, $encoding=UTF-8)¶ - Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
Source: Parameters: - $input (array) The array to work on
- $case (int) Either MB_CASE_UPPER or MB_CASE_LOWER (default)
- $encoding (string) The encoding parameter is the character encoding. Defaults to UTF-8
Returns: array Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is. based on https://www.php.net/manual/en/function.array-change-key-case.php#107715
-
public static
OC_Helper::
recursiveArraySearch
($haystack, $needle, $index=\null)¶ - performs a search in a nested array
Source: Parameters: - $haystack (array) the array to be searched
- $needle (string) the search string
- $index (mixed) optional, only search this key name
Returns: mixed the key of the matching field, otherwise false
performs a search in a nested array
taken from https://www.php.net/manual/en/function.array-search.php#97645
-
public static
OC_Helper::
maxUploadFilesize
($dir, $freeSpace=\null)¶ - calculates the maximum upload size respecting system settings, free space and user quota
Source: Parameters: - $dir (string) the current folder where the user currently operates
- $freeSpace (int) the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
Returns: int number of bytes representing
-
public static
OC_Helper::
freeSpace
($dir)¶ - Calculate free space left within user quota
Source: Parameters: - $dir (string) the current folder where the user currently operates
Returns: int number of bytes representing
-
public static
OC_Helper::
uploadLimit
()¶ - Calculate PHP upload limit
Source: lib/private/legacy/OC_Helper.php#417 Returns: int PHP upload file size limit
-
public static
OC_Helper::
is_function_enabled
($function_name)¶ - Checks if a function is available
Source: Parameters: - $function_name (string)
Returns: bool
-
public static
OC_Helper::
findBinaryPath
($program)¶ - Try to find a program
Source: Parameters: - $program (string)
Returns: null | string
-
public static
OC_Helper::
getStorageInfo
($path, $rootInfo=\null)¶ - Calculate the disc space for the given pathBEWARE: this requires that Util::setupFS() was calledalready !
Source: Parameters: - $path (string)
- $rootInfo (
OCP\Files\FileInfo
) (optional)
Returns: array
Throws:
-
public static
OC_Helper::
isReadOnlyConfigEnabled
()¶ - Returns whether the config file is set manually to read-only
Source: lib/private/legacy/OC_Helper.php#610 Returns: bool