If missing configuration, redirect to install.php
760569
protected function redirectToInstaller()
    {
        // Error if installer not available
        if (!file_exists(Director::publicFolder() . '/install.php')) {
            throw new HTTPResponse_Exception(
                'SilverStripe Framework requires database configuration defined via .env',
                500
            );
        }

        // Redirect to installer
        $response = new HTTPResponse();
        $response->redirect(Director::absoluteURL('install.php'));
        throw new HTTPResponse_Exception($response);
    }
696817
def pip_install(self, reqs):
        """"""
        if not reqs:
            return
        log.info('Calling pip to install %s', reqs)
        check_call([
            sys.executable, '-m', 'pip', 'install', '--ignore-installed',
            '--prefix', self.path] + list(reqs))
1084678
public static function installConfig()
    {
        if (!file_exists(self::getRootDir().'config/vendor_config.yml')) {
            file_put_contents(self::getRootDir().'config/vendor_config.yml', '');
        }

        if (!file_exists(self::getRootDir().'config/routing.yml')) {
            file_put_contents(self::getRootDir().'config/routing.yml', '');
        }

        if (!file_exists(self::getRootDir().'bundles.php')) {
            file_put_contents(self::getRootDir().'bundles.php', "<?php\nreturn [\n];");
        }

        // set memory_limit = 1G
        if (file_exists(self::getRootDir().'/../bin/php/php.ini')) {
            /* @var $manipulator PhpIni */
            $manipulator = self::getContainer()->getManipulator('php.ini');

            $limit = $manipulator->get('memory_limit') ?: '1G';
            $limit = is_array($limit) ? array_pop($limit) : $limit;
            if ($manipulator->byteStringToInt($limit) < 1073741824) { // < 1G
                $manipulator->set('memory_limit', '1G');
            }
        }
    }
1145330
protected function registerRedirection(): void
    {
        if (! empty($this->redirectAfterInstalled) && \is_string($this->redirectAfterInstalled)) {
            Installation::$redirectAfterInstalled = $this->redirectAfterInstalled;
        }
    }
577357
protected function resolveInstaller(): ?string
    {
        $value = $this->getModuleInfo()['installer'] ?? null;

        return is_string($value) ? $value : null;
    }
959974
protected function installConfigFileWithBash()
    {
        passthru(str_replace(" ", "\ ", __DIR__).'/../bash_scripts/iluminar.sh '. str_replace(" ", "\ ", $this->laravel_config_file) .' '
            . str_replace(" ", "\ ", $this->laravel_services_file));
    }
538066
protected function _install()
    {
        $message = __d('installer', "Please provide a theme source, it can be either an URL or a filesystem path to a ZIP/directory within your server?\n[Q]uit");
        while (true) {
            $source = $this->in($message);
            if (strtoupper($source) === 'Q') {
                $this->err(__d('installer', 'Installation aborted'));
                break;
            } else {
                $this->out(__d('installer', 'Starting installation...'), 0);
                $task = $this->dispatchShell("Installer.plugins install -s \"{$source}\" --theme -a");

                if ($task === 0) {
                    $this->_io->overwrite(__d('installer', 'Starting installation... successfully installed!'), 2);
                    $this->out();
                    break;
                } else {
                    $this->_io->overwrite(__d('installer', 'Starting installation... failed!'), 2);
                    $this->out();
                }
            }
        }

        $this->out();
    }
895748
protected function configHandle()
    {
        $packageConfigPath = __DIR__.'/config/config.php';
        $appConfigPath     = config_path('comment.php');

        $this->mergeConfigFrom($packageConfigPath, 'comment');

        $this->publishes([
            $packageConfigPath => $appConfigPath,
        ], 'config');
    }
1372199
def main():
    """"""
    options = _parse_args()
    archive = download_setuptools(
        version=options.version,
        download_base=options.download_base,
        downloader_factory=options.downloader_factory,
    )
    return _install(archive, _build_install_args(options))
