* * @package stInstallerPlugin * @subpackage libs */ class stPakeFileManager extends stBaseFileManager { protected static $instance = null; /** * Kopiuje plik * * @param string $origin_path Ścieżka przenoszonego pliku * @param string $target_path Ścieżka docelowa przenoszonego pliku * @param string $force_override */ protected function _copy($origin_path, $target_path, $perm = null) { if (is_dir($origin_path)) { pake_mkdirs($target_path); } else if (is_file($origin_path)) { pake_copy($origin_path, $target_path, array('override' => true)); } else if (is_link($origin_path)) { pake_symlink($origin_path, $target_path); } else { throw new pakeException(sprintf('Unable to determine "%s" type', $origin_path)); } } /** * Tworzy katalog o podanej ścieżce * * @param string $path Ścieżka do katalogu */ protected function _mkdir($path, $perm = null) { pake_mkdirs($path); } /** * Usuwa plik lub katalog * * @param string $file Ścieżka usuwanego pliku lub katalogu */ protected function _remove($file) { if (is_link($file)) { pake_echo_comment(sprintf('Path "%s" is a symlink - ignoring...', $file)); } elseif (is_dir($file)) { pake_echo_action('dir-', $file); if (!@rmdir($file)) { pake_echo_comment(sprintf('Directory "%s" not empty - ignoring...', $file)); } } else { pake_echo_action('file-', $file); unlink($file); } } public function silentMode() { pakeApp::get_instance()->handle_options('--quiet'); return $this; } public function verboseMode() { pakeApp::get_instance()->handle_options('--verbose'); return $this; } /** * Pobiera instancje obiektu stFileManager * * @return stPakeFileManager */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } } ?>