FOF30\Generator\Command\Command::setDevServer PHP Метод

setDevServer() публичный Метод

Load the Joomla Configuration from a dev site
public setDevServer ( boolean $force = false )
$force boolean Should we ask the user even if we have a .fof file?
    public function setDevServer($force = false)
    {
        $path = '';
        // .fof file not found, ask the user!
        if (!JFile::exists(getcwd() . '/.fof') || $force) {
            $this->out("What's the dev site location? ( /var/www/ )");
            $path = $this->in();
            if (!$path || !JFolder::exists($path)) {
                $this->out('The path does not exists');
                $this->setDevServer();
            }
            if (!JFile::exists($path . '/configuration.php')) {
                $this->out('The path does not contain a Joomla Website');
                $this->setDevServer();
            }
            $fof = array('dev' => $path);
            JFile::write(getcwd() . '/.fof', json_encode($fof));
        } else {
            $fof = json_decode(JFile::read(getcwd() . '/.fof'));
            if ($fof && $fof->dev) {
                $path = $fof->dev;
            }
        }
        if (!$path) {
            throw new \RuntimeException("Could not detect the path to the dev server");
        }
        // Load the configuration object.
        /** @var \FofApp $app */
        $app = JFactory::getApplication();
        $app->reloadConfiguration($path);
    }