public function testCreate()
 {
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Theme\\Model\\Theme\\ThemeDependencyChecker');
     $this->themeDependencyCheckerFactory = new ThemeDependencyCheckerFactory($this->objectManagerProvider);
     $this->themeDependencyCheckerFactory->create();
 }
 /**
  * Constructor
  *
  * @param MagentoComposerApplicationFactory $applicationFactory
  * @param \Magento\Framework\Filesystem $filesystem
  * @param ComposerInformation $composerInformation
  * @param ObjectManagerProvider $objectManagerProvider
  * @throws \Exception
  */
 public function __construct(MagentoComposerApplicationFactory $applicationFactory, Filesystem $filesystem, ComposerInformation $composerInformation, ObjectManagerProvider $objectManagerProvider)
 {
     $this->application = $applicationFactory->create();
     $this->directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
     $this->objectManager = $objectManagerProvider->get();
     $this->composerInformation = $composerInformation;
 }
 public function testGet()
 {
     $this->locator->expects($this->once())->method('get')->with(InitParamListener::BOOTSTRAP_PARAM)->willReturn([]);
     $objectManager = $this->object->get();
     $this->assertInstanceOf('Magento\\Framework\\ObjectManagerInterface', $objectManager);
     $this->assertSame($objectManager, $this->object->get());
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         return;
     }
     /** @var DbVersionInfo $dbVersionInfo */
     $dbVersionInfo = $this->objectManagerProvider->get()->get('Magento\\Framework\\Module\\DbVersionInfo');
     $outdated = $dbVersionInfo->getDbVersionErrors();
     if (!empty($outdated)) {
         $output->writeln("<info>The module code base doesn't match the DB schema and data.</info>");
         $versionParser = new VersionParser();
         $codebaseUpdateNeeded = false;
         foreach ($outdated as $row) {
             if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') {
                 // check if module code base update is needed
                 $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]);
                 $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]);
                 if ($requiredVersion->matches($currentVersion)) {
                     $codebaseUpdateNeeded = true;
                 }
             }
             $output->writeln(sprintf("<info>%20s %10s: %11s  ->  %-11s</info>", $row[DbVersionInfo::KEY_MODULE], $row[DbVersionInfo::KEY_TYPE], $row[DbVersionInfo::KEY_CURRENT], $row[DbVersionInfo::KEY_REQUIRED]));
         }
         if ($codebaseUpdateNeeded) {
             $output->writeln('<info>Some modules use code versions newer or older than the database. ' . "First update the module code, then run 'setup:upgrade'.</info>");
             // we must have an exit code higher than zero to indicate something was wrong
             return \Magento\Framework\Console\Cli::RETURN_FAILURE;
         } else {
             $output->writeln("<info>Run 'setup:upgrade' to update your DB schema and data.</info>");
         }
     } else {
         $output->writeln('<info>All modules are up to date.</info>');
     }
 }
 public function testCreate()
 {
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Framework\\Module\\Status');
     $this->moduleStatusFactory = new ModuleStatusFactory($this->objectManagerProvider);
     $this->moduleStatusFactory->create();
 }
Пример #6
0
 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param \Magento\Framework\Composer\Remove $remove
  * @param UninstallCollector $collector
  * @param \Magento\Setup\Module\SetupFactory $setupFactory
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, \Magento\Framework\Composer\Remove $remove, UninstallCollector $collector, \Magento\Setup\Module\SetupFactory $setupFactory)
 {
     $this->objectManager = $objectManagerProvider->get();
     $this->remove = $remove;
     $this->collector = $collector;
     $this->setupFactory = $setupFactory;
 }
 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param WebLogger $logger
  * @param DirectoryList $directoryList
  * @param Filesystem $fileSystem
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, WebLogger $logger, DirectoryList $directoryList, Filesystem $fileSystem)
 {
     $objectManager = $objectManagerProvider->get();
     $this->backupHandler = $objectManager->create('Magento\\Framework\\Setup\\BackupRollback', ['log' => $logger]);
     $this->directoryList = $directoryList;
     $this->fileSystem = $fileSystem;
 }
