Piwik\
Contains helper functions that deal with the filesystem.
The class defines the following methods:
mkdir()
— Attempts to create a new directory.globr()
— Recursively find pathnames that match a pattern.unlinkRecursive()
— Recursively deletes a directory.copy()
— Copies a file from $source
to $dest
.copyRecursive()
— Copies the contents of a directory recursively from $source
to $target
.deleteFileIfExists()
— Deletes the given file if it exists.mkdir()
Attempts to create a new directory. All errors are silenced.
Note: This function does not create directories recursively.
$path
(string
) —
The path of the directory to create.globr()
Recursively find pathnames that match a pattern.
See glob for more info.
It accepts the following parameter(s):
$sDir
(string
) —
directory The directory to glob in.$sPattern
(string
) —
pattern The pattern to match paths against.$nFlags
(int
) —
glob()
. See glob().Returns: array
—
The list of paths that match the pattern.
unlinkRecursive()
Recursively deletes a directory.
$dir
(string
) —
Path of the directory to delete.$deleteRootToo
(boolean
) —
If true, $dir
is deleted, otherwise just its contents.$beforeUnlink
(Closure
|null
) —
An optional closure to execute on a file path before unlinking.copy()
Copies a file from $source
to $dest
.
$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
(bool
) —
Whether to avoid copying files if the file is related to PHP (includes .php, .tpl, .twig files).true
value.Piwik\Exception\Exception
— If the file cannot be copied.copyRecursive()
Copies the contents of a directory recursively from $source
to $target
.
$source
(string
) —
A directory or file to copy, eg. './tmp/latest'.$target
(string
) —
A directory to copy to, eg. '.'.$excludePhp
(bool
) —
Whether to avoid copying files if the file is related to PHP (includes .php, .tpl, .twig files).Piwik\Exception\Exception
— If a file cannot be copied.deleteFileIfExists()
Deletes the given file if it exists.
It accepts the following parameter(s):
$pathToFile
(string
) —Returns: bool
—
true in case of success or if file does not exist, false otherwise. It might fail in case the
file is not writeable.