/** * (non-PHPdoc) * @see \OatBox\Common\ScriptRunner::run() */ public function run() { $service = UpdateService::getInstance(); $extManifests = $service->getUpdateManifests(); $releaseManifest = $service->getReleaseManifest(); $oldRootPath = $releaseManifest['old_root_path']; foreach ($extManifests as $ext => $update) { Logger::t('Moving Folder ' . $ext); File::move($oldRootPath . $ext, DIR_DATA . 'old/' . $ext, false); } $rootFiles = array('.htaccess', 'index.php', 'favicon.ico', 'fdl-1.3.txt', 'gpl-2.0.txt', 'license', 'version', 'readme.txt'); foreach ($rootFiles as $file) { if (is_file($oldRootPath . $file)) { Logger::t('Moving File ' . $file); File::move($oldRootPath . $file, DIR_DATA . 'old/' . $file, false); } else { Logger::w('File not found : ' . $file); } } }
public function run() { $this->out('Move File back'); File::move(DIR_DATA . 'old/', $this->getOldRootPath()); mkdir(DIR_DATA . 'old/'); }
/** * * @access private * @author "Lionel Lecaque, <*****@*****.**>" * @param string $ext * @return boolean * @throws UpdateException */ private function shield($ext) { $releaseManifest = $this->getReleaseManifest(); $extFolder = $releaseManifest['old_root_path'] . $ext; if (is_file($extFolder . '/htaccess.1')) { //already shield return true; } if (!is_writable($extFolder . '/.htaccess')) { throw new UpdateException('Bad permission ' . $extFolder . '/.htaccess'); } File::copy($extFolder . '/.htaccess', $extFolder . '/htaccess.1', true, false); if (is_file($extFolder . '/htaccess.1')) { file_put_contents($extFolder . '/.htaccess', "Options +FollowSymLinks\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine On\n" . "RewriteCond %{REQUEST_URI} !/views/ [NC]\n" . "RewriteRule ^.*\$ " . ROOT_URL . self::DEPLOY_FOLDER . " [L]\n" . "</IfModule>"); return true; } else { return false; } }