Catch and deal with UploadStashZeroLengthFileException when removing stashed files
authorReedy <reedy@wikimedia.org>
Thu, 27 Sep 2012 18:08:47 +0000 (19:08 +0100)
committerReedy <reedy@wikimedia.org>
Thu, 27 Sep 2012 18:08:47 +0000 (19:08 +0100)
Seen on the cluster and it halts script execution

reedy@fenari:/home/wikipedia/common$ mwscript cleanupUploadStash.php commonswiki
Getting list of files to clean up...
Removing 52958 file(s)...
File is zero length
Backtrace:

Change-Id: I740111ca20473c495a4a51edafa156169fe6dd4d

maintenance/cleanupUploadStash.php

index 99985b5..6afe9e1 100644 (file)
@@ -84,6 +84,8 @@ class UploadStashCleanup extends Maintenance {
                                $stash->removeFileNoAuth( $key );
                        } catch ( UploadStashBadPathException $ex ) {
                                $this->output( "Failed removing stashed upload with key: $key\n"  );
+                       } catch ( UploadStashZeroLengthFileException $ex ) {
+                               $this->output( "Failed removing stashed upload with key: $key\n"  );
                        }
                        if ( $i % 100 == 0 ) {
                                $this->output( "$i\n" );