From feb351cfae9284f769419bfba48cd02f77c6ab57 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 18 Apr 2008 16:58:06 +0000 Subject: [PATCH] MDL-14072 - Merged from 19_STABLE. Prevent NULLs, empties and numbers to be processed by: - backup_encode_absolute_links() at backup - restore_decode_absolute_links() at restore --- backup/backuplib.php | 10 ++++++++++ backup/restorelib.php | 11 ++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index 6923292af0..91e833e618 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -2301,6 +2301,16 @@ 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. diff --git a/backup/restorelib.php b/backup/restorelib.php index 424e46fffb..d20491c972 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -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 -- 2.39.5