From: Ariel Glenn Date: Fri, 23 Sep 2011 06:15:20 +0000 (+0000) Subject: handle naming checkpoint file with first/last pageID when the file is empty X-Git-Tag: 1.31.0-rc.0~27465 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/One?a=commitdiff_plain;h=2ec322f6c28eda03842a41413ec03bca9d97ba6d;p=lhc%2Fweb%2Fwiklou.git handle naming checkpoint file with first/last pageID when the file is empty --- diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 9ca6d74ccc..92e049f7df 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -286,8 +286,19 @@ class TextPassDumper extends BackupDumper { // 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]);