]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14072 - Merged from 19_STABLE. Prevent NULLs, empties and numbers to be processed by:
authorstronk7 <stronk7>
Fri, 18 Apr 2008 16:58:06 +0000 (16:58 +0000)
committerstronk7 <stronk7>
Fri, 18 Apr 2008 16:58:06 +0000 (16:58 +0000)
- backup_encode_absolute_links() at backup
- restore_decode_absolute_links() at restore

backup/backuplib.php
backup/restorelib.php

index 6923292af011f80bcb3743a658a6076c404c92d3..91e833e6184a8c82f96f2e566aeaa0762811d865 100644 (file)
 
         global $CFG,$preferences;
 
+    /// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
+    /// heavy interlinking. Just a few cpu cycles saved.
+        if ($content === NULL) {
+            return NULL;
+        } else if ($content === '') {
+            return '';
+        } else if (is_numeric($content)) {
+            return $content;
+        }
+
         //Use one static variable to cache all the require_once calls that,
         //under PHP5 seems to increase load too much, and we are requiring
         //them here thousands of times (one per content). MDL-8700.
index 424e46fffb0c2c7048b38409913f44f92bcc3b62..d20491c9728a39088c31e11944079eab8980e0f7 100644 (file)
@@ -3495,13 +3495,14 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
 
         global $CFG,$restore;
 
-        // MDL-10770
-        // This function was replacing null with empty string
-        // Nullity check is added in backup_todb(), this function will no longer not be called from backup_todb() if content is null
-        // I noticed some parts of the restore code is calling this directly instead of calling backup_todb(), so just in case
-        // 3rd party mod etc are doing the same
+    /// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
+    /// heavy interlinking. Just a few cpu cycles saved.
         if ($content === NULL) {
             return NULL;
+        } else if ($content === '') {
+            return '';
+        } else if (is_numeric($content)) {
+            return $content;
         }
 
         //Now decode wwwroot and file.php calls