if (!@rmdir($dir)) { $errors = error_get_last(); self::$log->error("Not able to delete dir {$dir} {$errors['type']} {$errors['message']}"); throw new RuntimeException("unableToDeleteDir"); } } public static function Copy($source, $dest) { if (!@copy($source, $dest)) { $errors = error_get_last(); throw new RuntimeException("FATAL: Unable to copy {$source} to {$dest}: " . $errors['type'] . " " . $errors["message"]); } } public static function Rename($old, $new) { self::$log->info("Renaming {$old} to {$new}"); if (!@rename($old, $new)) { $errors = error_get_last(); throw new RuntimeException("FATAL: Unable to rename {$old} to {$new} " . $errors['type'] . " " . $errors["message"]); } } public static function SafeReplace($old, $new) { self::Rename($old, $old . '_old'); self::Rename($new, $old); self::$log->info("Deleting {$old} _old dir"); self::DeleteDirRecursive($old . '_old'); } } FileHandler::$log = Logger::getLogger("FileHandler");
if (!@rmdir($dir)) { $errors = error_get_last(); self::$log->error("Not able to delete dir {$dir} {$errors['type']} {$errors['message']}"); throw new RuntimeException('unableToDeleteDir'); } } public static function Copy($source, $dest) { if (!@copy($source, $dest)) { $errors = error_get_last(); throw new RuntimeException("FATAL: Unable to copy {$source} to {$dest}: " . $errors['type'] . ' ' . $errors['message']); } } public static function Rename($old, $new) { self::$log->info("Renaming {$old} to {$new}"); if (!@rename($old, $new)) { $errors = error_get_last(); throw new RuntimeException("FATAL: Unable to rename {$old} to {$new} " . $errors['type'] . ' ' . $errors['message']); } } public static function SafeReplace($old, $new) { self::Rename($old, $old . '_old'); self::Rename($new, $old); self::$log->info("Deleting {$old} _old dir"); self::DeleteDirRecursive($old . '_old'); } } FileHandler::$log = Logger::getLogger('FileHandler');