本文整理汇总了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;
}
示例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.');
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}
}
}
}
}
示例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;
}
示例13: _shouldSkipProcessModulesUpdates
/**
* Check whether modules updates processing should be skipped
*
* @return bool
*/
protected function _shouldSkipProcessModulesUpdates()
{
if (!$this->_appState->isInstalled()) {
return false;
}
return $this->_skipModuleUpdate;
}
示例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];
}
示例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));
}