summaryrefslogtreecommitdiff
path: root/includes/HTMLCacheUpdate.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/HTMLCacheUpdate.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/HTMLCacheUpdate.php')
-rw-r--r--includes/HTMLCacheUpdate.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/includes/HTMLCacheUpdate.php b/includes/HTMLCacheUpdate.php
index 1f250214..402102ea 100644
--- a/includes/HTMLCacheUpdate.php
+++ b/includes/HTMLCacheUpdate.php
@@ -37,7 +37,7 @@ class HTMLCacheUpdate
$this->mRowsPerQuery = $wgUpdateRowsPerQuery;
}
- function doUpdate() {
+ public function doUpdate() {
# Fetch the IDs
$cond = $this->getToCondition();
$dbr = wfGetDB( DB_SLAVE );
@@ -50,16 +50,17 @@ class HTMLCacheUpdate
$this->invalidateIDs( $res );
}
}
+ wfRunHooks( 'HTMLCacheUpdate::doUpdate', array($this->mTitle) );
}
- function insertJobs( ResultWrapper $res ) {
+ protected function insertJobs( ResultWrapper $res ) {
$numRows = $res->numRows();
$numBatches = ceil( $numRows / $this->mRowsPerJob );
$realBatchSize = $numRows / $numBatches;
$start = false;
$jobs = array();
do {
- for ( $i = 0; $i < $realBatchSize - 1; $i++ ) {
+ for ( $i = 0; $i <= $realBatchSize - 1; $i++ ) {
$row = $res->fetchRow();
if ( $row ) {
$id = $row[0];
@@ -82,17 +83,13 @@ class HTMLCacheUpdate
Job::batchInsert( $jobs );
}
- function getPrefix() {
+ protected function getPrefix() {
static $prefixes = array(
'pagelinks' => 'pl',
'imagelinks' => 'il',
'categorylinks' => 'cl',
'templatelinks' => 'tl',
'redirect' => 'rd',
-
- # Not needed
- # 'externallinks' => 'el',
- # 'langlinks' => 'll'
);
if ( is_null( $this->mPrefix ) ) {
@@ -104,11 +101,11 @@ class HTMLCacheUpdate
return $this->mPrefix;
}
- function getFromField() {
+ public function getFromField() {
return $this->getPrefix() . '_from';
}
- function getToCondition() {
+ public function getToCondition() {
$prefix = $this->getPrefix();
switch ( $this->mTable ) {
case 'pagelinks':
@@ -129,7 +126,7 @@ class HTMLCacheUpdate
/**
* Invalidate a set of IDs, right now
*/
- function invalidateIDs( ResultWrapper $res ) {
+ public function invalidateIDs( ResultWrapper $res ) {
global $wgUseFileCache, $wgUseSquid;
if ( $res->numRows() == 0 ) {
@@ -175,8 +172,7 @@ class HTMLCacheUpdate
# Update file cache
if ( $wgUseFileCache ) {
foreach ( $titles as $title ) {
- $cm = new HTMLFileCache($title);
- @unlink($cm->fileCacheName());
+ HTMLFileCache::clearFileCache( $title );
}
}
}
@@ -185,7 +181,9 @@ class HTMLCacheUpdate
}
/**
- * @todo document (e.g. one-sentence top-level class description).
+ * Job wrapper for HTMLCacheUpdate. Gets run whenever a related
+ * job gets called from the queue.
+ *
* @ingroup JobQueue
*/
class HTMLCacheUpdateJob extends Job {
@@ -204,7 +202,7 @@ class HTMLCacheUpdateJob extends Job {
$this->end = $params['end'];
}
- function run() {
+ public function run() {
$update = new HTMLCacheUpdate( $this->title, $this->table );
$fromField = $update->getFromField();