Improved Bootstrap experience and services improvements #154

Manually merged
aheathershaw merged 8 commits from feature/146-bootstrap-experience into master 2020-04-30 08:48:54 +01:00
18 changed files with 44 additions and 40 deletions
Showing only changes of commit e2f195f5be - Show all commits

View File

@ -1,6 +1,6 @@
<?php <?php
namespace AppBootstrap; namespace AppInstaller;
use App\Services\GiteaService; use App\Services\GiteaService;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
@ -10,22 +10,22 @@ use Illuminate\Support\Facades\Artisan;
* Because Laravel and other vendors are not yet available, it uses "raw" PHP and the odd few classes within Blue * Because Laravel and other vendors are not yet available, it uses "raw" PHP and the odd few classes within Blue
* Twilight, such as GiteaService. * Twilight, such as GiteaService.
* *
* @package AppBootstrap * @package AppInstaller
*/ */
class Bootstrapper class Installer
{ {
/**
* Path to /public/bootstrap
* @var string
*/
private $bootstrapDir;
/** /**
* Path to /app/config * Path to /app/config
* @var string * @var string
*/ */
private $configDir; private $configDir;
/**
* Path to /installer
* @var string
*/
private $installerDir;
/** /**
* Path to / - the app's root * Path to / - the app's root
* @var string * @var string
@ -33,7 +33,7 @@ class Bootstrapper
private $rootDir; private $rootDir;
/** /**
* Path to /public/bootstrap/temp * Path to /installer/temp
* @var string * @var string
*/ */
private $tempDir; private $tempDir;
@ -45,20 +45,20 @@ class Bootstrapper
private $vendorDir; private $vendorDir;
/** /**
* Path to /public/bootstrap/views * Path to /installer/views
* @var string * @var string
*/ */
private $viewsDir; private $viewsDir;
public function __construct() public function __construct()
{ {
$this->bootstrapDir = dirname(__DIR__); $this->installerDir = __DIR__;
$this->rootDir = dirname(dirname($this->bootstrapDir)); $this->rootDir = dirname($this->installerDir);
$this->configDir = sprintf('%s/config', dirname(dirname($this->bootstrapDir))); $this->configDir = sprintf('%s/config', dirname(dirname($this->installerDir)));
$this->tempDir = sprintf('%s/temp', $this->bootstrapDir); $this->tempDir = sprintf('%s/temp', $this->installerDir);
$this->vendorDir = sprintf('%s/vendor', $this->rootDir); $this->vendorDir = sprintf('%s/vendor', $this->rootDir);
$this->viewsDir = sprintf('%s/views', $this->bootstrapDir); $this->viewsDir = sprintf('%s/views', $this->installerDir);
chdir($this->rootDir); chdir($this->rootDir);
putenv('HOME=' . $this->rootDir); putenv('HOME=' . $this->rootDir);

View File

@ -1,6 +1,6 @@
{ {
"name": "aheathershaw/blue-twilight-bootstrapper", "name": "aheathershaw/blue-twilight-installer",
"description": "Bootstrapper component for Blue Twilight - self-hosted photo gallery software.", "description": "Installer for Blue Twilight - self-hosted photo gallery software.",
"keywords": [ "keywords": [
"blue", "blue",
"twilight", "twilight",
@ -19,8 +19,8 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"App\\": "../../app/", "App\\": "../app/",
"AppBootstrap\\": "src/" "AppInstaller\\": "./"
} }
} }
} }

View File

@ -1,4 +1,7 @@
<?php <?php
namespace AppInstaller;
function ends_with($stringToCheck, $stringToFind) function ends_with($stringToCheck, $stringToFind)
{ {
return strlen($stringToCheck) >= strlen($stringToFind) && return strlen($stringToCheck) >= strlen($stringToFind) &&

View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitae2939a73e74219a5e53fe33357ebb1a::getLoader(); return ComposerAutoloaderInitae1de26c658d13c195b98449ea1bf6a1::getLoader();

View File

@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'App\\' => array($baseDir . '/../../app'), 'App\\' => array($baseDir . '/../app'),
'AppBootstrap\\' => array($baseDir . '/src'), 'AppInstaller\\' => array($baseDir . '/'),
); );

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitae2939a73e74219a5e53fe33357ebb1a class ComposerAutoloaderInitae1de26c658d13c195b98449ea1bf6a1
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInitae2939a73e74219a5e53fe33357ebb1a
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitae2939a73e74219a5e53fe33357ebb1a', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInitae1de26c658d13c195b98449ea1bf6a1', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitae2939a73e74219a5e53fe33357ebb1a', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitae1de26c658d13c195b98449ea1bf6a1', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitae2939a73e74219a5e53fe33357ebb1a::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitae1de26c658d13c195b98449ea1bf6a1::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {

View File

@ -4,32 +4,32 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitae2939a73e74219a5e53fe33357ebb1a class ComposerStaticInitae1de26c658d13c195b98449ea1bf6a1
{ {
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
'A' => 'A' =>
array ( array (
'App\\' => 4, 'App\\' => 4,
'AppBootstrap\\' => 13, 'AppInstaller\\' => 13,
), ),
); );
public static $prefixDirsPsr4 = array ( public static $prefixDirsPsr4 = array (
'App\\' => 'App\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/../../app', 0 => __DIR__ . '/../..' . '/../app',
), ),
'AppBootstrap\\' => 'AppInstaller\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src', 0 => __DIR__ . '/../..' . '/',
), ),
); );
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitae2939a73e74219a5e53fe33357ebb1a::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitae1de26c658d13c195b98449ea1bf6a1::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitae2939a73e74219a5e53fe33357ebb1a::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitae1de26c658d13c195b98449ea1bf6a1::$prefixDirsPsr4;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -11,7 +11,7 @@
if (!file_exists(__DIR__.'/../vendor/autoload.php')) if (!file_exists(__DIR__.'/../vendor/autoload.php'))
{ {
$currentUrl = $_SERVER['PHP_SELF']; // e.g. /some/directory/index.php $currentUrl = $_SERVER['PHP_SELF']; // e.g. /some/directory/index.php
$bootstrapUrl = sprintf('%sbootstrap', dirname($currentUrl)); $bootstrapUrl = sprintf('%sinstall', dirname($currentUrl));
header(sprintf('Location: %s', $bootstrapUrl)); header(sprintf('Location: %s', $bootstrapUrl));
exit(); exit();
} }

View File

After

Width:  |  Height:  |  Size: 175 B

View File

After

Width:  |  Height:  |  Size: 581 B

View File

After

Width:  |  Height:  |  Size: 610 B

View File

@ -1,9 +1,10 @@
<?php <?php
require_once sprintf('%s/vendor/autoload.php', __DIR__);
require_once sprintf('%s/helpers.php', __DIR__);
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
$installerDir = sprintf('%s/installer', dirname(dirname(__DIR__)));
require_once sprintf('%s/vendor/autoload.php', $installerDir);
require_once sprintf('%s/helpers.php', $installerDir);
if (!function_exists('env')) if (!function_exists('env'))
{ {
// Define a dummy env() function that always returns the default value so we can load the config/app.php file // Define a dummy env() function that always returns the default value so we can load the config/app.php file
@ -16,8 +17,8 @@ if (!function_exists('env'))
try try
{ {
$bs = new \AppBootstrap\Bootstrapper(); $installer = new \AppInstaller\Installer();
$bs->handleRequest(); $installer->handleRequest();
} }
catch (\Exception $ex) catch (\Exception $ex)
{ {