/**
  * Flushes all caches.
  * @param bool $force
  */
 public function flushCommand($force = FALSE)
 {
     try {
         $this->cacheService->flush($force);
         // TODO: use nicer API once available
         ConsoleBootstrap::getInstance()->requestRunLevel(RunLevel::LEVEL_FULL);
         // Flush a second time to have extension caches and previously disabled core caches cleared when clearing not forced
         $this->cacheService->flush();
         $this->outputLine('Flushed all caches.');
     } catch (\Exception $e) {
         $this->outputLine($e->getMessage());
         $this->sendAndExit(1);
     }
 }
 /**
  * Builds an index of available commands. For each of them a Command object is
  * added to the commands array of this class.
  *
  * @return void
  */
 protected function buildCommandsIndex()
 {
     $availableCommands = $this->commandManager->getAvailableCommands();
     /** @var RunLevel $runLevel */
     $runLevel = ConsoleBootstrap::getInstance()->getEarlyInstance('Helhum\\Typo3Console\\Core\\Booting\\RunLevel');
     foreach ($availableCommands as $command) {
         if ($command->isInternal()) {
             continue;
         }
         $commandIdentifier = $command->getCommandIdentifier();
         $extensionKey = strstr($commandIdentifier, ':', TRUE);
         $commandControllerClassName = $command->getControllerClassName();
         $commandName = $command->getControllerCommandName();
         $shortCommandIdentifier = $this->commandManager->getShortestIdentifierForCommand($command);
         if ($runLevel->getMaximumAvailableRunLevel() === RunLevel::LEVEL_COMPILE && !$runLevel->isCommandAvailable($shortCommandIdentifier)) {
             continue;
         }
         $this->commandsByExtensionsAndControllers[$extensionKey][$commandControllerClassName][$commandName] = $command;
     }
 }
예제 #3
0
    unset($GLOBALS['__self_dir']);
    /**
     * Find out web path by trying several strategies
     */
    if (getenv('TYPO3_PATH_WEB')) {
        $webRoot = getenv('TYPO3_PATH_WEB');
    } elseif (isset($scriptLocation) && file_exists($scriptLocation . '/typo3/sysext')) {
        $webRoot = $scriptLocation;
    } elseif (file_exists(getcwd() . '/typo3/sysext')) {
        $webRoot = getcwd();
    } else {
        // Assume we are located in typo3conf/ext and neither folder is a link
        $webRoot = realpath(__DIR__ . '/../../../../');
    }
    define('PATH_site', strtr($webRoot, '\\', '/') . '/');
    define('PATH_thisScript', realpath(PATH_site . 'typo3/cli_dispatch.phpsh'));
    if (@file_exists(PATH_site . 'typo3/sysext/core/Classes/Core/ApplicationInterface.php')) {
        foreach (array(PATH_site . 'typo3/../vendor/autoload.php', PATH_site . 'typo3/vendor/autoload.php') as $possibleAutoloadLocation) {
            if (file_exists($possibleAutoloadLocation)) {
                $classLoader = (require_once $possibleAutoloadLocation);
                break;
            }
        }
    } else {
        require_once PATH_site . 'typo3/sysext/core/Classes/Core/Bootstrap.php';
        require_once PATH_site . 'typo3/sysext/core/Classes/Core/ApplicationContext.php';
    }
    require __DIR__ . '/../Classes/Core/ConsoleBootstrap.php';
    $bootstrap = \Helhum\Typo3Console\Core\ConsoleBootstrap::getInstance();
    $bootstrap->run(isset($classLoader) ? $classLoader : NULL);
}, isset($__self_dir) ? $__self_dir : NULL);
예제 #4
0
 /**
  * @param ConsoleBootstrap $bootstrap
  */
 public static function runLegacyBootstrap(ConsoleBootstrap $bootstrap)
 {
     $bootstrap->runLegacyBootstrap();
 }
예제 #5
0
 /**
  *
  */
 protected function shutdown()
 {
     $this->bootstrap->shutdown();
     exit($this->response->getExitCode());
 }