4 * @subpackage Maintenance
8 function compressOldPages( $start = 0 ) {
9 $fname = 'compressOldPages';
12 print "Starting from old_id $start...\n";
13 $dbw =& wfGetDB( DB_MASTER );
14 $old = $dbw->tableName( 'old' );
16 $end = $start + $chunksize;
17 $res = $dbw->select( 'old', array( 'old_id','old_flags','old_namespace','old_title','old_text' ),
18 "old_id>=$start", $fname, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) );
19 if( $dbw->numRows( $res ) == 0 ) {
23 while( $row = $dbw->fetchObject( $res ) ) {
24 # print " {$row->old_id} - {$row->old_namespace}:{$row->old_title}\n";
28 $dbw->freeResult( $res );
29 $start = $last + 1; # Deletion may leave long empty stretches
34 function compressPage( $row ) {
35 $fname = 'compressPage';
36 if( false !== strpos( $row->old_flags, "gzip" ) ) {
37 print "Already compressed row {$row->old_id}?\n";
40 $dbw =& wfGetDB( DB_MASTER );
41 $flags = $row->old_flags ? "{$row->old_flags},gzip" : "gzip";
42 $compress = gzdeflate( $row->old_text );
45 'old_flags' => $flags,
46 'old_text' => $compress
48 'old_id' => $row->old_id