symfony API

sfFilesystem Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

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.
  • 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)

    $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 ()

    @param string A filesystem path

  • chmod ($files, $mode, $umask)

    $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)

    $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)

    $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)

    $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)

    $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)

    $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)

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

  • remove ($files)

    $files A filename or an array of files to remove

    Removes files or directories.

  • rename ($origin, $target)

    $origin The origin filename
    $target The new filename

    Renames a file.

  • replaceTokens ($files, $beginToken, $endToken, $tokens)

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

  • symlink ($originDir, $targetDir, $copyOnWindows)

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

  • touch ($files)

    $files The filename, or an array of filenames

    Creates empty files.

  • __construct ($dispatcher, $formatter)

    $dispatcher An sfEventDispatcher instance
    $formatter An sfFormatter instance

    Constructor.