Пример #8
0
 /**
  * Get instance of Timezone
  *
  * @return \Magento\Framework\Stdlib\DateTime\Timezone
  */
 public function get()
 {
     if (!$this->timezone) {
         $this->timezone = $this->objectManagerProvider->get()->create('Magento\\Framework\\Stdlib\\DateTime\\Timezone', ['scopeType' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT]);
     }
     return $this->timezone;
 }
 /**
  * Inject dependencies
  *
  * @param InstallerFactory $installerFactory
  * @param DeploymentConfig $deploymentConfig
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(InstallerFactory $installerFactory, DeploymentConfig $deploymentConfig, ObjectManagerProvider $objectManagerProvider)
 {
     $this->installerFactory = $installerFactory;
     $this->deploymentConfig = $deploymentConfig;
     $this->objectManager = $objectManagerProvider->get();
     parent::__construct();
 }
Пример #10
0
 /**
  * Get instance of DateTime
  *
  * @return \Magento\Framework\Stdlib\DateTime\DateTime
  */
 public function get()
 {
     if (!$this->dateTime) {
         $this->dateTime = $this->objectManagerProvider->get()->create('Magento\\Framework\\Stdlib\\DateTime\\DateTime', ['localeDate' => $this->tzProvider->get()]);
     }
     return $this->dateTime;
 }
Пример #11
0
 /**
  *  Constructor
  *
  * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param \Magento\Setup\Model\Cron\Status $status
  * @param array $name
  * @param array $params
  */
 public function __construct(\Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, \Symfony\Component\Console\Output\OutputInterface $output, \Magento\Setup\Model\Cron\Status $status, $name, $params = [])
 {
     $this->cleanupFiles = $objectManagerProvider->get()->get('Magento\\Framework\\App\\State\\CleanupFiles');
     $this->cache = $objectManagerProvider->get()->get('Magento\\Framework\\App\\Cache');
     $this->output = $output;
     $this->status = $status;
     parent::__construct($output, $status, $objectManagerProvider, $name, $params);
 }
Пример #12
0
 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param MaintenanceMode $maintenanceMode
  * @param DeploymentConfig $deploymentConfig
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, MaintenanceMode $maintenanceMode, DeploymentConfig $deploymentConfig)
 {
     $this->objectManager = $objectManagerProvider->get();
     $this->maintenanceMode = $maintenanceMode;
     $this->backupRollbackFactory = $this->objectManager->get('Magento\\Framework\\Setup\\BackupRollbackFactory');
     $this->deploymentConfig = $deploymentConfig;
     parent::__construct();
 }
Пример #13
0
 /**
  * Creates setup
  *
  * @param ResourceConnection $appResource
  * @return Setup
  */
 public function create(ResourceConnection $appResource = null)
 {
     $objectManager = $this->objectManagerProvider->get();
     if ($appResource === null) {
         $appResource = $objectManager->get('Magento\\Framework\\App\\ResourceConnection');
     }
     return new Setup($appResource);
 }
 /**
  * Constructor
  *
  * @param \Magento\Framework\Composer\ComposerInformation $composerInformation
  * @param Helper\ModuleUninstall $moduleUninstall
  * @param Helper\ThemeUninstall $themeUninstall
  * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param \Magento\Setup\Model\Cron\Queue $queue
  * @param \Magento\Setup\Model\Cron\Status $status
  * @param \Magento\Setup\Model\Updater $updater
  * @param string $name
  * @param array $params
  */
 public function __construct(\Magento\Framework\Composer\ComposerInformation $composerInformation, Helper\ModuleUninstall $moduleUninstall, Helper\ThemeUninstall $themeUninstall, \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, \Symfony\Component\Console\Output\OutputInterface $output, \Magento\Setup\Model\Cron\Queue $queue, \Magento\Setup\Model\Cron\Status $status, \Magento\Setup\Model\Updater $updater, $name, $params = [])
 {
     $this->composerInformation = $composerInformation;
     $this->moduleUninstall = $moduleUninstall;
     $this->themeUninstall = $themeUninstall;
     $this->objectManager = $objectManagerProvider->get();
     $this->updater = $updater;
     $this->queue = $queue;
     parent::__construct($output, $status, $objectManagerProvider, $name, $params);
 }
