http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97889

Revision: 97889
Author:   ariel
Date:     2011-09-23 06:15:20 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
handle naming checkpoint file with first/last pageID when the file is empty

Modified Paths:
--------------
    trunk/phase3/maintenance/dumpTextPass.php

Modified: trunk/phase3/maintenance/dumpTextPass.php
===================================================================
--- trunk/phase3/maintenance/dumpTextPass.php   2011-09-23 05:50:11 UTC (rev 
97888)
+++ trunk/phase3/maintenance/dumpTextPass.php   2011-09-23 06:15:20 UTC (rev 
97889)
@@ -286,8 +286,19 @@
                        // we wrote some stuff after last checkpoint that needs 
renamed
                        if (file_exists($filenameList[0])) {
                                $newFilenames = array();
-                               $firstPageID = 
str_pad($this->firstPageWritten,9,"0",STR_PAD_LEFT);
-                               $lastPageID = 
str_pad($this->lastPageWritten,9,"0",STR_PAD_LEFT);
+                               # we might have just written the header and 
footer and had no 
+                               # pages or revisions written... perhaps they 
were all deleted
+                               # there's no pageID 0 so we use that. the 
caller is responsible
+                               # for deciding what to do with a file 
containing only the
+                               # siteinfo information and the mw tags.
+                               if (! $this->firstPageWritten) {
+                                       $firstPageID = 
str_pad(0,9,"0",STR_PAD_LEFT);
+                                       $lastPageID = 
str_pad(0,9,"0",STR_PAD_LEFT);
+                               }
+                               else {
+                                       $firstPageID = 
str_pad($this->firstPageWritten,9,"0",STR_PAD_LEFT);
+                                       $lastPageID = 
str_pad($this->lastPageWritten,9,"0",STR_PAD_LEFT);
+                               }
                                for ( $i = 0; $i < count( $filenameList ); $i++ 
) {
                                        $checkpointNameFilledIn = sprintf( 
$this->checkpointFiles[$i], $firstPageID, $lastPageID );
                                        $fileinfo = pathinfo($filenameList[$i]);


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to