public function coreUpdate() { $this->checkXP(); if (!(bool) OW::getConfig()->getValue('base', 'update_soft')) { throw new Redirect404Exception(); } $language = OW::getLanguage(); $archivePath = OW_DIR_PLUGINFILES . 'ow' . DS . 'core.zip'; $tempDir = OW_DIR_PLUGINFILES . 'ow' . DS . 'core' . DS; $ftp = $this->getFtpConnection(); $errorMessage = false; OW::getApplication()->setMaintenanceMode(true); $this->pluginService->downloadCore($archivePath); if (!file_exists($archivePath)) { $errorMessage = $language->text('admin', 'core_update_download_error'); } else { mkdir($tempDir); $zip = new ZipArchive(); $zopen = $zip->open($archivePath); if ($zopen === true) { $zip->extractTo($tempDir); $zip->close(); $ftp->uploadDir($tempDir, OW_DIR_ROOT); $ftp->chmod(0777, OW_DIR_STATIC); $ftp->chmod(0777, OW_DIR_STATIC_PLUGIN); } else { $errorMessage = $language->text('admin', 'core_update_unzip_error'); } } if (file_exists($tempDir)) { UTIL_File::removeDir($tempDir); } if (file_exists($archivePath)) { unlink($archivePath); } if ($errorMessage !== false) { OW::getApplication()->setMaintenanceMode(false); OW::getFeedback()->error($errorMessage); $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Index', 'index')); } $this->redirect(OW_URL_HOME . 'ow_updates/index.php'); }