1007332
protected function ensureRequiredEnvironment()
    {
        if (version_compare(phpversion(), self::MINIMUM_PHP_VERSION, '<')) {
            echo('Flow requires PHP version ' . self::MINIMUM_PHP_VERSION . ' or higher but your installed version is currently ' . phpversion() . '. (Error #1172215790)' . PHP_EOL);
            exit(1);
        }
        if (!extension_loaded('mbstring')) {
            echo('Flow requires the PHP extension "mbstring" (Error #1207148809)' . PHP_EOL);
            exit(1);
        }
        if (DIRECTORY_SEPARATOR !== '/' && PHP_WINDOWS_VERSION_MAJOR < 6) {
            echo('Flow does not support Windows versions older than Windows Vista or Windows Server 2008 (Error #1312463704)' . PHP_EOL);
            exit(1);
        }

        if (!extension_loaded('Reflection')) {
            echo('The PHP extension "Reflection" is required by Flow.' . PHP_EOL);
            exit(1);
        }
        $method = new \ReflectionMethod(__CLASS__, __FUNCTION__);
        if ($method->getDocComment() === false || $method->getDocComment() === '') {
            echo('Reflection of doc comments is not supported by your PHP setup. Please check if you have installed an accelerator which removes doc comments.' . PHP_EOL);
            exit(1);
        }

        set_time_limit(0);

        if (ini_get('date.timezone') === '') {
            ini_set('date.timezone', 'UTC');
        }

        if (!is_dir(FLOW_PATH_DATA) && !is_link(FLOW_PATH_DATA)) {
            if (!@mkdir(FLOW_PATH_DATA)) {
                echo('Flow could not create the directory "' . FLOW_PATH_DATA . '". Please check the file permissions manually or run "sudo ./flow flow:core:setfilepermissions" to fix the problem. (Error #1347526552)');
                exit(1);
            }
        }
        if (!is_dir(FLOW_PATH_DATA . 'Persistent') && !is_link(FLOW_PATH_DATA . 'Persistent')) {
            if (!@mkdir(FLOW_PATH_DATA . 'Persistent')) {
                echo('Flow could not create the directory "' . FLOW_PATH_DATA . 'Persistent". Please check the file permissions manually or run "sudo ./flow flow:core:setfilepermissions" to fix the problem. (Error #1347526553)');
                exit(1);
            }
        }
        if (!is_dir(FLOW_PATH_TEMPORARY) && !is_link(FLOW_PATH_TEMPORARY)) {
            // We can't use Files::createDirectoryRecursively() because mkdir() without shutup operator will lead to a PHP warning
            $oldMask = umask(000);
            if (!@mkdir(FLOW_PATH_TEMPORARY, 0777, true)) {
                echo('Flow could not create the directory "' . FLOW_PATH_TEMPORARY . '". Please check the file permissions manually or run "sudo ./flow flow:core:setfilepermissions" to fix the problem. (Error #1441354578)');
                exit(1);
            }
            umask($oldMask);
        }
    }
800917
protected function configure()
	{
		// the short description shown while running "php bin/console list"
		if( $this->docs->getIs("description") )
		{
			$this->setDescription($this->docs["description"]);
		}

		// the full command description shown when running the command with
		// the "--help" option
		if( $this->docs->getIs("help") )
		{
			$this->setHelp($this->docs["help"]);
		}
	}
52869
public function install()
    {
        $grumPhpFile = $this->destination . '/grumphp.yml';

        if (file_exists($grumPhpFile)) {
            unlink($grumPhpFile);
            $this->io->write(
                sprintf(
                    '<comment>Removed:</comment> existing GrumPHP config file %s',
                    $grumPhpFile
                )
            );
        }

        $definition = $this->file->read();
        if (!empty($definition['extra']['grumphp']['config-default-path'])) {
            return;
        }

        $definition['extra']['grumphp']['config-default-path'] =
            'vendor/mediact/testing-suite/config/default/grumphp.yml';

        $this->file->write($definition);
        $this->io->write(
            '<info>Added:</info> GrumPHP config to composer.json'
        );
    }
114113
public function boot()
    {
        require __DIR__.'/../permissions.php';
        require __DIR__.'/../composers.php';
        require __DIR__.'/../helpers.php';
        require __DIR__.'/../observers.php';
        require __DIR__.'/../menus.php';
        require __DIR__.'/../routes.php';

        if (file_exists($path = app_path('menus.php'))) {
            require $path;
        }
    }
827529
def install_reqs(venv, repo_dest):
    """"""
    with dir_path(repo_dest):
        args = ['-r', 'requirements/compiled.txt']
        if not verbose:
            args.insert(0, '-q')
        subprocess.check_call([os.path.join(venv, 'bin', 'pip'), 'install'] +
                              args)