Пример #15
0
 /**
  * Constructor
  *
  * @param ModuleLoader $moduleLoader
  * @param DeploymentConfig $deploymentConfig
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(ModuleLoader $moduleLoader, DeploymentConfig $deploymentConfig, ObjectManagerProvider $objectManagerProvider)
 {
     $this->allModules = $moduleLoader->load();
     foreach (array_keys($this->allModules) as $module) {
         $this->allModules[$module]['selected'] = true;
         $this->allModules[$module]['disabled'] = true;
     }
     $this->deploymentConfig = $deploymentConfig;
     $this->dependencyChecker = $objectManagerProvider->get()->get('Magento\\Framework\\Module\\DependencyChecker');
 }
Пример #16
0
 /**
  * @param \Magento\Framework\Composer\ComposerInformation $composerInformation
  * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider
  * @param \Magento\Setup\Model\ConnectManager $connectManager
  * @param \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache
  */
 public function __construct(\Magento\Framework\Composer\ComposerInformation $composerInformation, \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache, \Magento\Setup\Model\ConnectManager $connectManager)
 {
     $this->composerInformation = $composerInformation;
     $objectManager = $objectManagerProvider->get();
     $this->enabledModuleList = $objectManager->get('Magento\\Framework\\Module\\ModuleList');
     $this->fullModuleList = $objectManager->get('Magento\\Framework\\Module\\FullModuleList');
     $this->packageInfo = $objectManager->get('Magento\\Framework\\Module\\PackageInfoFactory')->create();
     $this->connectManager = $connectManager;
     $this->updatePackagesCache = $updatePackagesCache;
 }
