filebackend: Restore TempFSFile shutdown-purge functionality
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 4 May 2019 20:04:58 +0000 (21:04 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 4 May 2019 20:06:14 +0000 (21:06 +0100)
Introduced in 603d8970c3575 to handle purging of tmp files
in case of fatals and other ways that the PHP process can exit
in a way that (some) destructors might not run, but shutdown
callbacks do.

It did not appear to work as it looped over the array values,
which are all int(1), instead of the array keys.

Change-Id: I83f0c8ea15e2bfb2bdc9aa2b4015635771abe394

includes/libs/filebackend/fsfile/TempFSFile.php

index 321424f..b993626 100644 (file)
@@ -178,7 +178,7 @@ class TempFSFile extends FSFile {
         * This method should only be called internally
         */
        public static function purgeAllOnShutdown() {
-               foreach ( self::$pathsCollect as $path ) {
+               foreach ( self::$pathsCollect as $path => $unused ) {
                        Wikimedia\suppressWarnings();
                        unlink( $path );
                        Wikimedia\restoreWarnings();