diff --git a/_register_database.php b/_register_database.php index 8d70a1ce2..903e3a0e5 100644 --- a/_register_database.php +++ b/_register_database.php @@ -11,7 +11,7 @@ DatabaseAdapterRegistry::register( 'class' => 'MySQLDatabase', 'module' => 'framework', 'title' => 'MySQL 5.0+ (using MySQLi)', - 'helperPath' => __DIR__ . '/Dev/Install/MySQLDatabaseConfigurationHelper.php', + 'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php', 'helperClass' => MySQLDatabaseConfigurationHelper::class, 'supported' => class_exists('MySQLi'), 'missingExtensionText' => @@ -27,7 +27,7 @@ DatabaseAdapterRegistry::register( 'class' => 'MySQLPDODatabase', 'module' => 'framework', 'title' => 'MySQL 5.0+ (using PDO)', - 'helperPath' => __DIR__ . '/Dev/Install/MySQLDatabaseConfigurationHelper.php', + 'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php', 'helperClass' => MySQLDatabaseConfigurationHelper::class, 'supported' => (class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers())), 'missingExtensionText' => diff --git a/composer.json b/composer.json index ce296f5c9..2d9fd8c39 100644 --- a/composer.json +++ b/composer.json @@ -38,18 +38,18 @@ "autoload": { "psr-4": { "SilverStripe\\Admin\\": "admin/code/", - "SilverStripe\\Assets\\": "Assets/", - "SilverStripe\\Control\\": "Control/", - "SilverStripe\\Core\\": "Core/", - "SilverStripe\\Dev\\": "Dev/", - "SilverStripe\\Forms\\": "Forms/", - "SilverStripe\\i18n\\": "i18n/", - "SilverStripe\\Logging\\": "Logging/", - "SilverStripe\\ORM\\": "ORM/", - "SilverStripe\\Security\\": "Security/", - "SilverStripe\\View\\": "View/" + "SilverStripe\\Assets\\": "src/Assets/", + "SilverStripe\\Control\\": "src/Control/", + "SilverStripe\\Core\\": "src/Core/", + "SilverStripe\\Dev\\": "src/Dev/", + "SilverStripe\\Forms\\": "src/Forms/", + "SilverStripe\\i18n\\": "src/i18n/", + "SilverStripe\\Logging\\": "src/Logging/", + "SilverStripe\\ORM\\": "src/ORM/", + "SilverStripe\\Security\\": "src/Security/", + "SilverStripe\\View\\": "src/View/" }, - "files": ["Core/Constants.php"], + "files": ["src/Core/Constants.php"], "classmap": ["tests/behat/features/bootstrap"] }, "include-path": [ diff --git a/src/Core/Constants.php b/src/Core/Constants.php index 10d45ff3a..6eb4140f1 100644 --- a/src/Core/Constants.php +++ b/src/Core/Constants.php @@ -224,7 +224,7 @@ define('THEMES_PATH', BASE_PATH . '/' . THEMES_DIR); // Relies on this being in a subdir of the framework. // If it isn't, or is symlinked to a folder with a different name, you must define FRAMEWORK_DIR -define('FRAMEWORK_PATH', realpath(__DIR__ . '/../')); +define('FRAMEWORK_PATH', realpath(__DIR__ . '/../../')); if(strpos(FRAMEWORK_PATH, BASE_PATH) === 0) { define('FRAMEWORK_DIR', trim(substr(FRAMEWORK_PATH, strlen(BASE_PATH)), DIRECTORY_SEPARATOR)); $frameworkDirSlashSuffix = FRAMEWORK_DIR ? FRAMEWORK_DIR . '/' : ''; diff --git a/src/Dev/Install/DatabaseAdapterRegistry.php b/src/Dev/Install/DatabaseAdapterRegistry.php index 695bc4eaf..2df209669 100644 --- a/src/Dev/Install/DatabaseAdapterRegistry.php +++ b/src/Dev/Install/DatabaseAdapterRegistry.php @@ -110,7 +110,7 @@ class DatabaseAdapterRegistry { * Detects all _register_database.php files and invokes them */ public static function autodiscover() { - foreach(glob(dirname(__FILE__) . '/../../../*', GLOB_ONLYDIR) as $directory) { + foreach(glob(__DIR__ . '/../../../../*', GLOB_ONLYDIR) as $directory) { if(file_exists($directory . '/_register_database.php')) { include_once($directory . '/_register_database.php'); } @@ -122,7 +122,7 @@ class DatabaseAdapterRegistry { * Called by ConfigureFromEnv.php */ public static function autoconfigure() { - foreach(glob(dirname(__FILE__) . '/../../../*', GLOB_ONLYDIR) as $directory) { + foreach(glob(__DIR__ . '/../../../../*', GLOB_ONLYDIR) as $directory) { if(file_exists($directory . '/_configure_database.php')) { include_once($directory . '/_configure_database.php'); } diff --git a/src/Dev/Install/config-form.html b/src/Dev/Install/config-form.html index 318917aa6..42ead62dd 100644 --- a/src/Dev/Install/config-form.html +++ b/src/Dev/Install/config-form.html @@ -7,8 +7,8 @@ SilverStripe CMS / Framework Installation - - + + diff --git a/src/Dev/Install/install.php b/src/Dev/Install/install.php index 4a084dd09..da4af29fc 100644 --- a/src/Dev/Install/install.php +++ b/src/Dev/Install/install.php @@ -19,8 +19,8 @@ if (version_compare(phpversion(), '5.5.0', '<')) { echo str_replace( array('$PHPVersion', 'sapphire'), array(phpversion(), FRAMEWORK_NAME), - file_get_contents(FRAMEWORK_NAME . "/Dev/Install/php5-required.html")); + file_get_contents(__DIR__ . "/php5-required.html")); die(); } -include(FRAMEWORK_NAME . '/Dev/Install/install.php5'); +include(__DIR__ . '/install.php5'); diff --git a/src/Dev/Install/install.php5 b/src/Dev/Install/install.php5 index e7431035a..da907faec 100755 --- a/src/Dev/Install/install.php5 +++ b/src/Dev/Install/install.php5 @@ -39,10 +39,19 @@ if(function_exists('session_start') && !session_id()) { } // require composers autoloader -if (file_exists($autoloadPath = dirname(__DIR__) . '/../../vendor/autoload.php')) { - require_once $autoloadPath; +$autoloadPaths = [ + __DIR__ . '/../../../vendor/autoload.php', // framework/vendor + __DIR__ . '/../../../../vendor/autoload.php', // root vendor +]; +$included = false; +foreach($autoloadPaths as $path) { + if (file_exists($path)) { + $included = true; + require_once $path; + break; + } } -else { +if (!$included) { if (!headers_sent()) { header($_SERVER['SERVER_PROTOCOL'] . " 500 Server Error"); header('Content-Type: text/plain'); @@ -54,8 +63,8 @@ else { $envFileExists = defined('SS_ENVIRONMENT_FILE'); $usingEnv = $envFileExists && !empty($_REQUEST['useEnv']); -require_once FRAMEWORK_NAME . '/Dev/Install/DatabaseConfigurationHelper.php'; -require_once FRAMEWORK_NAME . '/Dev/Install/DatabaseAdapterRegistry.php'; +require_once __DIR__ . '/DatabaseConfigurationHelper.php'; +require_once __DIR__ . '/DatabaseAdapterRegistry.php'; // Set default locale, but try and sniff from the user agent $defaultLocale = 'en_US'; @@ -240,7 +249,7 @@ if($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) { if((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq->hasErrors() && $adminConfig['username'] && $adminConfig['password']) { // Confirm before reinstalling if(!$installFromCli && $alreadyInstalled) { - include(FRAMEWORK_NAME . '/Dev/Install/config-form.html'); + include(__DIR__ . '/config-form.html'); } else { $inst = new Installer(); @@ -253,7 +262,7 @@ if((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq- // Show the config form } else { - include(FRAMEWORK_NAME . '/Dev/Install/config-form.html'); + include(__DIR__ . '/config-form.html'); } /** @@ -410,7 +419,7 @@ class InstallRequirements { )); // Check that we can identify the root folder successfully - $this->requireFile(FRAMEWORK_NAME . '/Dev/Install/config-form.html', array("File permissions", + $this->requireFile(FRAMEWORK_NAME . '/src/Dev/Install/config-form.html', array("File permissions", "Does the webserver know where files are stored?", "The webserver isn't letting me identify where files are stored.", $this->getBaseDir() @@ -1282,7 +1291,7 @@ class Installer extends InstallRequirements { Installing SilverStripe... - + @@ -1505,7 +1514,7 @@ PHP $this->statusMessage("Checking that friendly URLs work..."); $this->checkRewrite(); } else { - require_once 'core/startup/ParameterConfirmationToken.php'; + require_once 'Core/Startup/ParameterConfirmationToken.php'; $token = new ParameterConfirmationToken('flush'); $params = http_build_query($token->params()); @@ -1661,7 +1670,7 @@ TEXT; } public function checkRewrite() { - require_once 'core/startup/ParameterConfirmationToken.php'; + require_once 'Core/Startup/ParameterConfirmationToken.php'; $token = new ParameterConfirmationToken('flush'); $params = http_build_query($token->params()); diff --git a/src/Dev/Install/php5-required.html b/src/Dev/Install/php5-required.html index 708427df3..a535fb61a 100644 --- a/src/Dev/Install/php5-required.html +++ b/src/Dev/Install/php5-required.html @@ -1,7 +1,7 @@ PHP 5.5.0 is required - +
diff --git a/tests/PhpSyntaxTest.php b/tests/PhpSyntaxTest.php index ddfbf2849..3e8929e3b 100644 --- a/tests/PhpSyntaxTest.php +++ b/tests/PhpSyntaxTest.php @@ -26,7 +26,7 @@ class PhpSyntaxTest extends SapphireTest { $settingTests = array('short_open_tag=Off','short_open_tag=On -d asp_tags=On'); $files = $this->getAllFiles('php'); - $files[] = FRAMEWORK_PATH.'/dev/install/config-form.html'; + $files[] = FRAMEWORK_PATH.'/src/Dev/Install/config-form.html'; foreach($files as $i => $file) { $CLI_file = escapeshellarg($file); diff --git a/tests/bootstrap/phpunit.php b/tests/bootstrap/phpunit.php index 588eef4f0..ce544be3c 100644 --- a/tests/bootstrap/phpunit.php +++ b/tests/bootstrap/phpunit.php @@ -6,7 +6,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\DB; -require_once __DIR__ . '/../../Core/Core.php'; +require_once __DIR__ . '/../../src/Core/Core.php'; require_once __DIR__ . '/../FakeController.php'; global $databaseConfig; diff --git a/webpack.config.js b/webpack.config.js index 9717dd6a1..bdb8a44de 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,8 +17,8 @@ const PATHS = { FRAMEWORK_THIRDPARTY: './thirdparty', FRAMEWORK_CSS_SRC: './client/src/styles', FRAMEWORK_CSS_DIST: './client/dist/styles', - INSTALL_CSS_SRC: './dev/install/client/src/styles', - INSTALL_CSS_DIST: './dev/install/client/dist/styles', + INSTALL_CSS_SRC: './src/Dev/Install/client/src/styles', + INSTALL_CSS_DIST: './src/Dev/Install/client/dist/styles', }; // Used for autoprefixing css properties (same as Bootstrap Aplha.2 defaults)