Prechádzať zdrojové kódy

Catch error to avoid breaking the upgrade process

Yannick Warnier 8 rokov pred
rodič
commit
0b48e10d87

+ 7 - 1
main/install/update-files-1.9.0-1.10.0.inc.php

@@ -3,6 +3,7 @@
 
 use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Finder\Finder;
+use Symfony\Component\Filesystem\Exception\IOException;
 
 /**
  * Chamilo LMS
@@ -194,7 +195,12 @@ if (defined('SYSTEM_INSTALLATION')) {
                 error_log("Renaming: '$origin' to '$destination'");
             }
 
-            $fs->remove($origin);
+            try {
+                $fs->remove($origin);
+            } catch (IOException $e) {
+                // If removing the directory doesn't work, just log an error and continue
+                error_log('Could not move ' . $origin . ' to ' . $destination . '(' . $e->getMessage() . '). Please move it manually.');
+            }
         }
     }