diff --git a/public/update.php b/public/update.php new file mode 100644 index 0000000..bf7567b --- /dev/null +++ b/public/update.php @@ -0,0 +1,146 @@ +baseDirectory = dirname(__DIR__); + chdir($this->baseDirectory); + putenv('HOME=' . $this->baseDirectory); + + // Display errors so installer never gets a WSOD! + ini_set('display_errors', true); + } + + public function run() + { + if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') + { + // Handle post + $this->runUpdate(); + exit(); + } + ?> + + + Blue Twilight Update + + +

Blue Twilight Update

+

This update routine ensures your Blue Twilight Composer packages are up-to-date.

+

To get started, simply click the button below.

+

This can take a few minutes so please be patient, and only click the button once!

+
+ +
+ +
+

Got Composer?

+ +

If you already have Composer installed, however, you may want to use that instead. Just run the below commands on your server, changing the path to Composer as appropriate:

+

Please note: "composer.phar" may actually be "composer" on your system.

+
+cd baseDirectory; ?>
+
+php artisan clear-compiled
+/path/to/composer.phar install
+        
+ + + +

Updating Blue Twilight Composer packages

+ + + echoError('Updating Composer packages failed'); + return false; + } + + $this->echoOK(); + return true; + } + + private function echoError($message) + { + echo sprintf("%s.%s", $message, PHP_EOL); + } + + private function echoOK($message = '') + { + echo "OK"; + + if (strlen($message) > 0) + { + echo sprintf('... %s', $message); + } + + echo '' . PHP_EOL; + } + + private function runComposer() + { + ob_start(); + system('php composer.phar install', $rc); + $result = ob_get_clean(); + echo nl2br($result); + if ($rc != 0) + { + $this->echoError('Updating Composer packages failed'); + return false; + } + + $this->echoOK(); + return true; + } +} + +$installer = new BlueTwilightUpdater(); +$installer->run(); \ No newline at end of file