diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
commit | d81f562b712f2387fa02290bf2ca86392ab356f2 (patch) | |
tree | d666cdefbe6ac320827a2c6cb473581b46e22c4c /maintenance/dumpTextPass.php | |
parent | 183851b06bd6c52f3cae5375f433da720d410447 (diff) |
Aktualisierung auf Version 1.8.1
Diffstat (limited to 'maintenance/dumpTextPass.php')
-rw-r--r-- | maintenance/dumpTextPass.php | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 78367c0b..8c1563ad 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -99,9 +99,13 @@ stream_wrapper_register( 'mediawiki.compress.7z', 'SevenZipStream' ); class TextPassDumper extends BackupDumper { var $prefetch = null; var $input = "php://stdin"; - var $history = MW_EXPORT_FULL; + var $history = WikiExporter::FULL; var $fetchCount = 0; var $prefetchCount = 0; + + var $failures = 0; + var $maxFailures = 200; + var $failureTimeout = 5; // Seconds to sleep after db failure function dump() { # This shouldn't happen if on console... ;) @@ -139,10 +143,10 @@ class TextPassDumper extends BackupDumper { $this->input = $url; break; case 'current': - $this->history = MW_EXPORT_CURRENT; + $this->history = WikiExporter::CURRENT; break; case 'full': - $this->history = MW_EXPORT_FULL; + $this->history = WikiExporter::FULL; break; } } @@ -186,9 +190,8 @@ class TextPassDumper extends BackupDumper { $etats = '-'; $fetchrate = '-'; } - global $wgDBname; $this->progress( sprintf( "%s: %s %d pages (%0.3f/sec), %d revs (%0.3f/sec), %0.1f%% prefetched, ETA %s [max %d]", - $now, $wgDBname, $this->pageCount, $rate, $this->revCount, $revrate, $fetchrate, $etats, $this->maxCount ) ); + $now, wfWikiID(), $this->pageCount, $rate, $this->revCount, $revrate, $fetchrate, $etats, $this->maxCount ) ); } } @@ -236,6 +239,27 @@ class TextPassDumper extends BackupDumper { return $text; } } + while( true ) { + try { + return $this->doGetText( $id ); + } catch (DBQueryError $ex) { + $this->failures++; + if( $this->failures > $this->maxFailures ) { + throw $ex; + } else { + $this->progress( "Database failure $this->failures " . + "of allowed $this->maxFailures! " . + "Pausing $this->failureTimeout seconds..." ); + sleep( $this->failureTimeout ); + } + } + } + } + + /** + * May throw a database error if, say, the server dies during query. + */ + private function doGetText( $id ) { $id = intval( $id ); $row = $this->db->selectRow( 'text', array( 'old_text', 'old_flags' ), |