function __construct( Title $title, array $params ) {
parent::__construct( 'refreshLinks', $title, $params );
- // A separate type is used just for cascade-protected backlinks
- if ( !empty( $this->params['prioritize'] ) ) {
- $this->command .= 'Prioritized';
- }
// Base backlink update jobs and per-title update jobs can be de-duplicated.
// If template A changes twice before any jobs run, a clean queue will have:
// (A base, A base)
&& ( !isset( $params['pages'] ) || count( $params['pages'] ) == 1 );
}
+ /**
+ * @param Title $title
+ * @param array $params
+ * @return RefreshLinksJob
+ */
+ public static function newPrioritized( Title $title, array $params ) {
+ $job = new self( $title, $params );
+ $job->command = 'refreshLinksPrioritized';
+
+ return $job;
+ }
+
+ /**
+ * @param Title $title
+ * @param array $params
+ * @return RefreshLinksJob
+ */
+ public static function newDynamic( Title $title, array $params ) {
+ $job = new self( $title, $params );
+ $job->command = 'refreshLinksDynamic';
+
+ return $job;
+ }
+
function run() {
global $wgUpdateRowsPerJob;
$updates = $content->getSecondaryDataUpdates(
$title, null, !empty( $this->params['useRecursiveLinksUpdate'] ), $parserOutput );
foreach ( $updates as $key => $update ) {
- if ( $update instanceof LinksUpdate && isset( $this->params['triggeredRecursive'] ) ) {
- $update->setTriggeredRecursive();
+ if ( $update instanceof LinksUpdate ) {
+ if ( isset( $this->params['triggeredRecursive'] ) ) {
+ $update->setTriggeredRecursive();
+ }
+ if ( isset( $this->params['triggeringUser'] ) && $this->params['triggeringUser'] ) {
+ $userInfo = $this->params['triggeringUser'];
+ if ( $userInfo['userId'] ) {
+ $user = User::newFromId( $userInfo['userId'] );
+ } else {
+ // Anonymous, use the username
+ $user = User::newFromName( $userInfo['userName'], false );
+ }
+ $update->setTriggeringUser( $user );
+ }
}
}