Commit c619fe8c authored by Malcolm Blaney's avatar Malcolm Blaney

Revert previous change to php/write_instance.php as autoload wasn't

the issue. The bug was actually that autoload was being used before the php file was copied to the correct directory, which has now been fixed in tests/bootstrap.php.
parent a47a4389
Pipeline #18385695 passed with stage
in 1 minute 3 seconds
......@@ -40,7 +40,7 @@ function write_instance() {
" include '../../php/modules/'.\$class.'.php';\n" .
" }\n" .
"}\n\n" .
"spl_autoload_register('dobrado_autoload', false);\n\n" .
"spl_autoload_register('dobrado_autoload');\n\n" .
"function instance(\$user, \$owner, \$label) {\n";
// The reason for looping through installed modules here rather than using
......@@ -156,22 +156,33 @@ set_include_path(get_include_path() . ':php');
if (!file_exists('php/instance.php')) {
include 'php/write_instance.php';
// instance.php gets written to the directory that bootsratp.php is called
// from (the parent directory) which breaks some path assumptions, so move
// it to the php directory.
rename('instance.php', 'php/instance.php');
include 'php/config.php';
include 'php/module.php';
include 'php/user.php';
$owner = 'admin';
$user = new User($owner);
// Each module's php file must be found in /php/modules for autoload. Also due
// to module dependencies, all php files must be copied before any modules can
// be installed. This is because instance.php already contains the full list
// of installed modules and will attempt to autoload any class requested.
foreach ($all_modules as $label => $module_info) {
// The module's php file must be found in /php/modules for autoload.
if (!file_exists('php/modules/' . ucfirst($label) . '.php')) {
copy('install/' . ucfirst($label) . '.php',
'php/modules/' . ucfirst($label) . '.php');
// Note that User->Settings() is called from the constructor, and autoloads the
// Start module, so all files must be found in the right place by here.
$owner = 'admin';
$user = new User($owner);
foreach ($all_modules as $label => $module_info) {
$module = new Module($user, $owner, $label);
// If a module includes javascript, prepare for calling Install by copying the
// files to the tests directory. Prefer files in the js directory but use the
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment