Commit 8e7a3135 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1785985: Remove quota triggers



- This looks like it was being handled by eventlistener_savedeleteartefact
and so didn't need to be a trigger function anyway

behatnotneeded

Change-Id: I837d2f4725c44ff0c525873b3406396033eb408c
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 68b57508
...@@ -126,39 +126,13 @@ class PluginArtefactFile extends PluginArtefact { ...@@ -126,39 +126,13 @@ class PluginArtefactFile extends PluginArtefact {
public static function set_quota_triggers() { public static function set_quota_triggers() {
set_config_plugin('artefact', 'file', 'quotanotifylimit', 80); set_config_plugin('artefact', 'file', 'quotanotifylimit', 80);
set_config_plugin('artefact', 'file', 'quotanotifyadmin', false); set_config_plugin('artefact', 'file', 'quotanotifyadmin', false);
// Create triggers to reset the quota notification flag
if (is_postgres()) { if (is_postgres()) {
$sql = "DROP FUNCTION IF EXISTS {unmark_quota_exeed_upd_set}() CASCADE;"; $sql = "DROP FUNCTION IF EXISTS {unmark_quota_exeed_upd_set}() CASCADE;";
execute_sql($sql); execute_sql($sql);
db_create_trigger(
'unmark_quota_exceed_upd_usr_set',
'AFTER', 'UPDATE', 'usr', "
UPDATE {usr_account_preference}
SET value = 0 FROM {artefact_config}
WHERE {usr_account_preference}.field = 'quota_exceeded_notified'
AND {usr_account_preference}.usr = NEW.id
AND {artefact_config}.plugin = 'file'
AND {artefact_config}.field = 'quotanotifylimit'
AND CAST(NEW.quotaused AS float)/CAST(NEW.quota AS float) < CAST({artefact_config}.value AS float)/100;"
);
} }
else { else {
$sql = "DROP TRIGGER IF EXISTS {unmark_quota_exceed_upd_set}"; $sql = "DROP TRIGGER IF EXISTS {unmark_quota_exceed_upd_set}";
execute_sql($sql); execute_sql($sql);
db_create_trigger(
'unmark_quota_exceed_upd_usr_set',
'AFTER', 'UPDATE', 'usr', "
UPDATE {usr_account_preference}, {artefact_config}
SET {usr_account_preference}.value = 0
WHERE {usr_account_preference}.field = 'quota_exceeded_notified'
AND {usr_account_preference}.usr = NEW.id
AND {artefact_config}.plugin = 'file'
AND {artefact_config}.field = 'quotanotifylimit'
AND NEW.quotaused/NEW.quota < {artefact_config}.value/100;"
);
} }
} }
......
...@@ -1497,6 +1497,7 @@ function xmldb_core_upgrade($oldversion=0) { ...@@ -1497,6 +1497,7 @@ function xmldb_core_upgrade($oldversion=0) {
db_drop_trigger('update_unread_insert2', 'module_multirecipient_userrelation'); db_drop_trigger('update_unread_insert2', 'module_multirecipient_userrelation');
db_drop_trigger('update_unread_update2', 'module_multirecipient_userrelation'); db_drop_trigger('update_unread_update2', 'module_multirecipient_userrelation');
db_drop_trigger('update_unread_delete2', 'module_multirecipient_userrelation'); db_drop_trigger('update_unread_delete2', 'module_multirecipient_userrelation');
db_drop_trigger('unmark_quota_exceed_upd_usr_set', 'usr');
} }
return $status; return $status;
......
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