https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103041

Revision: 103041
Author:   reedy
Date:     2011-11-14 21:43:14 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
REL1_18 MFT r96616, r97889

Partial merge (non Export.php) of r96648, r101591

Modified Paths:
--------------
    branches/REL1_18/phase3/maintenance/backup.inc
    branches/REL1_18/phase3/maintenance/dumpBackup.php
    branches/REL1_18/phase3/maintenance/dumpTextPass.php

Property Changed:
----------------
    branches/REL1_18/phase3/
    branches/REL1_18/phase3/includes/


Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97604,98962,98971,99004,99065
/trunk/phase3:92580,92634,92713,92762,92765,92791,92846,92854,92884,92886-92887,92894,92898,92907,92932,92958,93065,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93726,93818-93822,93834,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,94171,94199,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94867,94995-94997,95023,95042,95072-95073,95155,95163,95327,95332,95410,95422,95426,95442,95468,95601,95812,96178,96182,96437-96438,96579,97175,97291,97806,97815,97821,97895,98069,98193-98194,98210,98212,98235,98237,98298,98374,98379,98411,98426,98502,98602-98603,98605,98610,98612,98656,98665,98669,98676,98678,98703,98707,98713,98716,98718-98720,98755-98756,98760-98761,98774,98812,98880,98884,98927,98963,98975,98990,98997,99031,99081-99082,99091-99092,99102,99104,99118,99126,99135-99136,99138,99154,99172,99236,99250,99252,99254,99286,99304,99308,99318,99321,99323,99332,99349,99353,99369-99371,99396,99477,99630,99632,99653,99680,99694,99700,99897,99910,99914,99931,99952,99994,100021,100115,100211,100219,100221,100223,100226,100239,100242,100347,100391,100398,100510,100572,100575-100576,100592,100701,101010,101306,101314,101370,101376,101417,101420,101445,101449-101451,101454,101464,101470,101476,101540,101666,101860,101990,102027,102297,102301,102303,102334-102335,102414,102416,102440,102488,102498,102537,102710,102751,102951,102954
   + /branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97604,98962,98971,99004,99065
/trunk/phase3:92580,92634,92713,92762,92765,92791,92846,92854,92884,92886-92887,92894,92898,92907,92932,92958,93065,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93726,93818-93822,93834,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,94171,94199,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94867,94995-94997,95023,95042,95072-95073,95155,95163,95327,95332,95410,95422,95426,95442,95468,95601,95812,96178,96182,96437-96438,96579,96616,96648,97175,97291,97806,97815,97821,97889,97895,98069,98193-98194,98210,98212,98235,98237,98298,98374,98379,98411,98426,98502,98602-98603,98605,98610,98612,98656,98665,98669,98676,98678,98703,98707,98713,98716,98718-98720,98755-98756,98760-98761,98774,98812,98880,98884,98927,98963,98975,98990,98997,99031,99081-99082,99091-99092,99102,99104,99118,99126,99135-99136,99138,99154,99172,99236,99250,99252,99254,99286,99304,99308,99318,99321,99323,99332,99349,99353,99369-99371,99396,99477,99630,99632,99653,99680,99694,99700,99897,99910,99914,99931,99952,99994,100021,100115,100211,100219,100221,100223,100226,100239,100242,100347,100391,100398,100510,100572,100575-100576,100592,100701,101010,101306,101314,101370,101376,101417,101420,101445,101449-101451,101454,101464,101470,101476,101540,101591,101666,101860,101990,102027,102297,102301,102303,102334-102335,102414,102416,102440,102488,102498,102537,102710,102751,102951,102954


Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:98962,98971,99004,99065
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93065,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93726,93818-93822,93834,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,94171,94199,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,96178,96182,96437-96438,97175,97291,97806,97815,97895,98069,98193-98194,98210,98212,98235,98237,98298,98374,98379,98411,98426,98502,98602-98603,98605,98610,98612,98656,98676,98703,98707,98713,98716,98718-98720,98755-98756,98760-98761,98774,98812,98880,98884,98927,98963,98975,98990,98997,99081-99082,99102,99104,99118,99126,99135-99136,99138,99172,99236,99250,99252,99254,99286,99304,99308,99318,99323,99332,99349,99369-99371,99477,99630,99632,99680,99694,99700,99897,99910,99914,99931,99952,100021,100115,100211,100219,100221,100223,100226,100239,100242,100347,100398,100510,100572,100575,100592,100701,101010,101306,101314,101370,101376,101417,101420,101445,101449-101451,101454,101464,101470,101476,101666,101860,101990,102027,102301,102303,102334-102335,102414,102440,102488,102498,102537,102710,102751,102951,102954
   + /branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:98962,98971,99004,99065
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93065,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93726,93818-93822,93834,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,94171,94199,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,96178,96182,96437-96438,97175,97291,97806,97815,97895,98069,98193-98194,98210,98212,98235,98237,98298,98374,98379,98411,98426,98502,98602-98603,98605,98610,98612,98656,98676,98703,98707,98713,98716,98718-98720,98755-98756,98760-98761,98774,98812,98880,98884,98927,98963,98975,98990,98997,99081-99082,99102,99104,99118,99126,99135-99136,99138,99172,99236,99250,99252,99254,99286,99304,99308,99318,99323,99332,99349,99369-99371,99477,99630,99632,99680,99694,99700,99897,99910,99914,99931,99952,100021,100115,100211,100219,100221,100223,100226,100239,100242,100347,100398,100510,100572,100575,100592,100701,101010,101306,101314,101370,101376,101417,101420,101445,101449-101451,101454,101464,101470,101476,101591,101666,101860,101990,102027,102301,102303,102334-102335,102414,102440,102488,102498,102537,102710,102751,102951,102954

