Méthode | Description | |
---|---|---|
checkIfFileSystemIsNFS ( ) : boolean | Checks if the filesystem Piwik stores sessions in is NFS or not. This check is done in order to avoid using file based sessions on NFS system, since on such a filesystem file locking can make file based sessions incredibly slow. | |
clearPhpCaches ( ) | ||
copy ( string $source, string $dest, boolean $excludePhp = false ) : true | Copies a file from $source to $dest. | |
copyRecursive ( string $source, string $target, boolean $excludePhp = false ) | Copies the contents of a directory recursively from $source to $target. | |
deleteAllCacheOnUpdate ( $pluginName = false ) | Called on Core install, update, plugin enable/disable Will clear all cache that could be affected by the change in configuration being made | |
deleteFileIfExists ( string $pathToFile ) : boolean | Deletes the given file if it exists. | |
directoryDiff ( $source, $target ) : string[] | Computes the difference of directories. Compares $target against $source and returns a relative path to all files and directories in $target that are not present in $source. | |
getFileSize ( string $pathToFile, string $unit = 'B' ) : float | null | Get the size of a file in the specified unit. | |
getPathToPiwikRoot ( ) : string | ending WITHOUT slash | |
globr ( string $sDir, string $sPattern, integer $nFlags = null ) : array | Recursively find pathnames that match a pattern. | |
isValidFilename ( string $filename ) : boolean | Returns true if the string is a valid filename File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted. | |
mkdir ( string $path ) | Attempts to create a new directory. All errors are silenced. | |
realpath ( string $path ) : string | Get canonicalized absolute path See http://php.net/realpath | |
remove ( string $file, boolean $silenceErrors = false ) | Remove a file. | |
sortFilesDescByPathLength ( string[] $files ) : string[] | Sort all given paths/filenames by its path length. Long path names will be listed first. This method can be useful if you have for instance a bunch of files/directories to delete. By sorting them by lengh you can make sure to delete all files within the folders before deleting the actual folder. | |
unlinkRecursive ( string $dir, boolean $deleteRootToo, Closure $beforeUnlink = null ) | Recursively deletes a directory. | |
unlinkTargetFilesNotPresentInSource ( string $source, string $target ) | Removes all files and directories that are present in the target directory but are not in the source directory. |
Méthode | Description | |
---|---|---|
createIndexFilesToPreventDirectoryListing ( $path ) | in tmp/ (sub-)folder(s) we create empty index.htm|php files | |
getChmodForPath ( $path ) : integer | ||
hasPHPExtension ( $file ) | ||
havePhpFilesSameContent ( $file1, $file2 ) | ||
isPathWithinTmpFolder ( $path ) : boolean | ||
tryToCopyFileAndVerifyItWasCopied ( $source, $dest ) |
public static checkIfFileSystemIsNFS ( ) : boolean | ||
Résultat | boolean | True if on an NFS filesystem, false if otherwise or if we can't use shell_exec or exec. |
public static copy ( string $source, string $dest, boolean $excludePhp = false ) : true | ||
$source | string | A path to a file, eg. './tmp/latest/index.php'. The file must exist. |
$dest | string | A path to a file, eg. './index.php'. The file does not have to exist. |
$excludePhp | boolean | Whether to avoid copying files if the file is related to PHP (includes .php, .tpl, .twig files). |
Résultat | true |
public static copyRecursive ( string $source, string $target, boolean $excludePhp = false ) | ||
$source | string | A directory or file to copy, eg. './tmp/latest'. |
$target | string | A directory to copy to, eg. '.'. |
$excludePhp | boolean | Whether to avoid copying files if the file is related to PHP (includes .php, .tpl, .twig files). |
public static deleteAllCacheOnUpdate ( $pluginName = false ) |
public static deleteFileIfExists ( string $pathToFile ) : boolean | ||
$pathToFile | string | |
Résultat | boolean | true in case of success or if file does not exist, false otherwise. It might fail in case the file is not writeable. |
public static directoryDiff ( $source, $target ) : string[] | ||
$source | ||
$target | ||
Résultat | string[] |
public static getPathToPiwikRoot ( ) : string | ||
Résultat | string |
public static globr ( string $sDir, string $sPattern, integer $nFlags = null ) : array | ||
$sDir | string | directory The directory to glob in. |
$sPattern | string | pattern The pattern to match paths against. |
$nFlags | integer | `glob()` . See {@link http://php.net/manual/en/function.glob.php glob()}. |
Résultat | array | The list of paths that match the pattern. |
public static isValidFilename ( string $filename ) : boolean | ||
$filename | string | |
Résultat | boolean |
public static sortFilesDescByPathLength ( string[] $files ) : string[] | ||
$files | string[] | |
Résultat | string[] |
public static unlinkRecursive ( string $dir, boolean $deleteRootToo, Closure $beforeUnlink = null ) | ||
$dir | string | Path of the directory to delete. |
$deleteRootToo | boolean | If true, `$dir` is deleted, otherwise just its contents. |
$beforeUnlink | Closure | An optional closure to execute on a file path before unlinking. |
public static unlinkTargetFilesNotPresentInSource ( string $source, string $target ) | ||
$source | string | Path to the source directory |
$target | string | Path to the target |