MediaWiki  REL1_31
LinksUpdate.php
Go to the documentation of this file.
1 <?php
25 use Wikimedia\ScopedCallback;
26 
34 class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
35  // @todo make members protected, but make sure extensions don't break
36 
38  public $mId;
39 
41  public $mTitle;
42 
45 
47  public $mLinks;
48 
50  public $mImages;
51 
53  public $mTemplates;
54 
56  public $mExternals;
57 
59  public $mCategories;
60 
62  public $mInterlangs;
63 
65  public $mInterwikis;
66 
68  public $mProperties;
69 
71  public $mRecursive;
72 
74  private $mRevision;
75 
79  private $linkInsertions = null;
80 
84  private $linkDeletions = null;
85 
89  private $propertyInsertions = null;
90 
94  private $propertyDeletions = null;
95 
99  private $user;
100 
102  private $db;
103 
110  function __construct( Title $title, ParserOutput $parserOutput, $recursive = true ) {
111  parent::__construct();
112 
113  $this->mTitle = $title;
114  $this->mId = $title->getArticleID( Title::GAID_FOR_UPDATE );
115 
116  if ( !$this->mId ) {
117  throw new InvalidArgumentException(
118  "The Title object yields no ID. Perhaps the page doesn't exist?"
119  );
120  }
121 
122  $this->mParserOutput = $parserOutput;
123 
124  $this->mLinks = $parserOutput->getLinks();
125  $this->mImages = $parserOutput->getImages();
126  $this->mTemplates = $parserOutput->getTemplates();
127  $this->mExternals = $parserOutput->getExternalLinks();
128  $this->mCategories = $parserOutput->getCategories();
129  $this->mProperties = $parserOutput->getProperties();
130  $this->mInterwikis = $parserOutput->getInterwikiLinks();
131 
132  # Convert the format of the interlanguage links
133  # I didn't want to change it in the ParserOutput, because that array is passed all
134  # the way back to the skin, so either a skin API break would be required, or an
135  # inefficient back-conversion.
136  $ill = $parserOutput->getLanguageLinks();
137  $this->mInterlangs = [];
138  foreach ( $ill as $link ) {
139  list( $key, $title ) = explode( ':', $link, 2 );
140  $this->mInterlangs[$key] = $title;
141  }
142 
143  foreach ( $this->mCategories as &$sortkey ) {
144  # If the sortkey is longer then 255 bytes,
145  # it truncated by DB, and then doesn't get
146  # matched when comparing existing vs current
147  # categories, causing T27254.
148  # Also. substr behaves weird when given "".
149  if ( $sortkey !== '' ) {
150  $sortkey = substr( $sortkey, 0, 255 );
151  }
152  }
153 
154  $this->mRecursive = $recursive;
155 
156  // Avoid PHP 7.1 warning from passing $this by reference
157  $linksUpdate = $this;
158  Hooks::run( 'LinksUpdateConstructed', [ &$linksUpdate ] );
159  }
160 
166  public function doUpdate() {
167  if ( $this->ticket ) {
168  // Make sure all links update threads see the changes of each other.
169  // This handles the case when updates have to batched into several COMMITs.
170  $scopedLock = self::acquirePageLock( $this->getDB(), $this->mId );
171  }
172 
173  // Avoid PHP 7.1 warning from passing $this by reference
174  $linksUpdate = $this;
175  Hooks::run( 'LinksUpdate', [ &$linksUpdate ] );
176  $this->doIncrementalUpdate();
177 
178  // Commit and release the lock (if set)
179  ScopedCallback::consume( $scopedLock );
180  // Run post-commit hooks without DBO_TRX
181  $this->getDB()->onTransactionIdle(
182  function () {
183  // Avoid PHP 7.1 warning from passing $this by reference
184  $linksUpdate = $this;
185  Hooks::run( 'LinksUpdateComplete', [ &$linksUpdate, $this->ticket ] );
186  },
187  __METHOD__
188  );
189  }
190 
201  public static function acquirePageLock( IDatabase $dbw, $pageId, $why = 'atomicity' ) {
202  $key = "LinksUpdate:$why:pageid:$pageId";
203  $scopedLock = $dbw->getScopedLockAndFlush( $key, __METHOD__, 15 );
204  if ( !$scopedLock ) {
205  throw new RuntimeException( "Could not acquire lock '$key'." );
206  }
207 
208  return $scopedLock;
209  }
210 
211  protected function doIncrementalUpdate() {
212  # Page links
213  $existingPL = $this->getExistingLinks();
214  $this->linkDeletions = $this->getLinkDeletions( $existingPL );
215  $this->linkInsertions = $this->getLinkInsertions( $existingPL );
216  $this->incrTableUpdate( 'pagelinks', 'pl', $this->linkDeletions, $this->linkInsertions );
217 
218  # Image links
219  $existingIL = $this->getExistingImages();
220  $imageDeletes = $this->getImageDeletions( $existingIL );
221  $this->incrTableUpdate(
222  'imagelinks',
223  'il',
224  $imageDeletes,
225  $this->getImageInsertions( $existingIL ) );
226 
227  # Invalidate all image description pages which had links added or removed
228  $imageUpdates = $imageDeletes + array_diff_key( $this->mImages, $existingIL );
229  $this->invalidateImageDescriptions( $imageUpdates );
230 
231  # External links
232  $existingEL = $this->getExistingExternals();
233  $this->incrTableUpdate(
234  'externallinks',
235  'el',
236  $this->getExternalDeletions( $existingEL ),
237  $this->getExternalInsertions( $existingEL ) );
238 
239  # Language links
240  $existingLL = $this->getExistingInterlangs();
241  $this->incrTableUpdate(
242  'langlinks',
243  'll',
244  $this->getInterlangDeletions( $existingLL ),
245  $this->getInterlangInsertions( $existingLL ) );
246 
247  # Inline interwiki links
248  $existingIW = $this->getExistingInterwikis();
249  $this->incrTableUpdate(
250  'iwlinks',
251  'iwl',
252  $this->getInterwikiDeletions( $existingIW ),
253  $this->getInterwikiInsertions( $existingIW ) );
254 
255  # Template links
256  $existingTL = $this->getExistingTemplates();
257  $this->incrTableUpdate(
258  'templatelinks',
259  'tl',
260  $this->getTemplateDeletions( $existingTL ),
261  $this->getTemplateInsertions( $existingTL ) );
262 
263  # Category links
264  $existingCL = $this->getExistingCategories();
265  $categoryDeletes = $this->getCategoryDeletions( $existingCL );
266  $this->incrTableUpdate(
267  'categorylinks',
268  'cl',
269  $categoryDeletes,
270  $this->getCategoryInsertions( $existingCL ) );
271  $categoryInserts = array_diff_assoc( $this->mCategories, $existingCL );
272  $categoryUpdates = $categoryInserts + $categoryDeletes;
273 
274  # Page properties
275  $existingPP = $this->getExistingProperties();
276  $this->propertyDeletions = $this->getPropertyDeletions( $existingPP );
277  $this->incrTableUpdate(
278  'page_props',
279  'pp',
280  $this->propertyDeletions,
281  $this->getPropertyInsertions( $existingPP ) );
282 
283  # Invalidate the necessary pages
284  $this->propertyInsertions = array_diff_assoc( $this->mProperties, $existingPP );
285  $changed = $this->propertyDeletions + $this->propertyInsertions;
286  $this->invalidateProperties( $changed );
287 
288  # Invalidate all categories which were added, deleted or changed (set symmetric difference)
289  $this->invalidateCategories( $categoryUpdates );
290  $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
291 
292  # Refresh links of all pages including this page
293  # This will be in a separate transaction
294  if ( $this->mRecursive ) {
295  $this->queueRecursiveJobs();
296  }
297 
298  # Update the links table freshness for this title
299  $this->updateLinksTimestamp();
300  }
301 
308  protected function queueRecursiveJobs() {
309  $action = $this->getCauseAction();
310  $agent = $this->getCauseAgent();
311 
312  self::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks', $action, $agent );
313  if ( $this->mTitle->getNamespace() == NS_FILE ) {
314  // Process imagelinks in case the title is or was a redirect
315  self::queueRecursiveJobsForTable( $this->mTitle, 'imagelinks', $action, $agent );
316  }
317 
318  $bc = $this->mTitle->getBacklinkCache();
319  // Get jobs for cascade-protected backlinks for a high priority queue.
320  // If meta-templates change to using a new template, the new template
321  // should be implicitly protected as soon as possible, if applicable.
322  // These jobs duplicate a subset of the above ones, but can run sooner.
323  // Which ever runs first generally no-ops the other one.
324  $jobs = [];
325  foreach ( $bc->getCascadeProtectedLinks() as $title ) {
327  $title,
328  [
329  'causeAction' => $action,
330  'causeAgent' => $agent
331  ]
332  );
333  }
334  JobQueueGroup::singleton()->push( $jobs );
335  }
336 
345  public static function queueRecursiveJobsForTable(
346  Title $title, $table, $action = 'unknown', $userName = 'unknown'
347  ) {
348  if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
349  $job = new RefreshLinksJob(
350  $title,
351  [
352  'table' => $table,
353  'recursive' => true,
354  ] + Job::newRootJobParams( // "overall" refresh links job info
355  "refreshlinks:{$table}:{$title->getPrefixedText()}"
356  ) + [ 'causeAction' => $action, 'causeAgent' => $userName ]
357  );
358 
359  JobQueueGroup::singleton()->push( $job );
360  }
361  }
362 
366  private function invalidateCategories( $cats ) {
367  PurgeJobUtils::invalidatePages( $this->getDB(), NS_CATEGORY, array_keys( $cats ) );
368  }
369 
375  private function updateCategoryCounts( array $added, array $deleted ) {
377 
378  if ( !$added && !$deleted ) {
379  return;
380  }
381 
382  $domainId = $this->getDB()->getDomainID();
383  $wp = WikiPage::factory( $this->mTitle );
384  $lbf = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
385  // T163801: try to release any row locks to reduce contention
386  $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
387 
388  foreach ( array_chunk( array_keys( $added ), $wgUpdateRowsPerQuery ) as $addBatch ) {
389  $wp->updateCategoryCounts( $addBatch, [], $this->mId );
390  $lbf->commitAndWaitForReplication(
391  __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
392  }
393 
394  foreach ( array_chunk( array_keys( $deleted ), $wgUpdateRowsPerQuery ) as $deleteBatch ) {
395  $wp->updateCategoryCounts( [], $deleteBatch, $this->mId );
396  $lbf->commitAndWaitForReplication(
397  __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
398  }
399  }
400 
404  private function invalidateImageDescriptions( $images ) {
405  PurgeJobUtils::invalidatePages( $this->getDB(), NS_FILE, array_keys( $images ) );
406  }
407 
415  private function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
416  $services = MediaWikiServices::getInstance();
417  $bSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' );
418  $lbf = $services->getDBLoadBalancerFactory();
419 
420  if ( $table === 'page_props' ) {
421  $fromField = 'pp_page';
422  } else {
423  $fromField = "{$prefix}_from";
424  }
425 
426  $deleteWheres = []; // list of WHERE clause arrays for each DB delete() call
427  if ( $table === 'pagelinks' || $table === 'templatelinks' || $table === 'iwlinks' ) {
428  $baseKey = ( $table === 'iwlinks' ) ? 'iwl_prefix' : "{$prefix}_namespace";
429 
430  $curBatchSize = 0;
431  $curDeletionBatch = [];
432  $deletionBatches = [];
433  foreach ( $deletions as $ns => $dbKeys ) {
434  foreach ( $dbKeys as $dbKey => $unused ) {
435  $curDeletionBatch[$ns][$dbKey] = 1;
436  if ( ++$curBatchSize >= $bSize ) {
437  $deletionBatches[] = $curDeletionBatch;
438  $curDeletionBatch = [];
439  $curBatchSize = 0;
440  }
441  }
442  }
443  if ( $curDeletionBatch ) {
444  $deletionBatches[] = $curDeletionBatch;
445  }
446 
447  foreach ( $deletionBatches as $deletionBatch ) {
448  $deleteWheres[] = [
449  $fromField => $this->mId,
450  $this->getDB()->makeWhereFrom2d( $deletionBatch, $baseKey, "{$prefix}_title" )
451  ];
452  }
453  } else {
454  if ( $table === 'langlinks' ) {
455  $toField = 'll_lang';
456  } elseif ( $table === 'page_props' ) {
457  $toField = 'pp_propname';
458  } else {
459  $toField = $prefix . '_to';
460  }
461 
462  $deletionBatches = array_chunk( array_keys( $deletions ), $bSize );
463  foreach ( $deletionBatches as $deletionBatch ) {
464  $deleteWheres[] = [ $fromField => $this->mId, $toField => $deletionBatch ];
465  }
466  }
467 
468  $domainId = $this->getDB()->getDomainID();
469 
470  foreach ( $deleteWheres as $deleteWhere ) {
471  $this->getDB()->delete( $table, $deleteWhere, __METHOD__ );
472  $lbf->commitAndWaitForReplication(
473  __METHOD__, $this->ticket, [ 'domain' => $domainId ]
474  );
475  }
476 
477  $insertBatches = array_chunk( $insertions, $bSize );
478  foreach ( $insertBatches as $insertBatch ) {
479  $this->getDB()->insert( $table, $insertBatch, __METHOD__, 'IGNORE' );
480  $lbf->commitAndWaitForReplication(
481  __METHOD__, $this->ticket, [ 'domain' => $domainId ]
482  );
483  }
484 
485  if ( count( $insertions ) ) {
486  Hooks::run( 'LinksUpdateAfterInsert', [ $this, $table, $insertions ] );
487  }
488  }
489 
496  private function getLinkInsertions( $existing = [] ) {
497  $arr = [];
498  foreach ( $this->mLinks as $ns => $dbkeys ) {
499  $diffs = isset( $existing[$ns] )
500  ? array_diff_key( $dbkeys, $existing[$ns] )
501  : $dbkeys;
502  foreach ( $diffs as $dbk => $id ) {
503  $arr[] = [
504  'pl_from' => $this->mId,
505  'pl_from_namespace' => $this->mTitle->getNamespace(),
506  'pl_namespace' => $ns,
507  'pl_title' => $dbk
508  ];
509  }
510  }
511 
512  return $arr;
513  }
514 
520  private function getTemplateInsertions( $existing = [] ) {
521  $arr = [];
522  foreach ( $this->mTemplates as $ns => $dbkeys ) {
523  $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
524  foreach ( $diffs as $dbk => $id ) {
525  $arr[] = [
526  'tl_from' => $this->mId,
527  'tl_from_namespace' => $this->mTitle->getNamespace(),
528  'tl_namespace' => $ns,
529  'tl_title' => $dbk
530  ];
531  }
532  }
533 
534  return $arr;
535  }
536 
543  private function getImageInsertions( $existing = [] ) {
544  $arr = [];
545  $diffs = array_diff_key( $this->mImages, $existing );
546  foreach ( $diffs as $iname => $dummy ) {
547  $arr[] = [
548  'il_from' => $this->mId,
549  'il_from_namespace' => $this->mTitle->getNamespace(),
550  'il_to' => $iname
551  ];
552  }
553 
554  return $arr;
555  }
556 
562  private function getExternalInsertions( $existing = [] ) {
563  $arr = [];
564  $diffs = array_diff_key( $this->mExternals, $existing );
565  foreach ( $diffs as $url => $dummy ) {
566  foreach ( wfMakeUrlIndexes( $url ) as $index ) {
567  $arr[] = [
568  'el_from' => $this->mId,
569  'el_to' => $url,
570  'el_index' => $index,
571  ];
572  }
573  }
574 
575  return $arr;
576  }
577 
586  private function getCategoryInsertions( $existing = [] ) {
588  $diffs = array_diff_assoc( $this->mCategories, $existing );
589  $arr = [];
590  foreach ( $diffs as $name => $prefix ) {
592  $wgContLang->findVariantLink( $name, $nt, true );
593 
594  if ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
595  $type = 'subcat';
596  } elseif ( $this->mTitle->getNamespace() == NS_FILE ) {
597  $type = 'file';
598  } else {
599  $type = 'page';
600  }
601 
602  # Treat custom sortkeys as a prefix, so that if multiple
603  # things are forced to sort as '*' or something, they'll
604  # sort properly in the category rather than in page_id
605  # order or such.
606  $sortkey = Collation::singleton()->getSortKey(
607  $this->mTitle->getCategorySortkey( $prefix ) );
608 
609  $arr[] = [
610  'cl_from' => $this->mId,
611  'cl_to' => $name,
612  'cl_sortkey' => $sortkey,
613  'cl_timestamp' => $this->getDB()->timestamp(),
614  'cl_sortkey_prefix' => $prefix,
615  'cl_collation' => $wgCategoryCollation,
616  'cl_type' => $type,
617  ];
618  }
619 
620  return $arr;
621  }
622 
630  private function getInterlangInsertions( $existing = [] ) {
631  $diffs = array_diff_assoc( $this->mInterlangs, $existing );
632  $arr = [];
633  foreach ( $diffs as $lang => $title ) {
634  $arr[] = [
635  'll_from' => $this->mId,
636  'll_lang' => $lang,
637  'll_title' => $title
638  ];
639  }
640 
641  return $arr;
642  }
643 
649  function getPropertyInsertions( $existing = [] ) {
650  $diffs = array_diff_assoc( $this->mProperties, $existing );
651 
652  $arr = [];
653  foreach ( array_keys( $diffs ) as $name ) {
654  $arr[] = $this->getPagePropRowData( $name );
655  }
656 
657  return $arr;
658  }
659 
676  private function getPagePropRowData( $prop ) {
678 
679  $value = $this->mProperties[$prop];
680 
681  $row = [
682  'pp_page' => $this->mId,
683  'pp_propname' => $prop,
684  'pp_value' => $value,
685  ];
686 
687  if ( $wgPagePropsHaveSortkey ) {
688  $row['pp_sortkey'] = $this->getPropertySortKeyValue( $value );
689  }
690 
691  return $row;
692  }
693 
706  private function getPropertySortKeyValue( $value ) {
707  if ( is_int( $value ) || is_float( $value ) || is_bool( $value ) ) {
708  return floatval( $value );
709  }
710 
711  return null;
712  }
713 
720  private function getInterwikiInsertions( $existing = [] ) {
721  $arr = [];
722  foreach ( $this->mInterwikis as $prefix => $dbkeys ) {
723  $diffs = isset( $existing[$prefix] )
724  ? array_diff_key( $dbkeys, $existing[$prefix] )
725  : $dbkeys;
726 
727  foreach ( $diffs as $dbk => $id ) {
728  $arr[] = [
729  'iwl_from' => $this->mId,
730  'iwl_prefix' => $prefix,
731  'iwl_title' => $dbk
732  ];
733  }
734  }
735 
736  return $arr;
737  }
738 
745  private function getLinkDeletions( $existing ) {
746  $del = [];
747  foreach ( $existing as $ns => $dbkeys ) {
748  if ( isset( $this->mLinks[$ns] ) ) {
749  $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks[$ns] );
750  } else {
751  $del[$ns] = $existing[$ns];
752  }
753  }
754 
755  return $del;
756  }
757 
764  private function getTemplateDeletions( $existing ) {
765  $del = [];
766  foreach ( $existing as $ns => $dbkeys ) {
767  if ( isset( $this->mTemplates[$ns] ) ) {
768  $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates[$ns] );
769  } else {
770  $del[$ns] = $existing[$ns];
771  }
772  }
773 
774  return $del;
775  }
776 
783  private function getImageDeletions( $existing ) {
784  return array_diff_key( $existing, $this->mImages );
785  }
786 
793  private function getExternalDeletions( $existing ) {
794  return array_diff_key( $existing, $this->mExternals );
795  }
796 
803  private function getCategoryDeletions( $existing ) {
804  return array_diff_assoc( $existing, $this->mCategories );
805  }
806 
813  private function getInterlangDeletions( $existing ) {
814  return array_diff_assoc( $existing, $this->mInterlangs );
815  }
816 
822  function getPropertyDeletions( $existing ) {
823  return array_diff_assoc( $existing, $this->mProperties );
824  }
825 
832  private function getInterwikiDeletions( $existing ) {
833  $del = [];
834  foreach ( $existing as $prefix => $dbkeys ) {
835  if ( isset( $this->mInterwikis[$prefix] ) ) {
836  $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis[$prefix] );
837  } else {
838  $del[$prefix] = $existing[$prefix];
839  }
840  }
841 
842  return $del;
843  }
844 
850  private function getExistingLinks() {
851  $res = $this->getDB()->select( 'pagelinks', [ 'pl_namespace', 'pl_title' ],
852  [ 'pl_from' => $this->mId ], __METHOD__ );
853  $arr = [];
854  foreach ( $res as $row ) {
855  if ( !isset( $arr[$row->pl_namespace] ) ) {
856  $arr[$row->pl_namespace] = [];
857  }
858  $arr[$row->pl_namespace][$row->pl_title] = 1;
859  }
860 
861  return $arr;
862  }
863 
869  private function getExistingTemplates() {
870  $res = $this->getDB()->select( 'templatelinks', [ 'tl_namespace', 'tl_title' ],
871  [ 'tl_from' => $this->mId ], __METHOD__ );
872  $arr = [];
873  foreach ( $res as $row ) {
874  if ( !isset( $arr[$row->tl_namespace] ) ) {
875  $arr[$row->tl_namespace] = [];
876  }
877  $arr[$row->tl_namespace][$row->tl_title] = 1;
878  }
879 
880  return $arr;
881  }
882 
888  private function getExistingImages() {
889  $res = $this->getDB()->select( 'imagelinks', [ 'il_to' ],
890  [ 'il_from' => $this->mId ], __METHOD__ );
891  $arr = [];
892  foreach ( $res as $row ) {
893  $arr[$row->il_to] = 1;
894  }
895 
896  return $arr;
897  }
898 
904  private function getExistingExternals() {
905  $res = $this->getDB()->select( 'externallinks', [ 'el_to' ],
906  [ 'el_from' => $this->mId ], __METHOD__ );
907  $arr = [];
908  foreach ( $res as $row ) {
909  $arr[$row->el_to] = 1;
910  }
911 
912  return $arr;
913  }
914 
920  private function getExistingCategories() {
921  $res = $this->getDB()->select( 'categorylinks', [ 'cl_to', 'cl_sortkey_prefix' ],
922  [ 'cl_from' => $this->mId ], __METHOD__ );
923  $arr = [];
924  foreach ( $res as $row ) {
925  $arr[$row->cl_to] = $row->cl_sortkey_prefix;
926  }
927 
928  return $arr;
929  }
930 
937  private function getExistingInterlangs() {
938  $res = $this->getDB()->select( 'langlinks', [ 'll_lang', 'll_title' ],
939  [ 'll_from' => $this->mId ], __METHOD__ );
940  $arr = [];
941  foreach ( $res as $row ) {
942  $arr[$row->ll_lang] = $row->ll_title;
943  }
944 
945  return $arr;
946  }
947 
952  private function getExistingInterwikis() {
953  $res = $this->getDB()->select( 'iwlinks', [ 'iwl_prefix', 'iwl_title' ],
954  [ 'iwl_from' => $this->mId ], __METHOD__ );
955  $arr = [];
956  foreach ( $res as $row ) {
957  if ( !isset( $arr[$row->iwl_prefix] ) ) {
958  $arr[$row->iwl_prefix] = [];
959  }
960  $arr[$row->iwl_prefix][$row->iwl_title] = 1;
961  }
962 
963  return $arr;
964  }
965 
971  private function getExistingProperties() {
972  $res = $this->getDB()->select( 'page_props', [ 'pp_propname', 'pp_value' ],
973  [ 'pp_page' => $this->mId ], __METHOD__ );
974  $arr = [];
975  foreach ( $res as $row ) {
976  $arr[$row->pp_propname] = $row->pp_value;
977  }
978 
979  return $arr;
980  }
981 
986  public function getTitle() {
987  return $this->mTitle;
988  }
989 
995  public function getParserOutput() {
996  return $this->mParserOutput;
997  }
998 
1003  public function getImages() {
1004  return $this->mImages;
1005  }
1006 
1014  public function setRevision( Revision $revision ) {
1015  $this->mRevision = $revision;
1016  }
1017 
1022  public function getRevision() {
1023  return $this->mRevision;
1024  }
1025 
1032  public function setTriggeringUser( User $user ) {
1033  $this->user = $user;
1034  }
1035 
1040  public function getTriggeringUser() {
1041  return $this->user;
1042  }
1043 
1048  private function invalidateProperties( $changed ) {
1050 
1051  foreach ( $changed as $name => $value ) {
1052  if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
1054  if ( !is_array( $inv ) ) {
1055  $inv = [ $inv ];
1056  }
1057  foreach ( $inv as $table ) {
1059  new HTMLCacheUpdate( $this->mTitle, $table, 'page-props' )
1060  );
1061  }
1062  }
1063  }
1064  }
1065 
1071  public function getAddedLinks() {
1072  if ( $this->linkInsertions === null ) {
1073  return null;
1074  }
1075  $result = [];
1076  foreach ( $this->linkInsertions as $insertion ) {
1077  $result[] = Title::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] );
1078  }
1079 
1080  return $result;
1081  }
1082 
1088  public function getRemovedLinks() {
1089  if ( $this->linkDeletions === null ) {
1090  return null;
1091  }
1092  $result = [];
1093  foreach ( $this->linkDeletions as $ns => $titles ) {
1094  foreach ( $titles as $title => $unused ) {
1095  $result[] = Title::makeTitle( $ns, $title );
1096  }
1097  }
1098 
1099  return $result;
1100  }
1101 
1108  public function getAddedProperties() {
1110  }
1111 
1118  public function getRemovedProperties() {
1119  return $this->propertyDeletions;
1120  }
1121 
1125  private function updateLinksTimestamp() {
1126  if ( $this->mId ) {
1127  // The link updates made here only reflect the freshness of the parser output
1128  $timestamp = $this->mParserOutput->getCacheTime();
1129  $this->getDB()->update( 'page',
1130  [ 'page_links_updated' => $this->getDB()->timestamp( $timestamp ) ],
1131  [ 'page_id' => $this->mId ],
1132  __METHOD__
1133  );
1134  }
1135  }
1136 
1140  private function getDB() {
1141  if ( !$this->db ) {
1142  $this->db = wfGetDB( DB_MASTER );
1143  }
1144 
1145  return $this->db;
1146  }
1147 
1148  public function getAsJobSpecification() {
1149  if ( $this->user ) {
1150  $userInfo = [
1151  'userId' => $this->user->getId(),
1152  'userName' => $this->user->getName(),
1153  ];
1154  } else {
1155  $userInfo = false;
1156  }
1157 
1158  if ( $this->mRevision ) {
1159  $triggeringRevisionId = $this->mRevision->getId();
1160  } else {
1161  $triggeringRevisionId = false;
1162  }
1163 
1164  return [
1165  'wiki' => WikiMap::getWikiIdFromDomain( $this->getDB()->getDomainID() ),
1166  'job' => new JobSpecification(
1167  'refreshLinksPrioritized',
1168  [
1169  // Reuse the parser cache if it was saved
1170  'rootJobTimestamp' => $this->mParserOutput->getCacheTime(),
1171  'useRecursiveLinksUpdate' => $this->mRecursive,
1172  'triggeringUser' => $userInfo,
1173  'triggeringRevisionId' => $triggeringRevisionId,
1174  'causeAction' => $this->getCauseAction(),
1175  'causeAgent' => $this->getCauseAgent()
1176  ],
1177  [ 'removeDuplicates' => true ],
1178  $this->getTitle()
1179  )
1180  ];
1181  }
1182 }
LinksUpdate\getInterlangInsertions
getInterlangInsertions( $existing=[])
Get an array of interlanguage link insertions.
Definition: LinksUpdate.php:630
LinksUpdate\getTemplateInsertions
getTemplateInsertions( $existing=[])
Get an array of template insertions.
Definition: LinksUpdate.php:520
DataUpdate\getCauseAgent
getCauseAgent()
Definition: DataUpdate.php:67
LinksUpdate\getTemplateDeletions
getTemplateDeletions( $existing)
Given an array of existing templates, returns those templates which are not in $this and thus should ...
Definition: LinksUpdate.php:764
LinksUpdate\getCategoryDeletions
getCategoryDeletions( $existing)
Given an array of existing categories, returns those categories which are not in $this and thus shoul...
Definition: LinksUpdate.php:803
LinksUpdate\getTriggeringUser
getTriggeringUser()
Definition: LinksUpdate.php:1040
LinksUpdate\doUpdate
doUpdate()
Update link tables with outgoing links from an updated article.
Definition: LinksUpdate.php:166
ParserOutput
Definition: ParserOutput.php:25
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
LinksUpdate\acquirePageLock
static acquirePageLock(IDatabase $dbw, $pageId, $why='atomicity')
Acquire a lock for performing link table updates for a page on a DB.
Definition: LinksUpdate.php:201
array
the array() calling protocol came about after MediaWiki 1.4rc1.
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
LinksUpdate\getRemovedProperties
getRemovedProperties()
Fetch page properties removed by this LinksUpdate.
Definition: LinksUpdate.php:1118
LinksUpdate\$mInterwikis
array $mInterwikis
2-D map of (prefix => DBK => 1)
Definition: LinksUpdate.php:65
LinksUpdate\getInterwikiDeletions
getInterwikiDeletions( $existing)
Given an array of existing interwiki links, returns those links which are not in $this and thus shoul...
Definition: LinksUpdate.php:832
$linksUpdate
either a unescaped string or a HtmlArmor object after in associative array form externallinks $linksUpdate
Definition: hooks.txt:2090
LinksUpdate\setRevision
setRevision(Revision $revision)
Set the revision corresponding to this LinksUpdate.
Definition: LinksUpdate.php:1014
wfMakeUrlIndexes
wfMakeUrlIndexes( $url)
Make URL indexes, appropriate for the el_index field of externallinks.
Definition: GlobalFunctions.php:906
ParserOutput\getImages
& getImages()
Definition: ParserOutput.php:436
LinksUpdate\$mId
int $mId
Page ID of the article linked from.
Definition: LinksUpdate.php:38
LinksUpdate\$mCategories
array $mCategories
Map of category names to sort keys.
Definition: LinksUpdate.php:59
DeferredUpdates\addUpdate
static addUpdate(DeferrableUpdate $update, $stage=self::POSTSEND)
Add an update to the deferred list to be run later by execute()
Definition: DeferredUpdates.php:76
LinksUpdate
Class the manages updates of *_link tables as well as similar extension-managed tables.
Definition: LinksUpdate.php:34
NS_FILE
const NS_FILE
Definition: Defines.php:80
PurgeJobUtils\invalidatePages
static invalidatePages(IDatabase $dbw, $namespace, array $dbkeys)
Invalidate the cache of a list of pages from a single namespace.
Definition: PurgeJobUtils.php:35
RefreshLinksJob\newPrioritized
static newPrioritized(Title $title, array $params)
Definition: RefreshLinksJob.php:64
LinksUpdate\$mImages
array $mImages
DB keys of the images used, in the array key only.
Definition: LinksUpdate.php:50
LinksUpdate\$db
IDatabase $db
Definition: LinksUpdate.php:102
$res
$res
Definition: database.txt:21
LinksUpdate\getImageDeletions
getImageDeletions( $existing)
Given an array of existing images, returns those images which are not in $this and thus should be del...
Definition: LinksUpdate.php:783
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1993
LinksUpdate\invalidateImageDescriptions
invalidateImageDescriptions( $images)
Definition: LinksUpdate.php:404
LinksUpdate\updateLinksTimestamp
updateLinksTimestamp()
Update links table freshness.
Definition: LinksUpdate.php:1125
LinksUpdate\$propertyInsertions
null array $propertyInsertions
Added properties if calculated.
Definition: LinksUpdate.php:89
DataUpdate
Abstract base class for update jobs that do something with some secondary data extracted from article...
Definition: DataUpdate.php:28
ParserOutput\getProperties
getProperties()
Definition: ParserOutput.php:962
LinksUpdate\getExternalDeletions
getExternalDeletions( $existing)
Given an array of existing external links, returns those links which are not in $this and thus should...
Definition: LinksUpdate.php:793
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
LinksUpdate\queueRecursiveJobs
queueRecursiveJobs()
Queue recursive jobs for this page.
Definition: LinksUpdate.php:308
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
LinksUpdate\getExistingImages
getExistingImages()
Get an array of existing images, image names in the keys.
Definition: LinksUpdate.php:888
LinksUpdate\incrTableUpdate
incrTableUpdate( $table, $prefix, $deletions, $insertions)
Update a table by doing a delete query then an insert query.
Definition: LinksUpdate.php:415
EnqueueableDataUpdate
Interface that marks a DataUpdate as enqueuable via the JobQueue.
Definition: EnqueueableDataUpdate.php:10
Collation\singleton
static singleton()
Definition: Collation.php:34
LinksUpdate\getLinkInsertions
getLinkInsertions( $existing=[])
Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D arra...
Definition: LinksUpdate.php:496
Revision
Definition: Revision.php:41
LinksUpdate\getExistingTemplates
getExistingTemplates()
Get an array of existing templates, as a 2-D array.
Definition: LinksUpdate.php:869
LinksUpdate\getCategoryInsertions
getCategoryInsertions( $existing=[])
Get an array of category insertions.
Definition: LinksUpdate.php:586
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:115
LinksUpdate\updateCategoryCounts
updateCategoryCounts(array $added, array $deleted)
Update all the appropriate counts in the category table.
Definition: LinksUpdate.php:375
LinksUpdate\$mTemplates
array $mTemplates
Map of title strings to IDs for the template references, including broken ones.
Definition: LinksUpdate.php:53
user
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
Definition: distributors.txt:25
LinksUpdate\doIncrementalUpdate
doIncrementalUpdate()
Definition: LinksUpdate.php:211
LinksUpdate\$mProperties
array $mProperties
Map of arbitrary name to value.
Definition: LinksUpdate.php:68
$titles
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
LinksUpdate\getInterlangDeletions
getInterlangDeletions( $existing)
Given an array of existing interlanguage links, returns those links which are not in $this and thus s...
Definition: LinksUpdate.php:813
ParserOutput\getInterwikiLinks
getInterwikiLinks()
Definition: ParserOutput.php:388
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2812
LinksUpdate\invalidateProperties
invalidateProperties( $changed)
Invalidate any necessary link lists related to page property changes.
Definition: LinksUpdate.php:1048
LinksUpdate\$mRevision
Revision $mRevision
Revision for which this update has been triggered.
Definition: LinksUpdate.php:74
LinksUpdate\$linkInsertions
null array $linkInsertions
Added links if calculated.
Definition: LinksUpdate.php:79
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:3021
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
$wgUpdateRowsPerQuery
$wgUpdateRowsPerQuery
Number of rows to update per query.
Definition: DefaultSettings.php:8437
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:534
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:95
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:88
LinksUpdate\getExistingProperties
getExistingProperties()
Get an array of existing categories, with the name in the key and sort key in the value.
Definition: LinksUpdate.php:971
LinksUpdate\$mTitle
Title $mTitle
Title object of the article linked from.
Definition: LinksUpdate.php:41
DB_MASTER
const DB_MASTER
Definition: defines.php:26
LinksUpdate\getTitle
getTitle()
Return the title object of the page being updated.
Definition: LinksUpdate.php:986
Job\newRootJobParams
static newRootJobParams( $key)
Get "root job" parameters for a task.
Definition: Job.php:286
$services
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Definition: hooks.txt:2273
LinksUpdate\getImageInsertions
getImageInsertions( $existing=[])
Get an array of image insertions Skips the names specified in $existing.
Definition: LinksUpdate.php:543
ParserOutput\getLanguageLinks
& getLanguageLinks()
Definition: ParserOutput.php:384
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
LinksUpdate\__construct
__construct(Title $title, ParserOutput $parserOutput, $recursive=true)
Definition: LinksUpdate.php:110
WikiMap\getWikiIdFromDomain
static getWikiIdFromDomain( $domain)
Get the wiki ID of a database domain.
Definition: WikiMap.php:252
LinksUpdate\getExistingInterlangs
getExistingInterlangs()
Get an array of existing interlanguage links, with the language code in the key and the title in the ...
Definition: LinksUpdate.php:937
ParserOutput\getExternalLinks
& getExternalLinks()
Definition: ParserOutput.php:444
LinksUpdate\$mParserOutput
ParserOutput $mParserOutput
Definition: LinksUpdate.php:44
LinksUpdate\getParserOutput
getParserOutput()
Returns parser output.
Definition: LinksUpdate.php:995
HTMLCacheUpdate
Class to invalidate the HTML cache of all the pages linking to a given title.
Definition: HTMLCacheUpdate.php:29
LinksUpdate\getAddedLinks
getAddedLinks()
Fetch page links added by this LinksUpdate.
Definition: LinksUpdate.php:1071
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:562
RefreshLinksJob
Job to update link tables for pages.
Definition: RefreshLinksJob.php:39
LinksUpdate\getInterwikiInsertions
getInterwikiInsertions( $existing=[])
Get an array of interwiki insertions for passing to the DB Skips the titles specified by the 2-D arra...
Definition: LinksUpdate.php:720
LinksUpdate\getAddedProperties
getAddedProperties()
Fetch page properties added by this LinksUpdate.
Definition: LinksUpdate.php:1108
$value
$value
Definition: styleTest.css.php:45
Wikimedia\Rdbms\IDatabase\getScopedLockAndFlush
getScopedLockAndFlush( $lockKey, $fname, $timeout)
Acquire a named lock, flush any transaction, and return an RAII style unlocker object.
Title\GAID_FOR_UPDATE
const GAID_FOR_UPDATE
Used to be GAID_FOR_UPDATE define.
Definition: Title.php:54
LinksUpdate\getExistingCategories
getExistingCategories()
Get an array of existing categories, with the name in the key and sort key in the value.
Definition: LinksUpdate.php:920
LinksUpdate\$linkDeletions
null array $linkDeletions
Deleted links if calculated.
Definition: LinksUpdate.php:84
LinksUpdate\getPagePropRowData
getPagePropRowData( $prop)
Returns an associative array to be used for inserting a row into the page_props table.
Definition: LinksUpdate.php:676
LinksUpdate\getExistingExternals
getExistingExternals()
Get an array of existing external links, URLs in the keys.
Definition: LinksUpdate.php:904
LinksUpdate\getPropertyDeletions
getPropertyDeletions( $existing)
Get array of properties which should be deleted.
Definition: LinksUpdate.php:822
ParserOutput\getTemplates
& getTemplates()
Definition: ParserOutput.php:428
LinksUpdate\getImages
getImages()
Return the list of images used as generated by the parser.
Definition: LinksUpdate.php:1003
LinksUpdate\$mInterlangs
array $mInterlangs
Map of language codes to titles.
Definition: LinksUpdate.php:62
LinksUpdate\getAsJobSpecification
getAsJobSpecification()
Definition: LinksUpdate.php:1148
Title
Represents a title within MediaWiki.
Definition: Title.php:39
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
LinksUpdate\setTriggeringUser
setTriggeringUser(User $user)
Set the User who triggered this LinksUpdate.
Definition: LinksUpdate.php:1032
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:72
LinksUpdate\getRemovedLinks
getRemovedLinks()
Fetch page links removed by this LinksUpdate.
Definition: LinksUpdate.php:1088
LinksUpdate\$mExternals
array $mExternals
URLs of external links, array key only.
Definition: LinksUpdate.php:56
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:47
$wgPagePropLinkInvalidations
$wgPagePropLinkInvalidations
Page property link table invalidation lists.
Definition: DefaultSettings.php:7585
JobSpecification
Job queue task description base code.
Definition: JobSpecification.php:103
LinksUpdate\getPropertyInsertions
getPropertyInsertions( $existing=[])
Get an array of page property insertions.
Definition: LinksUpdate.php:649
ParserOutput\getCategories
& getCategories()
Definition: ParserOutput.php:396
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:22
LinksUpdate\getExternalInsertions
getExternalInsertions( $existing=[])
Get an array of externallinks insertions.
Definition: LinksUpdate.php:562
LinksUpdate\$mRecursive
bool $mRecursive
Whether to queue jobs for recursive updates.
Definition: LinksUpdate.php:71
LinksUpdate\$user
User null $user
Definition: LinksUpdate.php:99
LinksUpdate\queueRecursiveJobsForTable
static queueRecursiveJobsForTable(Title $title, $table, $action='unknown', $userName='unknown')
Queue a RefreshLinks job for any table.
Definition: LinksUpdate.php:345
LinksUpdate\$propertyDeletions
null array $propertyDeletions
Deleted properties if calculated.
Definition: LinksUpdate.php:94
LinksUpdate\invalidateCategories
invalidateCategories( $cats)
Definition: LinksUpdate.php:366
$wgCategoryCollation
$wgCategoryCollation
Specify how category names should be sorted, when listed on a category page.
Definition: DefaultSettings.php:7637
DataUpdate\getCauseAction
getCauseAction()
Definition: DataUpdate.php:60
LinksUpdate\getExistingLinks
getExistingLinks()
Get an array of existing links, as a 2-D array.
Definition: LinksUpdate.php:850
$wgPagePropsHaveSortkey
$wgPagePropsHaveSortkey
Whether the page_props table has a pp_sortkey column.
Definition: DefaultSettings.php:8613
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:25
LinksUpdate\getDB
getDB()
Definition: LinksUpdate.php:1140
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:53
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
LinksUpdate\getRevision
getRevision()
Definition: LinksUpdate.php:1022
LinksUpdate\$mLinks
array $mLinks
Map of title strings to IDs for the links in the document.
Definition: LinksUpdate.php:47
LinksUpdate\getPropertySortKeyValue
getPropertySortKeyValue( $value)
Determines the sort key for the given property value.
Definition: LinksUpdate.php:706
LinksUpdate\getLinkDeletions
getLinkDeletions( $existing)
Given an array of existing links, returns those links which are not in $this and thus should be delet...
Definition: LinksUpdate.php:745
ParserOutput\getLinks
& getLinks()
Definition: ParserOutput.php:424
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:57
LinksUpdate\getExistingInterwikis
getExistingInterwikis()
Get an array of existing inline interwiki links, as a 2-D array.
Definition: LinksUpdate.php:952
$type
$type
Definition: testCompression.php:48