Index: branches/REL1_4/phase3/maintenance/compressOld.inc |
— | — | @@ -65,7 +65,8 @@ |
66 | 66 | $pageRes = $dbw->select( 'cur', array('cur_namespace', 'cur_title'), false, $fname ); |
67 | 67 | |
68 | 68 | # For each of those, get a list of revisions which fit the criteria |
69 | | - $conds = array(); |
| 69 | + # No recompression, use a condition on old_flags |
| 70 | + $conds = array("old_flags NOT LIKE '%object%'"); |
70 | 71 | if ( $beginDate ) { |
71 | 72 | $conds[] = "old_timestamp>'" . $beginDate . "'"; |
72 | 73 | } |
— | — | @@ -146,19 +147,12 @@ |
147 | 148 | $chunk->setText( $text ); |
148 | 149 | print '.'; |
149 | 150 | } else { |
150 | | - # Don't make a stub if it's going to be longer than the article |
151 | | - # Stubs are typically about 100 bytes |
152 | | - if ( strlen( $text ) < 120 ) { |
153 | | - $stub = false; |
154 | | - print 'x'; |
155 | | - } else { |
156 | | - $stub = $chunk->addItem( $text ); |
157 | | - $stub->setLocation( $primaryOldid ); |
158 | | - $hash = $stub->getHash(); |
159 | | - $stub = serialize( $stub ); |
160 | | - print '.'; |
161 | | - $usedChunk = true; |
162 | | - } |
| 151 | + $stub = $chunk->addItem( $text ); |
| 152 | + $stub->setLocation( $primaryOldid ); |
| 153 | + $hash = $stub->getHash(); |
| 154 | + $stub = serialize( $stub ); |
| 155 | + print '.'; |
| 156 | + $usedChunk = true; |
163 | 157 | $stubs[$j] = $stub; |
164 | 158 | } |
165 | 159 | } |
Index: branches/REL1_4/phase3/maintenance/dumpRev.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <? |
3 | 3 | require_once( 'commandLine.inc' ); |
4 | 4 | $dbr =& wfGetDB( DB_SLAVE ); |
5 | | -$row = $dbr->selectRow( 'old', array( 'old_flags', 'old_text' ), array( 'old_id' => 52 ) ); |
| 5 | +$row = $dbr->selectRow( 'old', array( 'old_flags', 'old_text' ), array( 'old_id' => $args[0] ) ); |
6 | 6 | $obj = unserialize( $row->old_text ); |
7 | 7 | print_r( array_keys( $obj->mItems ) ); |
8 | 8 | |
Index: branches/REL1_4/phase3/maintenance/compressOld.php |
— | — | @@ -42,21 +42,19 @@ |
43 | 43 | print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n"; |
44 | 44 | die(); |
45 | 45 | } |
46 | | - |
47 | 46 | $defaults = array( |
48 | 47 | 't' => 'concat', |
49 | 48 | 'c' => 20, |
50 | 49 | 's' => 0, |
51 | 50 | 'f' => 3, |
52 | | - 'h' => 100, |
| 51 | + 'h' => 1024, |
53 | 52 | 'b' => '', |
54 | 53 | 'e' => '', |
55 | 54 | ); |
56 | 55 | |
57 | | -$args = $args + $defaults; |
58 | | - |
59 | | -if ( $args['t'] != 'concat' && $args['t'] != 'gzip' ) { |
60 | | - print "Type \"{$args['t']}\" not supported\n"; |
| 56 | +$options = $options + $defaults; |
| 57 | +if ( $options['t'] != 'concat' && $options['t'] != 'gzip' ) { |
| 58 | + print "Type \"{$options['t']}\" not supported\n"; |
61 | 59 | } |
62 | 60 | |
63 | 61 | print "Depending on the size of your database this may take a while!\n"; |
— | — | @@ -66,10 +64,10 @@ |
67 | 65 | #sleep(5); |
68 | 66 | |
69 | 67 | $success = true; |
70 | | -if ( $args['t'] == 'concat' ) { |
71 | | - $success = compressWithConcat( $args['s'], $args['c'], $args['f'], $args['h'], $args['b'], $args['e'] ); |
| 68 | +if ( $options['t'] == 'concat' ) { |
| 69 | + $success = compressWithConcat( $options['s'], $options['c'], $options['f'], $options['h'], $options['b'], $options['e'] ); |
72 | 70 | } else { |
73 | | - compressOldPages( $args['s'] ); |
| 71 | + compressOldPages( $options['s'] ); |
74 | 72 | } |
75 | 73 | |
76 | 74 | if ( $success ) { |
Index: branches/REL1_4/phase3/includes/HistoryBlob.php |
— | — | @@ -122,6 +122,7 @@ |
123 | 123 | if ( count( $this->mItems ) == 0 ) { |
124 | 124 | return true; |
125 | 125 | } |
| 126 | + /* |
126 | 127 | if ( !$this->mFast ) { |
127 | 128 | $this->uncompress(); |
128 | 129 | $record = serialize( $this->mItems ); |
— | — | @@ -136,6 +137,13 @@ |
137 | 138 | } |
138 | 139 | } else { |
139 | 140 | return count( $this->mItems ) <= 10; |
| 141 | + }*/ |
| 142 | + |
| 143 | + # Jamesday's idea: prevent excessive apache memory usage on decompression |
| 144 | + if ( strlen( serialize( $this->mItems ) ) > $factorThreshold * 1024 ) { |
| 145 | + return false; |
| 146 | + } else { |
| 147 | + return true; |
140 | 148 | } |
141 | 149 | } |
142 | 150 | } |