removeDirectory() public static method

Use rmdir recursively
public static removeDirectory ( string $directory ) : boolean
$directory string Directory start
return boolean
Example #1
0
 /**
  * Upgrade
  *
  * @return boolean
  */
 public function upgrade()
 {
     $backupFilename = $this->getTmpPath() . '/backup.zip';
     //Remove old backup
     if (file_exists($backupFilename)) {
         unlink($backupFilename);
     }
     if (File::isWritable(GC_APPLICATION_PATH, array(GC_APPLICATION_PATH . '/data/cache', GC_APPLICATION_PATH . '/.git'))) {
         if ($this->createBackup($backupFilename)) {
             foreach (array('library', 'module', 'vendor', 'tests') as $directory) {
                 $this->addMessage(sprintf('Remove %s directory', GC_APPLICATION_PATH . '/' . $directory));
                 File::removeDirectory(GC_APPLICATION_PATH . '/' . $directory);
             }
             $directory = $this->getTmpPath() . '/v' . $this->getLatestVersion();
             $this->addMessage(sprintf('Copy %s to %s', $directory, GC_APPLICATION_PATH));
             File::copyDirectory($directory, GC_APPLICATION_PATH);
             $this->addMessage('Done!');
             return true;
         }
     }
     $this->addMessage('Some files are not writable!');
     $this->addMessage(sprintf('Please execute: chmod -R ug+rw %s', GC_APPLICATION_PATH));
     return false;
 }