dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Fix CLI installer when --dbname is not specified on command line."
[lhc/web/wiklou.git]
/
maintenance
/
storage
/
compressOld.php
diff --git
a/maintenance/storage/compressOld.php
b/maintenance/storage/compressOld.php
index
0f337ec
..
b27b111
100644
(file)
--- a/
maintenance/storage/compressOld.php
+++ b/
maintenance/storage/compressOld.php
@@
-50,9
+50,15
@@
require_once __DIR__ . '/../Maintenance.php';
*/
class CompressOld extends Maintenance {
/**
*/
class CompressOld extends Maintenance {
/**
- * @todo document
+ * Option to load each revision individually.
+ *
*/
const LS_INDIVIDUAL = 0;
*/
const LS_INDIVIDUAL = 0;
+
+ /**
+ * Option to load revisions in chunks.
+ *
+ */
const LS_CHUNKED = 1;
public function __construct() {
const LS_CHUNKED = 1;
public function __construct() {
@@
-136,11
+142,16
@@
class CompressOld extends Maintenance {
}
}
}
}
- /** @todo document */
+ /**
+ * Fetch the text row-by-row to 'compressPage' function for compression.
+ *
+ * @param int $start
+ * @param string $extdb
+ */
private function compressOldPages( $start = 0, $extdb = '' ) {
$chunksize = 50;
$this->output( "Starting from old_id $start...\n" );
private function compressOldPages( $start = 0, $extdb = '' ) {
$chunksize = 50;
$this->output( "Starting from old_id $start...\n" );
- $dbw =
wfG
etDB( DB_MASTER );
+ $dbw =
$this->g
etDB( DB_MASTER );
do {
$res = $dbw->select(
'text',
do {
$res = $dbw->select(
'text',
@@
-168,7
+179,8
@@
class CompressOld extends Maintenance {
}
/**
}
/**
- * @todo document
+ * Compress the text in gzip format.
+ *
* @param stdClass $row
* @param string $extdb
* @return bool
* @param stdClass $row
* @param string $extdb
* @return bool
@@
-177,10
+189,10
@@
class CompressOld extends Maintenance {
if ( false !== strpos( $row->old_flags, 'gzip' )
|| false !== strpos( $row->old_flags, 'object' )
) {
if ( false !== strpos( $row->old_flags, 'gzip' )
|| false !== strpos( $row->old_flags, 'object' )
) {
- #print "Already compressed row {$row->old_id}\n";
+ #
print "Already compressed row {$row->old_id}\n";
return false;
}
return false;
}
- $dbw =
wfG
etDB( DB_MASTER );
+ $dbw =
$this->g
etDB( DB_MASTER );
$flags = $row->old_flags ? "{$row->old_flags},gzip" : "gzip";
$compress = gzdeflate( $row->old_text );
$flags = $row->old_flags ? "{$row->old_flags},gzip" : "gzip";
$compress = gzdeflate( $row->old_text );
@@
-210,6
+222,8
@@
class CompressOld extends Maintenance {
}
/**
}
/**
+ * Compress the text in chunks after concatenating the revisions.
+ *
* @param int $startId
* @param int $maxChunkSize
* @param string $beginDate
* @param int $startId
* @param int $maxChunkSize
* @param string $beginDate
@@
-223,8
+237,8
@@
class CompressOld extends Maintenance {
) {
$loadStyle = self::LS_CHUNKED;
) {
$loadStyle = self::LS_CHUNKED;
- $dbr =
wfG
etDB( DB_SLAVE );
- $dbw =
wfG
etDB( DB_MASTER );
+ $dbr =
$this->g
etDB( DB_SLAVE );
+ $dbw =
$this->g
etDB( DB_MASTER );
# Set up external storage
if ( $extdb != '' ) {
# Set up external storage
if ( $extdb != '' ) {
@@
-289,8
+303,8
@@
class CompressOld extends Maintenance {
# Don't work with current revisions
# Don't lock the page table for update either -- TS 2006-04-04
# Don't work with current revisions
# Don't lock the page table for update either -- TS 2006-04-04
- #$tables[] = 'page';
- #$conds[] = 'page_id=rev_page AND rev_id != page_latest';
+ #
$tables[] = 'page';
+ #
$conds[] = 'page_id=rev_page AND rev_id != page_latest';
for ( $pageId = $startId; $pageId <= $maxPageId; $pageId++ ) {
wfWaitForSlaves();
for ( $pageId = $startId; $pageId <= $maxPageId; $pageId++ ) {
wfWaitForSlaves();
@@
-345,7
+359,7
@@
class CompressOld extends Maintenance {
$chunk = new ConcatenatedGzipHistoryBlob();
$stubs = array();
$chunk = new ConcatenatedGzipHistoryBlob();
$stubs = array();
- $
dbw->begin(
__METHOD__ );
+ $
this->beginTransaction( $dbw,
__METHOD__ );
$usedChunk = false;
$primaryOldid = $revs[$i]->rev_text_id;
$usedChunk = false;
$primaryOldid = $revs[$i]->rev_text_id;
@@
-370,7
+384,7
@@
class CompressOld extends Maintenance {
if ( $text === false ) {
$this->error( "\nError, unable to get text in old_id $oldid" );
if ( $text === false ) {
$this->error( "\nError, unable to get text in old_id $oldid" );
- #$dbw->delete( 'old', array( 'old_id' => $oldid ) );
+ #
$dbw->delete( 'old', array( 'old_id' => $oldid ) );
}
if ( $extdb == "" && $j == 0 ) {
}
if ( $extdb == "" && $j == 0 ) {
@@
-449,7
+463,7
@@
class CompressOld extends Maintenance {
}
# Done, next
$this->output( "/" );
}
# Done, next
$this->output( "/" );
- $
dbw->commit(
__METHOD__ );
+ $
this->commitTransaction( $dbw,
__METHOD__ );
$i += $thisChunkSize;
wfWaitForSlaves();
}
$i += $thisChunkSize;
wfWaitForSlaves();
}