From aa9caa474a12084e452871ea0389603ea51e59bb Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Mon, 14 Jul 2025 10:11:16 +0700 Subject: [PATCH] Support new public folder for DB comparison --- compare_databases/compare_databases.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/compare_databases/compare_databases.php b/compare_databases/compare_databases.php index 410902f5..9466d45e 100644 --- a/compare_databases/compare_databases.php +++ b/compare_databases/compare_databases.php @@ -68,12 +68,19 @@ if (empty($options['gitdir'])) { // Try to find it from env. $gitdir = getenv('gitdir'); - if (is_readable($gitdir . '/lib/dml/moodle_database.php')) { - $options['gitdir'] = $gitdir; - } else { - // Not found, exit. It must be passed. - cli_error('Unable to find a suitable Moodle code base. Please use the --gitdir param to specify it'); - } +} + +if (file_exists("{$gitdir}/public/version.php")) { + $dirroot = "{$gitdir}/public"; +} else { + $dirroot = $gitdir; +} + +if (is_readable($dirroot . '/lib/dml/moodle_database.php')) { + $options['gitdir'] = $dirroot; +} else { + // Not found, exit. It must be passed. + cli_error('Unable to find a suitable Moodle code base. Please use the --gitdir param to specify it'); } $options['dbhost2'] = empty($options['dbhost2']) ? $options['dbhost1'] : $options['dbhost2'];