From a634f6086b833b2f91ebc15c3c61e7cbdcca89d6 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 7 Oct 2013 12:59:33 +0100 Subject: [PATCH] Installer --- public/install.php | 420 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) create mode 100644 public/install.php diff --git a/public/install.php b/public/install.php new file mode 100644 index 00000000..8003d353 --- /dev/null +++ b/public/install.php @@ -0,0 +1,420 @@ +dump($config); + + file_put_contents(PHPCI_DIR . 'PHPCI/config.yml', $yaml); + + /** + * Create database: + */ + $dbhost = $config['b8']['database']['servers']['write'][0]; + $dbname = $config['b8']['database']['name']; + $dbuser = $config['b8']['database']['username']; + $dbpass = $config['b8']['database']['password']; + + $pdo = new PDO('mysql:host=' . $dbhost, $dbuser, $dbpass); + + $pdo->query('CREATE DATABASE IF NOT EXISTS `' . $dbname . '`'); + + /** + * Bootstrap PHPCI and populate database: + */ + require(PHPCI_DIR . 'bootstrap.php'); + + ob_start(); + $gen = new \b8\Database\Generator(\b8\Database::getConnection(), 'PHPCI', PHPCI_DIR . 'PHPCI/Model/Base/'); + $gen->generate(); + ob_end_clean(); + + /** + * Create our admin user: + */ + $store = \b8\Store\Factory::getStore('User'); + + try { + $user = $store->getByEmail($adminUser); + } catch (Exception $ex) { + } + + if (empty($user)) { + $user = new \PHPCI\Model\User(); + $user->setEmail($adminUser); + $user->setName($adminUser); + $user->setIsAdmin(1); + $user->setHash(password_hash($adminPass, PASSWORD_DEFAULT)); + + $store->save($user); + } + + $formAction = '/session/login'; + } +} + + +switch ($installStage) { + case 'start': + $nextStage = 'database'; + break; + + case 'database': + $nextStage = 'github'; + break; + + case 'github': + $nextStage = 'email'; + break; + + case 'email': + $nextStage = 'complete'; + break; +} + +?> + + + + Install PHPCI + + + + + + + + +
+
+ +
+
+ + + + + +

Welcome to PHPCI!

+ +

Your server has passed all of PHPCI's pre-installation checks, please press continue below to + begin installation.

+ +

Please correct the problems below, then refresh this page to continue.

+ + + +

Important! You need to run composer to install dependencies before running the installer.

+ + + + +

Important! ./PHPCI/config.yml needs to be writeable to continue.

+ + + +

Important! PHPCI requires PHP 5.3.3 or above.

+ + + + +

Database Details

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

PHPCI Details

+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + + +

Github App Settings (Optional)

+
+ +
+ +
+
+ +
+ +
+ +
+
+ + + +

SMTP Settings (Optional)

+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +

The address system emails should come from.

+
+
+ +
+ +
+ +

The address to which notifications should go by default.

+
+
+ + + +

Thank you for installing PHPCI. Click continue below to log in for the first time!

+ + + + + + +
+
+ +
+
+ +
+
+ + +
+
+ + + +