/** * Copy file. * * @param string $source * @param string $target * @param string $mode (default = 0 = self::$DEFAULT_MODE) */ public static function copy($source, $target, $mode = 0) { if (!$mode) { $mode = self::$DEFAULT_MODE; } if (!copy($source, $target)) { throw new Exception("Filecopy failed", "{$source} -> {$target}"); } FSEntry::chmod($target, $mode); }