/** * Run installation process for Sample Data * * @param array $request * @return void * @throws \Magento\Setup\SampleDataException * * @SuppressWarnings(PHPMD.UnusedPrivateMethod) Called by install() via callback. */ private function installSampleData($request) { try { $userName = isset($request[AdminAccount::KEY_USER]) ? $request[AdminAccount::KEY_USER] : ''; $this->objectManagerProvider->reset(); $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName); } catch (\Exception $e) { throw new \Magento\Setup\SampleDataException( "Error during sample data installation: {$e->getMessage()}", $e->getCode() ); } }
/** * Clear var/generation and reset object manager * * @return void */ private function cleanupGeneratedFiles() { $this->log->log('File system cleanup:'); $messages = $this->cleanupFiles->clearCodeGeneratedFiles(); // unload Magento autoloader because it may be using compiled definition foreach (spl_autoload_functions() as $autoloader) { if ($autoloader[0] instanceof \Magento\Framework\Code\Generator\Autoloader) { spl_autoload_unregister([$autoloader[0], $autoloader[1]]); break; } } // Corrected Magento autoloader will be loaded upon next get() call on $this->objectManagerProvider $this->objectManagerProvider->reset(); foreach ($messages as $message) { $this->log->log($message); } }
/** * Installs deployment configuration * * @param \ArrayObject|array $data * @return void */ public function installDeploymentConfig($data) { $this->checkInstallationFilePermissions(); $userData = is_array($data) ? $data : $data->getArrayCopy(); $this->setupConfigModel->process($userData); if ($this->deploymentConfig->isAvailable()) { $deploymentConfigData = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_CRYPT_KEY); if (isset($deploymentConfigData)) { $this->installInfo[ConfigOptionsList::KEY_ENCRYPTION_KEY] = $deploymentConfigData; } } // reset object manager now that there is a deployment config $this->objectManagerProvider->reset(); }