Пример #17
0
 public function setUp()
 {
     $this->moduleLoader = $this->getMock('Magento\\Framework\\Module\\ModuleList\\Loader', [], [], '', false);
     $this->dependencyChecker = $this->getMock('Magento\\Framework\\Module\\DependencyChecker', [], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->willReturn($this->dependencyChecker);
 }
Пример #18
0
 public function setup()
 {
     $this->backupRollbackFactory = $this->getMock('Magento\\Framework\\Setup\\BackupRollbackFactory', [], [], '', false);
     $this->backupRollback = $this->getMock('\\Magento\\Framework\\Setup\\BackupRollback', [], [], '', false);
     $this->status = $this->getMock('Magento\\Setup\\Model\\Cron\\Status', [], [], '', false);
     $output = $this->getMockForAbstractClass('Symfony\\Component\\Console\\Output\\OutputInterface', [], '', false);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface', [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->jobDbRollback = new JobDbRollback($this->backupRollbackFactory, $output, $this->status, $this->objectManagerProvider, 'setup:rollback', ['backup_file_name' => 'someFileName']);
 }
Пример #19
0
 /**
  * Constructor
  *
  * @param DeploymentConfig $deploymentConfig
  * @param DirectoryList $directoryList
  * @param Manager $taskManager
  * @param ObjectManagerProvider $objectManagerProvider
  * @param Filesystem $filesystem
  * @param DriverInterface $fileDriver
  * @param \Magento\Framework\Component\ComponentRegistrar $componentRegistrar
  */
 public function __construct(DeploymentConfig $deploymentConfig, DirectoryList $directoryList, Manager $taskManager, ObjectManagerProvider $objectManagerProvider, Filesystem $filesystem, DriverInterface $fileDriver, ComponentRegistrar $componentRegistrar)
 {
     $this->deploymentConfig = $deploymentConfig;
     $this->directoryList = $directoryList;
     $this->objectManager = $objectManagerProvider->get();
     $this->taskManager = $taskManager;
     $this->filesystem = $filesystem;
     $this->fileDriver = $fileDriver;
     $this->componentRegistrar = $componentRegistrar;
     parent::__construct();
 }
 protected function setUp()
 {
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProvider->expects($this->any())->method('get')->will($this->returnValue($objectManager));
     $this->status = $this->getMock('Magento\\Framework\\Module\\Status', [], [], '', false);
     $this->cache = $this->getMock('Magento\\Framework\\App\\Cache', [], [], '', false);
     $this->cleanupFiles = $this->getMock('Magento\\Framework\\App\\State\\CleanupFiles', [], [], '', false);
     $this->fullModuleList = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\Module\\Status', $this->status], ['Magento\\Framework\\App\\Cache', $this->cache], ['Magento\\Framework\\App\\State\\CleanupFiles', $this->cleanupFiles], ['Magento\\Framework\\Module\\FullModuleList', $this->fullModuleList]]));
 }
Пример #21
0
 /**
  * @param \Magento\Framework\Composer\ComposerInformation $composerInformation
  * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider
  * @param \Magento\Setup\Model\MarketplaceManager $marketplaceManager
  * @param \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache
  */
 public function __construct(\Magento\Framework\Composer\ComposerInformation $composerInformation, \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache, \Magento\Setup\Model\MarketplaceManager $marketplaceManager)
 {
     $this->composerInformation = $composerInformation;
     $objectManager = $objectManagerProvider->get();
     $this->enabledModuleList = $objectManager->get('Magento\\Framework\\Module\\ModuleList');
     $this->fullModuleList = $objectManager->get('Magento\\Framework\\Module\\FullModuleList');
     $this->packageInfo = $objectManager->get('Magento\\Framework\\Module\\PackageInfoFactory')->create();
     $this->marketplaceManager = $marketplaceManager;
     $this->updatePackagesCache = $updatePackagesCache;
     $this->timezone = $objectManager->get('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
 }
Пример #22
0
 public function setUp()
 {
     $this->serviceLocatorMock = $this->getMockForAbstractClass('Zend\\ServiceManager\\ServiceLocatorInterface', ['get']);
     $deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
     $objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface', [], [], '', false);
     $objectManager->expects($this->once())->method('get')->willReturn($deploymentConfig);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->serviceLocatorMock->expects($this->exactly(2))->method('get')->with('config')->will($this->returnValue(['navInstallerTitles' => ['install' => 'SomeTitle'], 'navInstaller' => [['key1' => 'value1'], ['key2' => 'value2'], ['nav' => 'abc', 'key3' => 'value3'], ['nav' => ''], ['nav' => false], ['main' => 'abc', 'key3' => 'value3'], ['main' => ''], ['main' => false]]]));
     $this->navigation = new Navigation($this->serviceLocatorMock, $this->objectManagerProvider);
 }
 /**
  * @param array $payload
  * @dataProvider createUpdaterTasksDataProvider
  */
 public function testCreateUpdaterTasks($payload)
 {
     $write = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\WriteInterface', [], '', false);
     $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($write);
     $write->expects($this->once())->method('writeFile');
     $cacheManager = $this->getMock('\\Magento\\Framework\\App\\Cache\\Manager', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('\\Magento\\Framework\\ObjectManagerInterface');
     $objectManager->expects($this->once())->method('get')->willReturn($cacheManager);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $cacheManager->expects($this->once())->method('getStatus')->willReturn(['cache1' => 1, 'cache2' => 0, 'cache3' => 1]);
     $this->model->createUpdaterTasks($payload);
 }
Пример #24
0
 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(ServiceLocatorInterface $serviceLocator, ObjectManagerProvider $objectManagerProvider)
 {
     $objectManager = $objectManagerProvider->get();
     if ($objectManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
         $this->navStates = $serviceLocator->get('config')[self::NAV_UPDATER];
         $this->navType = self::NAV_UPDATER;
         $this->titles = $serviceLocator->get('config')[self::NAV_UPDATER . 'Titles'];
     } else {
         $this->navStates = $serviceLocator->get('config')[self::NAV_INSTALLER];
         $this->navType = self::NAV_INSTALLER;
         $this->titles = $serviceLocator->get('config')[self::NAV_INSTALLER . 'Titles'];
     }
 }
 protected function setUp()
 {
     $this->objectManagerProviderMock = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProviderMock->expects($this->any())->method('get')->will($this->returnValue($objectManager));
     $this->statusMock = $this->getMock('Magento\\Framework\\Module\\Status', [], [], '', false);
     $this->cacheMock = $this->getMock('Magento\\Framework\\App\\Cache', [], [], '', false);
     $this->cleanupFilesMock = $this->getMock('Magento\\Framework\\App\\State\\CleanupFiles', [], [], '', false);
     $this->fullModuleListMock = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $this->deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
     $this->generatedFiles = $this->getMock('\\Magento\\Framework\\Code\\GeneratedFiles', [], [], '', false);
     $objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\Module\\Status', $this->statusMock], ['Magento\\Framework\\App\\Cache', $this->cacheMock], ['Magento\\Framework\\App\\State\\CleanupFiles', $this->cleanupFilesMock], ['Magento\\Framework\\Module\\FullModuleList', $this->fullModuleListMock]]));
 }
Пример #26
0
 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     if ($this->moduleList->has('Magento_SampleData')) {
         /** @var \Magento\Framework\Setup\SampleData\State $sampleData */
         $sampleData = $this->objectManagerProvider->get()->get('Magento\\Framework\\Setup\\SampleData\\State');
         $isSampleDataErrorInstallation = $sampleData->hasError();
     } else {
         $isSampleDataErrorInstallation = false;
     }
     $view = new ViewModel(['isSampleDataErrorInstallation' => $isSampleDataErrorInstallation]);
     $view->setTerminal(true);
     return $view;
 }
Пример #27
0
 public function testIndexAction()
 {
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', ['get'], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->willReturn($this->deploymentConfig);
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
     /** @var $controller Index */
     $controller = new Index($this->objectManagerProvider);
     $viewModel = $controller->indexAction();
     $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel);
     $this->assertFalse($viewModel->terminate());
 }
Пример #28
0
 /**
  * Constructor
  *
  * @param DeploymentConfig $deploymentConfig
  * @param DirectoryList $directoryList
  * @param Manager $taskManager
  * @param ObjectManagerProvider $objectManagerProvider
  * @param Filesystem $filesystem
  */
 public function __construct(
     DeploymentConfig $deploymentConfig,
     DirectoryList $directoryList,
     Manager $taskManager,
     ObjectManagerProvider $objectManagerProvider,
     Filesystem $filesystem
 ) {
     $this->deploymentConfig = $deploymentConfig;
     $this->directoryList    = $directoryList;
     $this->objectManager    = $objectManagerProvider->get();
     $this->taskManager      = $taskManager;
     $this->filesystem       = $filesystem;
     parent::__construct();
 }
 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     $sampleDataDeployed = $this->moduleList->has('Magento_SampleData');
     if ($sampleDataDeployed) {
         /** @var \Magento\Framework\Setup\SampleData\State $sampleData */
         $sampleData = $this->objectManagerProvider->get()->get('Magento\\Framework\\Setup\\SampleData\\State');
         $isSampleDataInstalled = $sampleData->isInstalled();
         $isSampleDataErrorInstallation = $sampleData->hasError();
     } else {
         $isSampleDataInstalled = false;
         $isSampleDataErrorInstallation = false;
     }
     $view = new ViewModel(['timezone' => $this->list->getTimezoneList(), 'currency' => $this->list->getCurrencyList(), 'language' => $this->list->getLocaleList(), 'isSampleDataInstalled' => $isSampleDataInstalled, 'isSampleDataErrorInstallation' => $isSampleDataErrorInstallation]);
     $view->setTerminal(true);
     return $view;
 }