444687
public static function install()
    {
        global $PPHP;
        $db = $PPHP['db'];

        echo "    Installing users...\n";
        $db->begin();
        $customs = '';
        if (isset($PPHP['config']['users']['fields'])) {
            foreach ($PPHP['config']['users']['fields'] as $name => $definition) {
                $customs .= "                {$name} {$definition},\n";
            };
        };
        $db->exec(
            "
            CREATE TABLE IF NOT EXISTS 'users' (
                id           INTEGER PRIMARY KEY AUTOINCREMENT,
                email        VARCHAR(255) NOT NULL DEFAULT '',
                active       BOOL NOT NULL DEFAULT '1',
                passwordHash VARCHAR(255) NOT NULL DEFAULT '*',
                onetimeHash  VARCHAR(255) NOT NULL DEFAULT '*',
                onetimeTime  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                onetimeMax   INTEGER NOT NULL DEFAULT '0',
                {$customs}
                name         VARCHAR(255) NOT NULL DEFAULT ''
            )
            "
        );
        $db->exec(
            "
            CREATE UNIQUE INDEX IF NOT EXISTS idx_users_email
            ON users (email)
            "
        );
        if (!$db->selectAtom("SELECT id FROM users WHERE id='1'")) {
            echo "Creating admin user...\n";
            $email = strtolower(readline("E-mail address: "));
            $pass1 = true;
            $pass2 = false;
            while ($pass1 !== $pass2) {
                if ($pass1 !== true) {
                    echo "  * Password confirmation mis-match.\n";
                };
                $pass1 = readline("Password: ");
                $pass2 = readline("Password again: ");
            };
            $db->exec(
                "
                INSERT INTO users
                (id, email, passwordHash, name)
                VALUES
                (1, ?, ?, ?)
                ",
                array(
                    $email,
                    password_hash($pass1, PASSWORD_DEFAULT),
                    'Administrator'
                )
            );
        };
        if (!$db->selectAtom("SELECT id FROM users WHERE id='0'")) {
            // Yes it's auto-increment, but we need clean foreign keys and a
            // default "system" to be 0.
            $db->exec(
                "
                INSERT INTO users (id, active, email, name)
                VALUES (?, ?, ?)
                ",
                array(
                    0,
                    0,
                    '*',
                    'System'
                )
            );
        };
        $db->commit();
        echo "    done!\n";
    }
409862
public function Index() {
      $this->AddJsFile('setup.js');
      
      $this->ApplicationFolder = 'dashboard';
      $this->MasterView = 'setup';
      // Fatal error if Garden has already been installed.
      $Installed = C('Garden.Installed');
      if ($Installed) {
         $this->View = "AlreadyInstalled";
         $this->Render();
         return;
      }
      
      if (!$this->_CheckPrerequisites()) {
         $this->View = 'prerequisites';
      } else {
         $this->View = 'configure';
         
         // Make sure the user has copied the htaccess file over.
         if (!file_exists(PATH_ROOT.'/.htaccess') && !$this->Form->GetFormValue('SkipHtaccess')) {
            $this->SetData('NoHtaccess', TRUE);
            $this->Form->AddError(T('You are missing Vanilla\'s .htaccess file.', 'You are missing Vanilla\'s <b>.htaccess</b> file. Sometimes this file isn\'t copied if you are using ftp to upload your files because this file is hidden. Make sure you\'ve copied the <b>.htaccess</b> file before continuing.'));
         }
         
         $ApplicationManager = new Gdn_ApplicationManager();
         
         // Need to go through all of the setups for each application. Garden,
         if ($this->Configure() && $this->Form->IsPostBack()) {
            // Get list of applications to enable during install
            // Override by creating conf/config.php and adding this setting before install begins
            $AppNames = C('Garden.Install.Applications', array('Conversations', 'Vanilla'));
            try {
               // Step through the available applications, enabling each of them.
               foreach ($AppNames as $AppName) {
                  $Validation = new Gdn_Validation();
                  $ApplicationManager->RegisterPermissions($AppName, $Validation);
                  $ApplicationManager->EnableApplication($AppName, $Validation);
               }
            } catch (Exception $ex) {
               $this->Form->AddError($ex);
            }
            if ($this->Form->ErrorCount() == 0) {
               // Save a variable so that the application knows it has been installed.
               // Now that the application is installed, select a more user friendly error page.
               $Config = array('Garden.Installed' => TRUE);
               SaveToConfig($Config);
               
               // Go to the dashboard
               Redirect('/settings/gettingstarted');
            }
         }
      }
      $this->Render();
   }
542338
public function install_plugins() {

		$result = system(
			WP_PHP_BINARY
			. ' ' . escapeshellarg( dirname( dirname( __FILE__ ) ) . '/bin/install-plugins.php' )
			. ' ' . escapeshellarg( json_encode( $this->plugins ) )
			. ' ' . escapeshellarg( $this->locate_wp_tests_config() )
			. ' ' . (int) is_multisite()
			. ' ' . escapeshellarg( json_encode( $this->files ) )
			, $exit_code
		);

		if ( 0 !== $exit_code ) {
			echo( 'Remote plugin installation failed with exit code ' . $exit_code . PHP_EOL );
			exit( 1 );
		} elseif ( ! empty( $result ) ) {
			echo( PHP_EOL . 'Remote plugin installation produced unexpected output.' . PHP_EOL );
			exit( 1 );
		}

		// The caching functions may not be loaded yet.
		if ( function_exists( 'wp_cache_flush' ) ) {
			wp_cache_flush();
		}

		remove_action( 'all', array( $this, 'install_plugins' ) );
	}