MDL-26117 skip invalid resource records during upgrade
authorPetr Skoda <commits@skodak.org>
Tue, 25 Jan 2011 11:08:54 +0000 (12:08 +0100)
committerPetr Skoda <commits@skodak.org>
Wed, 26 Jan 2011 12:24:33 +0000 (13:24 +0100)
mod/resource/db/upgradelib.php

index df04b0c..243c900 100644 (file)
@@ -53,7 +53,11 @@ function resource_20_migrate() {
         $siteid = get_site()->id;
         $fs = get_file_storage();
 
-        if (strpos($path, 'LOCALPATH') === 0) {
+        if (empty($candidate->cmid)) {
+            // skip borked records
+            continue;
+
+        } else if (strpos($path, 'LOCALPATH') === 0) {
             // ignore not maintained local files - sorry
             continue;