Пример #1
0
 public static function delete($path, $cascade = false)
 {
     $view = self::loadFromPath($path);
     if ($cascade == false) {
         foreach ($view->children() as $child) {
             $bits = preg_split('~\\/~', $child->path, -1, PREG_SPLIT_NO_EMPTY);
             unset($bits[count($bits) - 2]);
             View::move($child, trim(implode('/', $bits), '/'));
         }
     }
     General::rmdirr(VIEWS . '/' . trim($path, '/'));
 }
Пример #2
0
 function uninstall()
 {
     $errors = $notices = array();
     ## REMOVE CAMPFIRE FOLDER
     General::rmdirr(DOCROOT . '/campfire', $errors, $notices);
     ## REMOVE WORKSPACE FOLDER
     General::rmdirr(DOCROOT . '/workspace', $errors, $notices);
     ## REMOVE MANIFEST FOLDER
     General::rmdirr(DOCROOT . '/manifest', $errors, $notices);
     @unlink(DOCROOT . '/.htaccess');
     return;
 }
Пример #3
0
 function rmdirr($target, &$errors, &$notices)
 {
     $errors = $notices = array();
     $exceptions = array('.', '..');
     if (!($sourcedir = @opendir($target))) {
         $errors[] = 'Could not open ' . $target;
         return false;
     }
     while (false !== ($sibling = readdir($sourcedir))) {
         if (!in_array($sibling, $exceptions)) {
             $object = str_replace('//', '/', $target . '/' . $sibling);
             $notices[] = 'Processing: ' . $object;
             if (@is_dir($object)) {
                 General::rmdirr($object, $errors, $notices);
             }
             if (@is_file($object)) {
                 if ($result = @unlink($object)) {
                     $notices[] = $object . ' has been removed.';
                 } else {
                     $errors[] = 'Could not remove file - ' . $object;
                 }
             }
         }
     }
     closedir($sourcedir);
     if ($result = @rmdir($target)) {
         $notices[] = $target . ' has been removed.';
         return true;
     }
     $errors[] = $target . ' could not be removed.';
     return false;
 }