summaryrefslogtreecommitdiff
path: root/includes/RefreshLinksJob.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
committerPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
commit8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch)
treecd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /includes/RefreshLinksJob.php
parentd7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff)
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'includes/RefreshLinksJob.php')
-rw-r--r--includes/RefreshLinksJob.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/includes/RefreshLinksJob.php b/includes/RefreshLinksJob.php
new file mode 100644
index 00000000..367d994f
--- /dev/null
+++ b/includes/RefreshLinksJob.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Background job to update links for a given title.
+ */
+class RefreshLinksJob extends Job {
+
+ function __construct( $title, $params = '', $id = 0 ) {
+ parent::__construct( 'refreshLinks', $title, $params, $id );
+ }
+
+ /**
+ * Run a refreshLinks job
+ * @return boolean success
+ */
+ function run() {
+ global $wgParser;
+ wfProfileIn( __METHOD__ );
+
+ $linkCache =& LinkCache::singleton();
+ $linkCache->clear();
+
+ if ( is_null( $this->title ) ) {
+ $this->error = "refreshLinks: Invalid title";
+ wfProfileOut( __METHOD__ );
+ return false;
+ }
+
+ $revision = Revision::newFromTitle( $this->title );
+ if ( !$revision ) {
+ $this->error = 'refreshLinks: Article not found "' . $this->title->getPrefixedDBkey() . '"';
+ wfProfileOut( __METHOD__ );
+ return false;
+ }
+
+ wfProfileIn( __METHOD__.'-parse' );
+ $options = new ParserOptions;
+ $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() );
+ wfProfileOut( __METHOD__.'-parse' );
+ wfProfileIn( __METHOD__.'-update' );
+ $update = new LinksUpdate( $this->title, $parserOutput, false );
+ $update->doUpdate();
+ wfProfileOut( __METHOD__.'-update' );
+ wfProfileOut( __METHOD__ );
+ return true;
+ }
+}
+