From 546de30fde8ab757e4233f0fc203cf37ddd5d248 Mon Sep 17 00:00:00 2001 From: Michael Aherne Date: Sun, 23 Feb 2025 14:49:31 +0000 Subject: [PATCH] MDL-83424 install: Fix install scripts --- public/admin/cli/install.php | 3 ++- install.php => public/install.php | 3 ++- public/message/output/popup/message_output_popup.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) rename install.php => public/install.php (99%) diff --git a/public/admin/cli/install.php b/public/admin/cli/install.php index bd3ff805fa7..4e80d7608c7 100644 --- a/public/admin/cli/install.php +++ b/public/admin/cli/install.php @@ -103,7 +103,7 @@ if (file_exists($distrolibfile)) { } // Nothing to do if config.php exists -$configfile = __DIR__.'/../../config.php'; +$configfile = dirname(__DIR__, 3).'/config.php'; if (file_exists($configfile)) { require($configfile); require_once($CFG->libdir.'/clilib.php'); @@ -158,6 +158,7 @@ global $CFG; $CFG = new stdClass(); $CFG->lang = 'en'; $CFG->dirroot = dirname(dirname(__DIR__)); +$CFG->root = dirname(__DIR__, 3); $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = "http://localhost"; $CFG->httpswwwroot = $CFG->wwwroot; diff --git a/install.php b/public/install.php similarity index 99% rename from install.php rename to public/install.php index 9ac3ed6c127..c4d50e3bd31 100644 --- a/install.php +++ b/public/install.php @@ -37,7 +37,7 @@ if (isset($_REQUEST['admin'])) { } // If config.php exists we just created config.php and need to redirect to continue installation -$configfile = '../config.php'; +$configfile = dirname(__DIR__) . '/config.php'; if (file_exists($configfile)) { header("Location: $admin/index.php?lang=$lang"); die; @@ -163,6 +163,7 @@ global $CFG; $CFG = new stdClass(); $CFG->lang = $config->lang; $CFG->dirroot = __DIR__; +$CFG->root = dirname(__DIR__); $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing $CFG->httpswwwroot = $CFG->wwwroot; diff --git a/public/message/output/popup/message_output_popup.php b/public/message/output/popup/message_output_popup.php index 32b2c014ccd..1e1cefba286 100644 --- a/public/message/output/popup/message_output_popup.php +++ b/public/message/output/popup/message_output_popup.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later */ -require_once(__DIR__ . '/../../../config.php'); //included from messagelib (how to fix?) +require_once(__DIR__ . '/../../../../config.php'); //included from messagelib (how to fix?) require_once($CFG->dirroot.'/message/output/lib.php'); /**