Пример #30
0
 /**
  * Retrieve all available versions for a package
  *
  * @param string $package
  * @return array
  * @throws \RuntimeException
  */
 private function getPackageAvailableVersions($package)
 {
     $magentoRepositories = $this->composerInformation->getRootRepositories();
     // Check we have only one repo.magento.com repository
     if (count($magentoRepositories) === 1 && strpos($magentoRepositories[0], $this->packagesAuth->getCredentialBaseUrl())) {
         $packagesJsonData = $this->getPackagesJson();
         if ($packagesJsonData) {
             $packagesJsonData = json_decode($packagesJsonData, true);
         } else {
             $packagesJsonData['packages'] = [];
         }
         if (isset($packagesJsonData['packages'][$package])) {
             $packageVersions = $packagesJsonData['packages'][$package];
             uksort($packageVersions, 'version_compare');
             $packageVersions = array_reverse($packageVersions);
             return array_keys($packageVersions);
         }
     } else {
         $versionsPattern = '/^versions\\s*\\:\\s(.+)$/m';
         $commandParams = [self::PARAM_COMMAND => self::COMPOSER_SHOW, self::PARAM_PACKAGE => $package, self::PARAM_AVAILABLE => true];
         $applicationFactory = $this->objectManagerProvider->get()->get('Magento\\Framework\\Composer\\MagentoComposerApplicationFactory');
         /** @var \Magento\Composer\MagentoComposerApplication $application */
         $application = $applicationFactory->create();
         $result = $application->runComposerCommand($commandParams);
         $matches = [];
         preg_match($versionsPattern, $result, $matches);
         if (isset($matches[1])) {
             return explode(', ', $matches[1]);
         }
     }
     throw new \RuntimeException(sprintf('Couldn\'t get available versions for package %s', $package));
 }