Skip to content

Commit d533823

Browse files
authored
Merge pull request #360 from HuongNV13/supportPublicFolderDBCompare
Support new public folder for DB comparison
2 parents 609de1a + aa9caa4 commit d533823

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

compare_databases/compare_databases.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,19 @@
6868
if (empty($options['gitdir'])) {
6969
// Try to find it from env.
7070
$gitdir = getenv('gitdir');
71-
if (is_readable($gitdir . '/lib/dml/moodle_database.php')) {
72-
$options['gitdir'] = $gitdir;
73-
} else {
74-
// Not found, exit. It must be passed.
75-
cli_error('Unable to find a suitable Moodle code base. Please use the --gitdir param to specify it');
76-
}
71+
}
72+
73+
if (file_exists("{$gitdir}/public/version.php")) {
74+
$dirroot = "{$gitdir}/public";
75+
} else {
76+
$dirroot = $gitdir;
77+
}
78+
79+
if (is_readable($dirroot . '/lib/dml/moodle_database.php')) {
80+
$options['gitdir'] = $dirroot;
81+
} else {
82+
// Not found, exit. It must be passed.
83+
cli_error('Unable to find a suitable Moodle code base. Please use the --gitdir param to specify it');
7784
}
7885

7986
$options['dbhost2'] = empty($options['dbhost2']) ? $options['dbhost1'] : $options['dbhost2'];

0 commit comments

Comments
 (0)