MDL-55153 customlang: Remove local DB entries when deleting local file
authorSara Arjona <sara@moodle.com>
Wed, 21 Feb 2018 19:53:19 +0000 (20:53 +0100)
committerSara Arjona <sara@moodle.com>
Wed, 21 Feb 2018 21:00:15 +0000 (22:00 +0100)
admin/tool/customlang/locallib.php

index 02ae558..83e879a 100644 (file)
@@ -159,6 +159,11 @@ class tool_customlang_utils {
                         $needsupdate = true;
                         $current[$stringid]->local          = $stringlocal;
                         $current[$stringid]->timecustomized = $now;
+                    } else if (isset($currentlocal) && $stringlocal !== $currentlocal) {
+                        // If local string has been removed, we need to remove also the old local value from DB.
+                        $needsupdate = true;
+                        $current[$stringid]->local          = null;
+                        $current[$stringid]->timecustomized = $now;
                     }
 
                     if ($needsupdate) {