コード例 #1
0
ファイル: InstallerScripts.php プロジェクト: nos3/aimeos-flow
 /**
  * Post composer install or update tasks
  *
  * @param \Composer\Script\CommandEvent $event
  */
 public static function postUpdateAndInstall(CommandEvent $event)
 {
     $options = array();
     if ($event->isDevMode()) {
         $options['options'] = 'setup/default/demo:1';
     }
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:setup', array(), true, $options);
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:cache', array());
 }
 /**
  * Refreeze a package
  *
  * Refreezes a currently frozen package: all precompiled information is removed
  * and file monitoring will consider the package exactly once, on the next
  * request. After that request, the package remains frozen again, just with the
  * updated data.
  *
  * By specifying <b>all</b> as a package key, all currently frozen packages are
  * refrozen (the default).
  *
  * @param string $packageKey Key of the package to refreeze, or 'all'
  * @return void
  * @see typo3.flow:package:freeze
  * @see typo3.flow:cache:flush
  */
 public function refreezeCommand($packageKey = 'all')
 {
     if (!$this->bootstrap->getContext()->isDevelopment()) {
         $this->outputLine('Package freezing is only supported in Development context.');
         $this->quit(3);
     }
     $packagesToRefreeze = [];
     if ($packageKey === 'all') {
         foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
             if ($this->packageManager->isPackageFrozen($packageKey)) {
                 $packagesToRefreeze[] = $packageKey;
             }
         }
         if ($packagesToRefreeze === []) {
             $this->outputLine('Nothing to do, no packages were frozen.');
             $this->quit(0);
         }
     } else {
         if ($packageKey === null) {
             $this->outputLine('You must specify a package to refreeze.');
             $this->quit(1);
         }
         if (!$this->packageManager->isPackageAvailable($packageKey)) {
             $this->outputLine('Package "%s" is not available.', [$packageKey]);
             $this->quit(2);
         }
         if (!$this->packageManager->isPackageFrozen($packageKey)) {
             $this->outputLine('Package "%s" was not frozen.', [$packageKey]);
             $this->quit(0);
         }
         $packagesToRefreeze = [$packageKey];
     }
     foreach ($packagesToRefreeze as $packageKey) {
         $this->packageManager->refreezePackage($packageKey);
         $this->outputLine('Refroze package "%s".', [$packageKey]);
     }
     Scripts::executeCommand('typo3.flow:cache:flush', $this->settings, false);
     $this->sendAndExit(0);
 }
コード例 #3
0
ファイル: DatabaseStep.php プロジェクト: kdambekalns/setup
 /**
  * This method is called when the form of this step has been submitted
  *
  * @param array $formValues
  * @return void
  * @throws \Exception
  */
 public function postProcessFormValues(array $formValues)
 {
     $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.driver', $formValues['driver']);
     $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.dbname', $formValues['dbname']);
     $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.user', $formValues['user']);
     $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.password', $formValues['password']);
     $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.host', $formValues['host']);
     $this->configurationSource->save(FLOW_PATH_CONFIGURATION . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->distributionSettings);
     $this->configurationManager->flushConfigurationCache();
     $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
     $connectionSettings = $settings['persistence']['backendOptions'];
     try {
         $this->connectToDatabase($connectionSettings);
     } catch (\Exception $exception) {
         if (!$exception instanceof DBALException && !$exception instanceof \PDOException) {
             throw $exception;
         }
         try {
             $this->createDatabase($connectionSettings, $formValues['dbname']);
         } catch (DBALException $exception) {
             throw new SetupException(sprintf('Database "%s" could not be created. Please check the permissions for user "%s". DBAL Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1351000841, $exception);
         } catch (\PDOException $exception) {
             throw new SetupException(sprintf('Database "%s" could not be created. Please check the permissions for user "%s". PDO Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1346758663, $exception);
         }
         try {
             $this->connectToDatabase($connectionSettings);
         } catch (DBALException $exception) {
             throw new SetupException(sprintf('Could not connect to database "%s". Please check the permissions for user "%s". DBAL Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1351000864);
         } catch (\PDOException $exception) {
             throw new SetupException(sprintf('Could not connect to database "%s". Please check the permissions for user "%s". PDO Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1346758737);
         }
     }
     $migrationExecuted = Scripts::executeCommand('typo3.flow:doctrine:migrate', $settings, FALSE);
     if ($migrationExecuted !== TRUE) {
         throw new SetupException(sprintf('Could not execute database migrations. Please check the permissions for user "%s" and execute "./flow typo3.flow:doctrine:migrate" manually.', $formValues['user']), 1346759486);
     }
     $this->resetPolicyRolesCacheAfterDatabaseChanges();
 }
コード例 #4
0
 /**
  * @param PresetPartDefinition $partSetting
  * @return integer
  */
 protected function executeCommand(PresetPartDefinition $partSetting)
 {
     $startTime = microtime(TRUE);
     ob_start();
     $status = Scripts::executeCommand('ttree.contentrepositoryimporter:import:executebatch', $this->getFlowSettings(), TRUE, $partSetting->getCommandArguments());
     $count = (int) ob_get_clean();
     $elapsedTime = (microtime(TRUE) - $startTime) * 1000;
     $this->elapsedTime += $elapsedTime;
     ++$this->batchCounter;
     if ($count > 0) {
         $this->outputLine('  #%d %d records in %dms, %d ms per record, %d ms per batch (avg)', [$partSetting->getCurrentBatch(), $count, $elapsedTime, $elapsedTime / $count, $this->elapsedTime / $this->batchCounter]);
     }
     if ($status !== TRUE) {
         $this->outputLine("Command '%s' return an error", [$partSetting->getLabel()]);
         $this->quit(1);
     }
     return $count;
 }