Modified: branches/REL1_18/phase3/maintenance/backup.inc
===================================================================
--- branches/REL1_18/phase3/maintenance/backup.inc      2011-11-14 21:42:58 UTC 
(rev 103040)
+++ branches/REL1_18/phase3/maintenance/backup.inc      2011-11-14 21:43:14 UTC 
(rev 103041)
@@ -210,6 +210,8 @@
                } else if ( is_null( $this->pages ) ) {
                        if ( $this->startId || $this->endId ) {
                                $exporter->pagesByRange( $this->startId, 
$this->endId );
+                       } elseif ( $this->revStartId || $this->revEndId ) {
+                               $exporter->revsByRange( $this->revStartId, 
$this->revEndId );
                        } else {
                                $exporter->allPages();
                        }

Modified: branches/REL1_18/phase3/maintenance/dumpBackup.php
===================================================================
--- branches/REL1_18/phase3/maintenance/dumpBackup.php  2011-11-14 21:42:58 UTC 
(rev 103040)
+++ branches/REL1_18/phase3/maintenance/dumpBackup.php  2011-11-14 21:43:14 UTC 
(rev 103041)
@@ -27,7 +27,7 @@
 
 $originalDir = getcwd();
 
-$optionsWithArgs = array( 'pagelist', 'start', 'end' );
+$optionsWithArgs = array( 'pagelist', 'start', 'end', 'revstart', 'revend');
 
 require_once( dirname( __FILE__ ) . '/commandLine.inc' );
 require_once( 'backup.inc' );
@@ -57,6 +57,13 @@
 if ( isset( $options['end'] ) ) {
        $dumper->endId = intval( $options['end'] );
 }
+
+if ( isset( $options['revstart'] ) ) {
+       $dumper->revStartId = intval( $options['revstart'] );
+}
+if ( isset( $options['revend'] ) ) {
+       $dumper->revEndId = intval( $options['revend'] );
+}
 $dumper->skipHeader = isset( $options['skip-header'] );
 $dumper->skipFooter = isset( $options['skip-footer'] );
 $dumper->dumpUploads = isset( $options['uploads'] );
@@ -72,6 +79,8 @@
        $dumper->dump( WikiExporter::STABLE, $textMode );
 } elseif ( isset( $options['logs'] ) ) {
        $dumper->dump( WikiExporter::LOGS );
+} elseif ( isset($options['revrange'] ) ) {
+       $dumper->dump( WikiExporter::RANGE, $textMode );
 } else {
        $dumper->progress( <<<ENDS
 This script dumps the wiki page or logging database into an
@@ -87,7 +96,8 @@
   --stable    Stable versions of pages?
   --pagelist=<file>
                          Where <file> is a list of page titles to be dumped
-
+  --revrange  Dump specified range of revisions, requires
+              revstart and revend options.
 Options:
   --quiet     Don't dump status reports to stderr.
   --report=n  Report position and speed after every n pages processed.
@@ -95,6 +105,8 @@
   --server=h  Force reading from MySQL server h
   --start=n   Start from page_id or log_id n
   --end=n     Stop before page_id or log_id n (exclusive)
+  --revstart=n  Start from rev_id n
+  --revend=n    Stop before rev_id n (exclusive)
   --skip-header Don't output the <mediawiki> header
   --skip-footer Don't output the </mediawiki> footer
   --stub      Don't perform old_text lookups; for 2-pass dump

Modified: branches/REL1_18/phase3/maintenance/dumpTextPass.php
===================================================================
--- branches/REL1_18/phase3/maintenance/dumpTextPass.php        2011-11-14 
21:42:58 UTC (rev 103040)
+++ branches/REL1_18/phase3/maintenance/dumpTextPass.php        2011-11-14 
21:43:14 UTC (rev 103041)
@@ -56,9 +56,9 @@
 
        var $xmlwriterobj = false;
 
-       # when we spend more than maxTimeAllowed seconds on this run, we 
continue
-       # processing until we write out the next complete page, then save 
output file(s),
-       # rename it/them and open new one(s)
+       // when we spend more than maxTimeAllowed seconds on this run, we 
continue
+       // processing until we write out the next complete page, then save 
output file(s),
+       // rename it/them and open new one(s)
        var $maxTimeAllowed = 0;  // 0 = no limit
        var $timeExceeded = false;
        var $firstPageWritten = false;
@@ -72,11 +72,11 @@
        }
 
        function dump( $history, $text = WikiExporter::TEXT ) {
-               # This shouldn't happen if on console... ;)
+               // This shouldn't happen if on console... ;)
                header( 'Content-type: text/html; charset=UTF-8' );
 
-               # Notice messages will foul up your XML output even if they're
-               # relatively harmless.
+               // Notice messages will foul up your XML output even if they're
+               // relatively harmless.
                if ( ini_get( 'display_errors' ) )
                        ini_set( 'display_errors', 'stderr' );
 
@@ -86,10 +86,10 @@
 
                $this->egress = new ExportProgressFilter( $this->sink, $this );
 
-               # it would be nice to do it in the constructor, oh well. need 
egress set
+               // it would be nice to do it in the constructor, oh well. need 
egress set
                $this->finalOptionCheck();
 
-               # we only want this so we know how to close a stream :-P
+               // we only want this so we know how to close a stream :-P
                $this->xmlwriterobj = new XmlDumpWriter();
 
                $input = fopen( $this->input, "rt" );
@@ -234,23 +234,20 @@
        }
 
        function finalOptionCheck() {
-               if (($this->checkpointFiles && ! $this->maxTimeAllowed) ||
-                       ($this->maxTimeAllowed && !$this->checkpointFiles)) {
+               if ( ( $this->checkpointFiles && ! $this->maxTimeAllowed ) ||
+                       ( $this->maxTimeAllowed && !$this->checkpointFiles ) ) {
                        throw new MWException("Options checkpointfile and 
maxtime must be specified together.\n");
                }
                foreach ($this->checkpointFiles as $checkpointFile) {
-                       $count = substr_count ($checkpointFile,"%s");
-                       if (substr_count ($checkpointFile,"%s") != 2) {
+                       $count = substr_count ( $checkpointFile,"%s" );
+                       if ( $count != 2 ) {
                                throw new MWException("Option checkpointfile 
must contain two '%s' for substitution of first and last pageids, count is 
$count instead, file is $checkpointFile.\n");
                        }
                }
 
-               if ($this->checkpointFiles) {
-                       $filenameList = $this->egress->getFilename();
-                       if (! is_array($filenameList)) {
-                               $filenameList = array( $filenameList );
-                       }
-                       if (count($filenameList) != 
count($this->checkpointFiles)) {
+               if ( $this->checkpointFiles ) {
+                       $filenameList = (array)$this->egress->getFilenames();
+                       if ( count( $filenameList ) != count( 
$this->checkpointFiles ) ) {
                                throw new MWException("One checkpointfile must 
be specified for each output option, if maxtime is used.\n");
                        }
                }
@@ -285,19 +282,27 @@
                        $offset += strlen( $chunk );
                } while ( $chunk !== false && !feof( $input ) );
                if ($this->maxTimeAllowed) {
-                       $filenameList = $this->egress->getFilename();
-                       # we wrote some stuff after last checkpoint that needs 
renamed */
-                       if (! is_array($filenameList)) {
-                               $filenameList = array( $filenameList );
-                       }
+                       $filenameList = (array)$this->egress->getFilenames();
+                       // 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);
-                               for ($i =0; $i < count($filenameList); $i++) {
-                                       $checkpointNameFilledIn = 
sprintf($this->checkpointFiles[$i], $firstPageID, $lastPageID);
+                               # 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]);
-                                       $newFilenames[] = $fileinfo{'dirname'} 
. '/' . $checkpointNameFilledIn;
+                                       $newFilenames[] = $fileinfo['dirname'] 
. '/' . $checkpointNameFilledIn;
                                }
                                $this->egress->closeAndRename( $newFilenames );
                        }
@@ -577,8 +582,8 @@
                        $this->lastPageWritten = trim($this->thisPage);
                        if ($this->timeExceeded) {
                                $this->egress->writeClosePage( $this->buffer );
-                               # nasty hack, we can't just write the chardata 
after the
-                               # page tag, it will include leading blanks from 
the next line
+                               // nasty hack, we can't just write the chardata 
after the
+                               // page tag, it will include leading blanks 
from the next line
                                $this->egress->sink->write("\n"); 
                                
                                $this->buffer = 
$this->xmlwriterobj->closeStream();
@@ -586,20 +591,16 @@
 
                                $this->buffer = "";
                                $this->thisPage = "";
-                               /* this could be more than one file if we had 
more than one output arg */
+                               // this could be more than one file if we had 
more than one output arg
                                $checkpointFilenames = array();
-                               $filenameList = $this->egress->getFilename();
-
-                               if (! is_array($filenameList)) {
-                                       $filenameList = array( $filenameList );
-                               }
+                               $filenameList = 
(array)$this->egress->getFilenames();
                                $newFilenames = array();
                                $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);
+                               for ( $i = 0; $i < count( $filenameList ); $i++ 
) {
+                                       $checkpointNameFilledIn = sprintf( 
$this->checkpointFiles[$i], $firstPageID, $lastPageID );
                                        $fileinfo = pathinfo($filenameList[$i]);
-                                       $newFilenames[] = $fileinfo{'dirname'} 
. '/' . $checkpointNameFilledIn;
+                                       $newFilenames[] = $fileinfo['dirname'] 
. '/' . $checkpointNameFilledIn;
                                }
                                $this->egress->closeRenameAndReopen( 
$newFilenames );
                                $this->buffer = 
$this->xmlwriterobj->openStream();
@@ -629,8 +630,8 @@
                                $this->thisPage .= $data;
                        }
                }
-               # have to skip the newline left over from closepagetag line of
-               # end of checkpoint files. nasty hack!!
+               // have to skip the newline left over from closepagetag line of
+               // end of checkpoint files. nasty hack!!
                if ($this->checkpointJustWritten) {
                        if ($data[0] == "\n") {
                                $data = substr($data,1);


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to