Commit 6307cc7f authored by Yaju Mahida's avatar Yaju Mahida Committed by Cecilia Vela Gurovic
Browse files

Bug 1779049: Make mysql_has_trigger_privilege() work better / more robust

behatnotneeded

Author:    Yaju Mahida <mahida@usq.edu.au>

Change-Id: I4a2c51a4a7af0842cc37ba710cdaec6c2d053d75
parent 2c5dbea5
......@@ -56,6 +56,7 @@ else {
}
ensure_upgrade_sanity();
$smarty->assign('upgradeheading', get_string('performingupgrades', 'admin'));
log_info(get_string('performingupgrades', 'admin'));
}
// Remove the "settings" component, which is not a real component (see check_upgrades())
......
......@@ -334,10 +334,7 @@ if (get_config('installed')) {
// from logins
require(get_config('libroot') . 'version.php');
$upgradeavailable = $config->version > get_config('version');
if ($upgradeavailable) {
ensure_upgrade_sanity();
}
else if ($config->version < get_config('version')) {
if ($config->version < get_config('version')) {
if (get_config('productionmode')) {
throw new ConfigSanityException("Database version of Mahara $corerelease ($coreversion) is newer "
. "than files version $config->release ($config->version). "
......
......@@ -1866,11 +1866,11 @@ function mysql_has_trigger_privilege() {
// seems to be quite hard. It would require parsing the output
// from SHOW GRANTS. It's much easier to try and create one.
execute_sql("CREATE TABLE {testtable} (testcolumn INT);");
execute_sql("CREATE TABLE IF NOT EXISTS {testtable} (testcolumn INT);");
try {
execute_sql("CREATE TRIGGER {testtrigger} BEFORE INSERT ON {testtable} FOR EACH ROW BEGIN END;");
execute_sql("DROP TRIGGER {testtrigger};");
db_create_trigger('testtrigger', 'AFTER', 'UPDATE', 'testtable', 'BEGIN END;');
db_drop_trigger('testtrigger', 'testtable');
$success = true;
}
catch (SQLException $e) {
......@@ -1880,7 +1880,7 @@ function mysql_has_trigger_privilege() {
$success = false;
}
execute_sql("DROP TABLE {testtable};");
execute_sql("DROP TABLE IF EXISTS {testtable};");
return $success;
}
......
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