protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(sprintf('<comment>%s - Updating the platform...</comment>', date('H:i:s')));
     $verbosityLevelMap = array(LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL, LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL);
     $consoleLogger = new ConsoleLogger($output, $verbosityLevelMap);
     /** @var \Claroline\CoreBundle\Library\Installation\PlatformInstaller $installer */
     $installer = $this->getContainer()->get('claroline.installation.platform_installer');
     $installer->setOutput($output);
     $installer->setLogger($consoleLogger);
     $installer->installFromOperationFile();
     /** @var \Claroline\CoreBundle\Library\Installation\Refresher $refresher */
     $refresher = $this->getContainer()->get('claroline.installation.refresher');
     $refresher->dumpAssets($this->getContainer()->getParameter('kernel.environment'));
     $refresher->compileGeneratedThemes();
     MaintenanceHandler::disableMaintenance();
     $output->writeln(sprintf('<comment>%s - Platform updated.</comment>', date('H:i:s')));
 }
Beispiel #2
0
<?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;
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     MaintenanceHandler::disableMaintenance();
 }
Beispiel #4
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/end", name="claro_admin_parameters_end_maintenance")
  * @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')")
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function endMaintenanceAction()
 {
     //the current ip must be whitelisted so it can access the the plateform when it's under maintenance
     MaintenanceHandler::disableMaintenance();
     $this->ipwlm->removeIP($_SERVER['REMOTE_ADDR']);
     return new RedirectResponse($this->router->generate('claro_admin_parameters_index'));
 }
 /**
  * @EXT\Route("/maintenance/end", name="claro_admin_parameters_end_maintenance")
  * @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')")
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function endMaintenanceAction()
 {
     MaintenanceHandler::disableMaintenance();
     return new RedirectResponse($this->router->generate('claro_admin_parameters_index'));
 }
 public function isMaintenanceEnabled()
 {
     return MaintenanceHandler::isMaintenanceEnabled();
 }