<?php include __DIR__ . '/authorize.php'; $vendorDir = __DIR__ . '/../../vendor'; require $vendorDir . '/autoload.php'; use Claroline\CoreBundle\Library\Maintenance\MaintenanceHandler; $_GET['on'] === '1' ? MaintenanceHandler::enableMaintenance() : MaintenanceHandler::disableMaitnenance(); return 0;
/** * Upgrade claroline packages. */ public function upgrade() { $this->removeUpdateLog(); MaintenanceHandler::enableMaintenance(); ini_set('max_execution_time', 1800); ini_set('memory_limit', '-1'); //get the list of upgradable packages from the cache $pkgList = $this->getUpgradableFromCache(); $this->updateRequirements('>=', $pkgList); $ds = DIRECTORY_SEPARATOR; $factory = new Factory(); $io = new FileIO($this->composerLogFile); putenv("COMPOSER_HOME={$this->vendorDir}{$ds}composer"); $composer = $factory->createComposer($io, "{$this->vendorDir}{$ds}..{$ds}composer.json", false); //this is the default github token. An other way to do it must be found sooner or later. $config = $composer->getConfig(); $config->merge(array('github-oauth' => array('github.com' => '5d86c61eec8089d2dd22aebb79c37bebe4b6f86e'))); $install = Installer::create($io, $composer); $continue = true; try { $install->setDryRun($this->env === 'dev')->setVerbose($this->env === 'dev')->setPreferSource($this->env === 'dev')->setPreferDist($this->env !== 'dev')->setDevMode($this->env === 'dev')->setRunScripts(true)->setOptimizeAutoloader(true)->setUpdate(true); $install->run(); } catch (\Exception $e) { file_put_contents($this->composerLogFile, "[Claroline updater Exception]: {$e->getMessage()}\n", FILE_APPEND); $continue = false; } if ($continue) { try { $this->updater->run(new ArgvInput(array()), new StreamOutput(fopen($this->composerLogFile, 'a'))); } catch (\Exception $e) { file_put_contents($this->composerLogFile, "[Claroline updater Exception]: {$e->getMessage()}\n", FILE_APPEND); $continue = false; } if ($continue) { //remove the old cache file $this->iniFileManager->remove($this->lastTagsFile); file_put_contents($this->composerLogFile, "\nDone.", FILE_APPEND); } } }
/** * @EXT\Route("/maintenance/start", name="claro_admin_parameters_start_maintenance") * @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')") * * @return \Symfony\Component\HttpFoundation\Response */ public function startMaintenanceAction() { MaintenanceHandler::enableMaintenance(); return new RedirectResponse($this->router->generate('claro_admin_parameters_index')); }
/** * @EXT\Route("/maintenance/start", name="claro_admin_parameters_start_maintenance") * @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')") * * @return \Symfony\Component\HttpFoundation\Response */ public function startMaintenanceAction() { //the current ip must be whitelisted so it can access the the plateform when it's under maintenance $this->ipwlm->addIP($_SERVER['REMOTE_ADDR']); MaintenanceHandler::enableMaintenance(); return new RedirectResponse($this->router->generate('claro_admin_parameters_index')); }
protected function execute(InputInterface $input, OutputInterface $output) { MaintenanceHandler::enableMaintenance(); }