Example #1
0
 /**
  * If not installed, try to redirect to installation wizard
  *
  * @param Bootstrap $bootstrap
  * @param \Exception $exception
  * @return void
  * @throws \Exception
  */
 private function redirectToSetup(Bootstrap $bootstrap, \Exception $exception)
 {
     $setupInfo = new SetupInfo($bootstrap->getParams());
     $projectRoot = $this->_filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath();
     if ($setupInfo->isAvailable()) {
         $this->_response->setRedirect($setupInfo->getUrl());
         $this->_response->sendHeaders();
     } else {
         $newMessage = $exception->getMessage() . "\nNOTE: You cannot install Magento using the Setup Wizard " . "because the Magento setup directory cannot be accessed. \n" . 'You can install Magento using either the command line or you must restore access ' . 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n";
         $newMessage .= 'If you are using the sample nginx configuration, please go to ' . $this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $setupInfo->getUrl();
         throw new \Exception($newMessage, 0, $exception);
     }
 }
 /**
  * Check if base url enabled
  *
  * @param array $uri
  * @param \Magento\Framework\App\Request\Http $request
  * @return bool
  */
 protected function _isBaseUrlCorrect($uri, $request)
 {
     $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
     return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
 }
Example #3
0
 /**
  * Performs verification.
  *
  * @param array $uri
  * @param \Magento\Framework\App\Request\Http $request
  * @return bool
  */
 public function execute($uri, $request)
 {
     $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
     return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
 }