/** * Ask for a valid shopware path until the user enters it * * @param string $shopwarePath * @return string */ public function getValidShopwarePath($shopwarePath = null) { if (!$shopwarePath) { $shopwarePath = realpath(getcwd()); } if ($this->isShopwareInstallation($shopwarePath)) { return $shopwarePath; } return $this->ioService->askAndValidate("Path to your Shopware installation: ", array($this, 'validateShopwarePath')); }
/** * @param InputInterface $input * @param IoService $ioService * @param string $suggestion * * @return string */ private function askInstallationDir(InputInterface $input, IoService $ioService, $suggestion) { $installDir = $input->getOption('installDir'); if (!$installDir) { $installDir = $ioService->askAndValidate("Please provide the install directory <{$suggestion}>: ", array($this, 'validateInstallDir')); $input->setOption('installDir', trim($installDir) ? $installDir : $suggestion); return $installDir; } return $installDir; }
/** * @param string $shopwarePath * @param IoService $ioService * @return string */ public function getValidShopwarePath($shopwarePath, IoService $ioService) { if (!$shopwarePath) { $shopwarePath = realpath(getcwd()); } do { if ($this->container->get('utilities')->isShopwareInstallation($shopwarePath)) { return $shopwarePath; } } while (($shopwarePath = dirname($shopwarePath)) && $shopwarePath != '/'); return $ioService->askAndValidate("Path to your Shopware installation: ", array($this->container->get('utilities'), 'validateShopwarePath')); }