Index: branches/stable/phase3/includes/Article.php |
— | — | @@ -679,7 +679,7 @@ |
680 | 680 | wfStrencode( $summary ) . "',0,0," . |
681 | 681 | ( $wgUser->isBot() ? 1 : 0 ) . ")"; |
682 | 682 | wfQuery( $sql, $fname ); |
683 | | - if ($watchthis) { |
| 683 | + if ($watchthis) { |
684 | 684 | if(!$wgTitle->userIsWatching()) $this->watch(); |
685 | 685 | } else { |
686 | 686 | if ( $wgTitle->userIsWatching() ) { |
— | — | @@ -1335,10 +1335,8 @@ |
1336 | 1336 | $now = wfTimestampNow(); |
1337 | 1337 | $sql2 = "UPDATE cur SET cur_touched='{$now}' WHERE cur_id IN ("; |
1338 | 1338 | $first = true; |
1339 | | - |
1340 | | - global $wgLinkCache; |
| 1339 | + |
1341 | 1340 | while ( $s = wfFetchObject( $res ) ) { |
1342 | | - $wgLinkCache->clearPreFill( $s->l_from ); |
1343 | 1341 | $nt = Title::newFromDBkey( $s->l_from ); |
1344 | 1342 | $lid = $nt->getArticleID(); |
1345 | 1343 | |
— | — | @@ -1365,9 +1363,6 @@ |
1366 | 1364 | |
1367 | 1365 | $sql = "DELETE FROM brokenlinks WHERE bl_from={$id}"; |
1368 | 1366 | wfQuery( $sql, $fname ); |
1369 | | - |
1370 | | - global $wgLinkCache; |
1371 | | - $wgLinkCache->clearPreFill( $t ); |
1372 | 1367 | } |
1373 | 1368 | |
1374 | 1369 | $log = new LogPage( wfMsg( "dellogpage" ), wfMsg( "dellogpagetext" ) ); |
Index: branches/stable/phase3/includes/LinkCache.php |
— | — | @@ -12,16 +12,6 @@ |
13 | 13 | /* private */ var $mImageLinks; |
14 | 14 | /* private */ var $mPreFilled, $mOldGoodLinks, $mOldBadLinks; |
15 | 15 | |
16 | | - /* private */ function getKey( $title ) { |
17 | | - global $wgDBname; |
18 | | - return "$wgDBname:lc:title:$title"; |
19 | | - } |
20 | | - |
21 | | - /* private */ function getPrefillKey( $title ) { |
22 | | - global $wgDBname; |
23 | | - return "$wgDBname:lc:prefill:$title"; |
24 | | - } |
25 | | - |
26 | 16 | function LinkCache() |
27 | 17 | { |
28 | 18 | $this->mActive = true; |
— | — | @@ -77,8 +67,6 @@ |
78 | 68 | if ( isset( $index ) ) { |
79 | 69 | unset( $this->mBadLinks[$index] ); |
80 | 70 | } |
81 | | - global $wgMemc; |
82 | | - $wgMemc->delete( $this->getKey( $title ) ); |
83 | 71 | } |
84 | 72 | |
85 | 73 | function suspend() { $this->mActive = false; } |
— | — | @@ -104,54 +92,37 @@ |
105 | 93 | $id = $this->getGoodLinkID( $title ); |
106 | 94 | if ( 0 != $id ) { return $id; } |
107 | 95 | |
108 | | - global $wgMemc; |
109 | | - $fname = "LinkCache::addLinkObj"; |
110 | | - wfProfileIn( $fname ); |
| 96 | + wfProfileIn( "LinkCache::addLink-checkdatabase" ); |
111 | 97 | |
112 | 98 | $ns = $nt->getNamespace(); |
113 | 99 | $t = $nt->getDBkey(); |
114 | 100 | |
115 | | - if ( "" == $title ) { |
116 | | - wfProfileOut( $fname ); |
117 | | - return 0; |
| 101 | + if ( "" == $t ) { return 0; } |
| 102 | + $sql = "SELECT cur_id FROM cur WHERE cur_namespace=" . |
| 103 | + "{$ns} AND cur_title='" . wfStrencode( $t ) . "'"; |
| 104 | + $res = wfQuery( $sql, "LinkCache::addLink" ); |
| 105 | + |
| 106 | + if ( 0 == wfNumRows( $res ) ) { |
| 107 | + $id = 0; |
| 108 | + } else { |
| 109 | + $s = wfFetchObject( $res ); |
| 110 | + $id = $s->cur_id; |
118 | 111 | } |
119 | | - |
120 | | - $id = $wgMemc->get( $key = $this->getKey( $title ) ); |
121 | | - if( $id === FALSE ) { |
122 | | - $sql = "SELECT cur_id FROM cur WHERE cur_namespace=" . |
123 | | - "{$ns} AND cur_title='" . wfStrencode( $t ) . "'"; |
124 | | - $res = wfQuery( $sql, $fname ); |
125 | | - |
126 | | - if ( 0 == wfNumRows( $res ) ) { |
127 | | - $id = 0; |
128 | | - } else { |
129 | | - $s = wfFetchObject( $res ); |
130 | | - $id = $s->cur_id; |
131 | | - } |
132 | | - $wgMemc->add( $key, $id, time() + 3600 ); |
133 | | - } |
134 | 112 | if ( 0 == $id ) { $this->addBadLink( $title ); } |
135 | 113 | else { $this->addGoodLink( $id, $title ); } |
136 | 114 | wfProfileOut(); |
137 | 115 | return $id; |
138 | 116 | } |
139 | 117 | |
140 | | - function preFill( &$fromtitle ) |
| 118 | + function preFill( $fromtitle ) |
141 | 119 | { |
142 | | - $fname = "LinkCache::preFill"; |
143 | | - wfProfileIn( $fname ); |
| 120 | + wfProfileIn( "LinkCache::preFill" ); |
144 | 121 | # Note -- $fromtitle is a Title *object* |
145 | 122 | $dbkeyfrom = wfStrencode( $fromtitle->getPrefixedDBKey() ); |
146 | | - |
147 | | - if( $this->preFillFromCache( $dbkeyfrom ) ) { |
148 | | - wfProfileOut(); |
149 | | - return; |
150 | | - } |
151 | | - |
152 | 123 | $sql = "SELECT cur_id,cur_namespace,cur_title |
153 | 124 | FROM cur,links |
154 | 125 | WHERE cur_id=l_to AND l_from='{$dbkeyfrom}'"; |
155 | | - $res = wfQuery( $sql, $fname ); |
| 126 | + $res = wfQuery( $sql, "LinkCache::preFill" ); |
156 | 127 | while( $s = wfFetchObject( $res ) ) { |
157 | 128 | $this->addGoodLink( $s->cur_id, |
158 | 129 | Title::makeName( $s->cur_namespace, $s->cur_title ) |
— | — | @@ -164,8 +135,8 @@ |
165 | 136 | |
166 | 137 | $sql = "SELECT bl_to |
167 | 138 | FROM brokenlinks |
168 | | - WHERE bl_from={$id}"; |
169 | | - $res = wfQuery( $sql, $fname ); |
| 139 | + WHERE bl_from='{$id}'"; |
| 140 | + $res = wfQuery( $sql, "LinkCache::preFill" ); |
170 | 141 | while( $s = wfFetchObject( $res ) ) { |
171 | 142 | $this->addBadLink( $s->bl_to ); |
172 | 143 | } |
— | — | @@ -174,30 +145,8 @@ |
175 | 146 | $this->mOldGoodLinks = $this->mGoodLinks; |
176 | 147 | $this->mPreFilled = true; |
177 | 148 | |
178 | | - $this->preFillToCache( $dbkeyfrom ); |
179 | | - |
180 | 149 | wfProfileOut(); |
181 | 150 | } |
182 | | - |
183 | | - function preFillFromCache( $dbkey ) { |
184 | | - global $wgMemc; |
185 | | - $prefill = $wgMemc->get( $this->getPrefillKey( $dbkey ) ); |
186 | | - if( $prefill === FALSE ) return false; |
187 | | - list( $this->mGoodLinks, $this->mBadLinks, $this->mImageLinks ) = $prefill; |
188 | | - list( $this->mOldGoodLinks, $this->mOldBadLinks ) = $prefill; |
189 | | - return $this->mPreFilled = true; |
190 | | - } |
191 | | - |
192 | | - function preFillToCache( $dbkey ) { |
193 | | - global $wgMemc; |
194 | | - $prefill = array( $this->mGoodLinks, $this->mBadLinks, $this->mImageLinks ); |
195 | | - $wgMemc->set( $this->getPrefillKey( $dbkey ), $prefill, time() + 3600 ); |
196 | | - } |
197 | | - |
198 | | - function clearPreFill( $dbkey ) { |
199 | | - global $wgMemc; |
200 | | - $wgMemc->delete( $this->getPrefillKey( $dbkey ) ); |
201 | | - } |
202 | 151 | |
203 | 152 | function getGoodAdditions() |
204 | 153 | { |
Index: branches/stable/phase3/includes/LinksUpdate.php |
— | — | @@ -141,8 +141,6 @@ |
142 | 142 | $sql = "COMMIT"; |
143 | 143 | wfQuery( $sql, $fname ); |
144 | 144 | } |
145 | | - |
146 | | - $wgLinkCache->clearPreFill( $this->mTitleEnc ); |
147 | 145 | wfProfileOut(); |
148 | 146 | } |
149 | 147 | |
— | — | @@ -218,8 +216,6 @@ |
219 | 217 | $sql = "COMMIT"; |
220 | 218 | wfQuery( $sql, $fname ); |
221 | 219 | } |
222 | | - |
223 | | - $wgLinkCache->clearPreFill( $this->mTitleEnc ); |
224 | 220 | wfProfileOut(); |
225 | 221 | } |
226 | 222 | |
— | — | @@ -227,11 +223,10 @@ |
228 | 224 | /* Update any brokenlinks *to* this page */ |
229 | 225 | /* Call for a newly created page, or just to make sure state is consistent */ |
230 | 226 | |
231 | | - $sql = "SELECT bl_from,cur_namespace,cur_title FROM brokenlinks,cur WHERE bl_to='{$this->mTitleEnc}' and bl_from=cur_id"; |
| 227 | + $sql = "SELECT bl_from FROM brokenlinks WHERE bl_to='{$this->mTitleEnc}'"; |
232 | 228 | $res = wfQuery( $sql, $fname ); |
233 | 229 | if ( 0 == wfNumRows( $res ) ) { return; } |
234 | 230 | |
235 | | - global $wgLinkCache; |
236 | 231 | $sql = "INSERT INTO links (l_from,l_to) VALUES "; |
237 | 232 | $now = wfTimestampNow(); |
238 | 233 | $sql2 = "UPDATE cur SET cur_touched='{$now}' WHERE cur_id IN ("; |
— | — | @@ -243,8 +238,6 @@ |
244 | 239 | |
245 | 240 | $sql .= "('{$nl}',{$this->mId})"; |
246 | 241 | $sql2 .= $row->bl_from; |
247 | | - $t = Title::makeTitle( $row->cur_namespace, $row->cur_title ); |
248 | | - $wgLinkCache->clearPreFill( $t->getPrefixedDBKey() ); |
249 | 242 | } |
250 | 243 | $sql2 .= ")"; |
251 | 244 | wfQuery( $sql, $fname ); |