Prevent update from failing caused by missing attachment files
authorAlexander Ebert <ebert@woltlab.com>
Sun, 17 May 2015 10:28:13 +0000 (12:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 17 May 2015 10:28:13 +0000 (12:28 +0200)
wcfsetup/install/files/acp/rebuild_attachments_com.woltlab.wcf_2.1.4.php

index a891d723ae80fbdfebfe4e7a670af93dd3f666f1..c64d35566202981a5f6f7b73d4d608658a03137c 100644 (file)
@@ -55,6 +55,11 @@ if ($rebuildData['max']) {
        else {
                $attachmentUpdates = array();
                foreach ($attachmentList as $attachment) {
+                       if (!file_exists($attachment->getLocation())) {
+                               // missing files should not cause the update to fail
+                               continue;
+                       }
+                       
                        $filesize = filesize($attachment->getLocation());
                        if ($filesize != $attachment->filesize) {
                                $attachmentUpdates[$attachment->attachmentID] = $filesize;