當前位置: 首頁>>代碼示例>>PHP>>正文


PHP State::isInstalled方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\State::isInstalled方法的典型用法代碼示例。如果您正苦於以下問題:PHP State::isInstalled方法的具體用法?PHP State::isInstalled怎麽用?PHP State::isInstalled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\State的用法示例。


在下文中一共展示了State::isInstalled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: read

 /**
  * Read configuration by code
  *
  * @param string $code
  * @return array
  */
 public function read($code = null)
 {
     if ($this->_appState->isInstalled()) {
         if (empty($code)) {
             $store = $this->_storeManager->getStore();
         } elseif ($code == \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT) {
             $store = $this->_storeManager->getDefaultStoreView();
         } else {
             $store = $this->_storeFactory->create();
             $store->load($code);
         }
         if (!$store->getCode()) {
             throw NoSuchEntityException::singleField('storeCode', $code);
         }
         $websiteConfig = $this->_scopePool->getScope(\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, $store->getWebsite()->getCode())->getSource();
         $config = array_replace_recursive($websiteConfig, $this->_initialConfig->getData("stores|{$code}"));
         $collection = $this->_collectionFactory->create(array('scope' => \Magento\Store\Model\ScopeInterface::SCOPE_STORES, 'scopeId' => $store->getId()));
         $dbStoreConfig = array();
         foreach ($collection as $item) {
             $dbStoreConfig[$item->getPath()] = $item->getValue();
         }
         $config = $this->_converter->convert($dbStoreConfig, $config);
     } else {
         $websiteConfig = $this->_scopePool->getScope(\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT)->getSource();
         $config = $this->_converter->convert($websiteConfig, $this->_initialConfig->getData("stores|{$code}"));
     }
     return $config;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:34,代碼來源:Store.php

示例2: beforeLaunch

 /**
  * Perform required checks before cron run
  *
  * @param \Magento\Framework\App\Cron $subject
  *
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @throws \Magento\Framework\Exception
  */
 public function beforeLaunch(\Magento\Framework\App\Cron $subject)
 {
     $this->_sidResolver->setUseSessionInUrl(false);
     if (false == $this->_appState->isInstalled()) {
         throw new \Magento\Framework\Exception('Application is not installed yet, please complete the installation first.');
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:ApplicationInitializer.php

示例3: get

 /**
  * Get config value by key
  *
  * @param null|string $path
  * @param null|mixed $default
  * @return null|mixed
  */
 public function get($path = null, $default = null)
 {
     if (!$this->_appState->isInstalled() && !in_array($this->_configScope->getCurrentScope(), array('global', 'install'))) {
         return $default;
     }
     return parent::get($path, $default);
 }
開發者ID:,項目名稱:,代碼行數:14,代碼來源:

示例4: aroundDispatch

 /**
  * Perform url rewites
  *
  * @param \Magento\Framework\App\FrontController $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_state->isInstalled()) {
         return $proceed($request);
     }
     $this->_rewriteService->applyRewrites($request);
     return $proceed($request);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:UrlRewrite.php

示例5: aroundDispatch

 /**
  * Dispatch request
  *
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_appState->isInstalled()) {
         $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
         $this->_response->setRedirect($this->_url->getUrl('install'));
         return $this->_response;
     }
     return $proceed($request);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Install.php

示例6: getThemeModel

 /**
  * Get theme model by theme path and area code
  *
  * @param string $themePath
  * @param string $areaCode
  * @return \Magento\Framework\View\Design\ThemeInterface
  */
 public function getThemeModel($themePath, $areaCode)
 {
     if ($this->appState->isInstalled()) {
         $themeModel = $this->flyweightFactory->create($themePath, $areaCode);
     } else {
         $themeModel = $this->themeList->getThemeByFullPath($areaCode . '/' . $themePath);
     }
     return $themeModel;
 }
開發者ID:,項目名稱:,代碼行數:16,代碼來源:

示例7: aroundDispatch

 /**
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @throws \Magento\Store\Model\Exception
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if ($this->_appState->isInstalled()) {
         if (!$this->_storeManager->getStore()->getIsActive()) {
             throw new \Magento\Store\Model\Exception('Current store is not active.');
         }
     }
     return $proceed($request);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:StoreCheck.php

示例8: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if ($this->_appState->isInstalled() && !$this->_cache->load('data_upgrade')) {
         $this->_dbUpdater->updateScheme();
         $this->_dbUpdater->updateData();
         $this->_cache->save('true', 'data_upgrade');
     }
     return $proceed($request);
 }
開發者ID:,項目名稱:,代碼行數:17,代碼來源:

示例9: read

 /**
  * {@inheritdoc}
  */
 public function read($scope = null)
 {
     $activeModules = $this->_filterActiveModules(parent::read($scope));
     if ($this->appState->isInstalled()) {
         foreach ($activeModules as $moduleConfig) {
             $this->dependencyManager->checkModuleDependencies($moduleConfig, $activeModules);
         }
     }
     return $this->_sortModules($activeModules);
 }
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例10: read

 /**
  * Read configuration data
  *
  * @return array
  */
 public function read()
 {
     $config = $this->_initialConfig->getData(\Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT);
     if ($this->_appState->isInstalled()) {
         $collection = $this->_collectionFactory->create(array('scope' => \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT));
         $dbDefaultConfig = array();
         foreach ($collection as $item) {
             $dbDefaultConfig[$item->getPath()] = $item->getValue();
         }
         $dbDefaultConfig = $this->_converter->convert($dbDefaultConfig);
         $config = array_replace_recursive($config, $dbDefaultConfig);
     }
     return $config;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:19,代碼來源:DefaultReader.php

示例11: beforeDispatch

 /**
  * Clear temporary directories
  *
  * @param \Magento\Install\Controller\Index\Index $subject
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function beforeDispatch(\Magento\Install\Controller\Index\Index $subject, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->appState->isInstalled()) {
         foreach ($this->varDirectory->read() as $dir) {
             if ($this->varDirectory->isDirectory($dir)) {
                 try {
                     $this->varDirectory->delete($dir);
                 } catch (FilesystemException $exception) {
                     $this->logger->log($exception->getMessage());
                 }
             }
         }
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:23,代碼來源:Dir.php

示例12: dispatch

 /**
  * Handle REST request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $path = $this->_pathProcessor->process($request->getPathInfo());
     $this->_request->setPathInfo($path);
     $this->areaList->getArea($this->_appState->getAreaCode())->load(\Magento\Framework\App\Area::PART_TRANSLATE);
     try {
         if (!$this->_appState->isInstalled()) {
             throw new \Magento\Webapi\Exception(__('Magento is not yet installed'));
         }
         $this->_checkPermissions();
         $route = $this->_getCurrentRoute();
         if ($route->isSecure() && !$this->_request->isSecure()) {
             throw new \Magento\Webapi\Exception(__('Operation allowed only in HTTPS'));
         }
         /** @var array $inputData */
         $inputData = $this->_request->getRequestData();
         $serviceMethodName = $route->getServiceMethod();
         $serviceClassName = $route->getServiceClass();
         $inputData = $this->_overrideParams($inputData, $route->getParameters());
         $inputParams = $this->_serializer->getInputData($serviceClassName, $serviceMethodName, $inputData);
         $service = $this->_objectManager->get($serviceClassName);
         /** @var \Magento\Framework\Service\Data\AbstractObject $outputData */
         $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams);
         $outputData = $this->_processServiceOutput($outputData);
         if ($this->_request->getParam(PartialResponseProcessor::FILTER_PARAMETER) && is_array($outputData)) {
             $outputData = $this->partialResponseProcessor->filter($outputData);
         }
         $this->_response->prepareResponse($outputData);
     } catch (\Exception $e) {
         $maskedException = $this->_errorProcessor->maskException($e);
         $this->_response->setException($maskedException);
     }
     return $this->_response;
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:40,代碼來源:Rest.php

示例13: _shouldSkipProcessModulesUpdates

 /**
  * Check whether modules updates processing should be skipped
  *
  * @return bool
  */
 protected function _shouldSkipProcessModulesUpdates()
 {
     if (!$this->_appState->isInstalled()) {
         return false;
     }
     return $this->_skipModuleUpdate;
 }
開發者ID:,項目名稱:,代碼行數:12,代碼來源:

示例14: get

 /**
  * Get storage instance
  *
  * @param array $arguments
  * @return \Magento\Store\Model\StoreManagerInterface
  * @throws \InvalidArgumentException
  */
 public function get(array $arguments = array())
 {
     $className = $this->_appState->isInstalled() ? $this->_installedStorageClassName : $this->_defaultStorageClassName;
     if (false == isset($this->_cache[$className])) {
         /** @var $storage \Magento\Store\Model\StoreManagerInterface */
         $storage = $this->_objectManager->create($className, $arguments);
         if (false === $storage instanceof \Magento\Store\Model\StoreManagerInterface) {
             throw new \InvalidArgumentException($className . ' doesn\'t implement \\Magento\\Store\\Model\\StoreManagerInterface');
         }
         $this->_cache[$className] = $storage;
         if ($className === $this->_installedStorageClassName) {
             $this->_reinitStores($storage, $arguments);
             $useSid = $this->_scopeConfig->isSetFlag(\Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storage->getStore());
             $this->_sidResolver->setUseSessionInUrl($useSid);
             $this->_eventManager->dispatch('core_app_init_current_store_after');
             $store = $storage->getStore(true);
             $logActive = $this->_scopeConfig->isSetFlag('dev/log/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
             if ($logActive || $this->_appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
                 $logFile = $this->_scopeConfig->getValue('dev/log/file', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
                 $logExceptionFile = $this->_scopeConfig->getValue('dev/log/exception_file', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
                 $this->_log->unsetLoggers();
                 $this->_log->addStreamLog(\Magento\Framework\Logger::LOGGER_SYSTEM, $logFile, $this->_writerModel);
                 $this->_log->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION, $logExceptionFile, $this->_writerModel);
             }
         }
     }
     return $this->_cache[$className];
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:35,代碼來源:StorageFactory.php

示例15: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  *
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_appState->isInstalled()) {
         $this->_response->setRedirect($this->_url->getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new \Magento\Framework\Object(array('identifier' => $identifier, 'continue' => true));
     $this->_eventManager->dispatch('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         $this->_response->setRedirect($condition->getRedirectUrl());
         $request->setDispatched(true);
         return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', array('request' => $request));
     }
     if (!$condition->getContinue()) {
         return null;
     }
     /** @var \Magento\Cms\Model\Page $page */
     $page = $this->_pageFactory->create();
     $pageId = $page->checkIdentifier($identifier, $this->_storeManager->getStore()->getId());
     if (!$pageId) {
         return null;
     }
     $request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
     $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', array('request' => $request));
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:36,代碼來源:Router.php


注:本文中的Magento\Framework\App\State::isInstalled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。