sfFilesystem provides basic utility to manipulate the file system.
Method Summary
-
string
calculateRelativeDir($from, $to)
Calculates the relative path from one to another directory.
-
string
canonicalizePath()
@param string A filesystem path
-
chmod($files, $mode, $umask)
Change mode for an array of files or directories.
-
copy($originFile, $targetFile, $options)
Copies a file.
-
array
execute($cmd, $stdoutCallback, $stderrCallback)
Executes a shell command.
-
logSection($section, $message, $size)
Logs a message in a section.
-
mirror($originDir, $targetDir, $finder, $options)
Mirrors a directory to another.
-
bool
mkdirs($path, $mode)
Creates a directory recursively.
-
relativeSymlink($originDir, $targetDir, $copyOnWindows)
Creates a symbolic link using a relative path if possible.
-
remove($files)
Removes files or directories.
-
rename($origin, $target)
Renames a file.
-
replaceTokens($files, $beginToken, $endToken, $tokens)
Replaces tokens in an array of files.
-
sh($cmd)
DEPRECATED: Executes a shell command.
-
symlink($originDir, $targetDir, $copyOnWindows)
Creates a symbolic link or copy a directory.
-
touch($files)
Creates empty files.
-
__construct($dispatcher, $formatter)
Constructor.
Method Details
-
(string) calculateRelativeDir ($from, $to)
Browse code
| $from |
The directory from which to calculate the relative path |
| $to |
The target directory |
Calculates the relative path from one to another directory.
If the paths share no common path the absolute target dir is returned.
-
(string) canonicalizePath ()
Browse code
@param string A filesystem path
-
chmod ($files, $mode, $umask)
Browse code
| $files |
An array of files or directories |
| $mode |
The new mode |
| $umask |
The mode mask (octal) |
Change mode for an array of files or directories.
-
copy ($originFile, $targetFile, $options)
Browse code
| $originFile |
The original filename |
| $targetFile |
The target filename |
| $options |
An array of options |
Copies a file.
This method only copies the file if the origin file is newer than the target file. By default, if the target already exists, it is not overriden. To override existing files, pass the "override" option.
-
(array) execute ($cmd, $stdoutCallback, $stderrCallback)
Browse code
| $cmd |
The command to execute on the shell |
| $stdoutCallback |
A callback for stdout output |
| $stderrCallback |
A callback for stderr output |
Executes a shell command.
returns An array composed of the content output and the error output
-
logSection ($section, $message, $size)
Browse code
| $section |
The section name |
| $message |
The message |
| $size |
The maximum size of a line |
Logs a message in a section.
-
mirror ($originDir, $targetDir, $finder, $options)
Browse code
| $originDir |
The origin directory |
| $targetDir |
The target directory |
| $finder |
An sfFinder instance |
| $options |
An array of options (see copy()) |
Mirrors a directory to another.
-
(bool) mkdirs ($path, $mode)
Browse code
| $path |
The directory path |
| $mode |
The directory mode |
Creates a directory recursively.
returns true if the directory has been created, false otherwise
-
relativeSymlink ($originDir, $targetDir, $copyOnWindows)
Browse code
| $originDir |
The origin directory path |
| $targetDir |
The symbolic link name |
| $copyOnWindows |
Whether to copy files if on windows |
Creates a symbolic link using a relative path if possible.
-
| $files |
A filename or an array of files to remove |
Removes files or directories.
-
rename ($origin, $target)
Browse code
| $origin |
The origin filename |
| $target |
The new filename |
Renames a file.
-
replaceTokens ($files, $beginToken, $endToken, $tokens)
Browse code
| $files |
An array of filenames |
| $beginToken |
The begin token delimiter |
| $endToken |
The end token delimiter |
| $tokens |
An array of token/value pairs |
Replaces tokens in an array of files.
-
| $cmd |
The command to execute on the shell |
DEPRECATED: Executes a shell command.
This method is deprecated. Use the more powerful execute() method instead.
-
symlink ($originDir, $targetDir, $copyOnWindows)
Browse code
| $originDir |
The origin directory path |
| $targetDir |
The symbolic link name |
| $copyOnWindows |
Whether to copy files if on windows |
Creates a symbolic link or copy a directory.
-
| $files |
The filename, or an array of filenames |
Creates empty files.
-
__construct ($dispatcher, $formatter)
Browse code
| $dispatcher |
An sfEventDispatcher instance |
| $formatter |
An sfFormatter instance |
Constructor.
|