/** * restores svn directories * * @return void */ protected function _restoreSvnFromBackup() { foreach ($this->_svn as $current_path => $new_path) { $this->_output('trying to restore .svn directory to ' . $new_path, true); $success = @rename($current_path, $new_path); // if the new path no longer exists then that means it was either moved or removed // in this case we should delete the svn backup cause we no longer need it if (!$success) { $this->_output('directory at ' . str_replace(DIRECTORY_SEPARATOR . '.svn', '', $new_path) . ' no longer exists', true); $this->_output('removing dir ' . $current_path, true); Util::removeDir($current_path); } } }
public function testRemoveDirWithSymlink() { $app = Sonic\App::getInstance(); $src = $app->getPath('lib/Sonic'); $mkdir = $app->getPath('tests/app/lib/what'); mkdir($mkdir); $dest = $mkdir . '/Sonic'; symlink($src, $dest); $result = Util::removeDir($mkdir); $this->isTrue($result); $this->isFalse(file_exists($mkdir)); $this->isFalse(is_dir($mkdir)); $this->isTrue(file_exists($src)); }