@@ 471-488 (lines=18) @@ | ||
468 | * @param array $existing |
|
469 | * @return array |
|
470 | */ |
|
471 | private function getLinkInsertions( $existing = [] ) { |
|
472 | $arr = []; |
|
473 | foreach ( $this->mLinks as $ns => $dbkeys ) { |
|
474 | $diffs = isset( $existing[$ns] ) |
|
475 | ? array_diff_key( $dbkeys, $existing[$ns] ) |
|
476 | : $dbkeys; |
|
477 | foreach ( $diffs as $dbk => $id ) { |
|
478 | $arr[] = [ |
|
479 | 'pl_from' => $this->mId, |
|
480 | 'pl_from_namespace' => $this->mTitle->getNamespace(), |
|
481 | 'pl_namespace' => $ns, |
|
482 | 'pl_title' => $dbk |
|
483 | ]; |
|
484 | } |
|
485 | } |
|
486 | ||
487 | return $arr; |
|
488 | } |
|
489 | ||
490 | /** |
|
491 | * Get an array of template insertions. Like getLinkInsertions() |
|
@@ 495-510 (lines=16) @@ | ||
492 | * @param array $existing |
|
493 | * @return array |
|
494 | */ |
|
495 | private function getTemplateInsertions( $existing = [] ) { |
|
496 | $arr = []; |
|
497 | foreach ( $this->mTemplates as $ns => $dbkeys ) { |
|
498 | $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys; |
|
499 | foreach ( $diffs as $dbk => $id ) { |
|
500 | $arr[] = [ |
|
501 | 'tl_from' => $this->mId, |
|
502 | 'tl_from_namespace' => $this->mTitle->getNamespace(), |
|
503 | 'tl_namespace' => $ns, |
|
504 | 'tl_title' => $dbk |
|
505 | ]; |
|
506 | } |
|
507 | } |
|
508 | ||
509 | return $arr; |
|
510 | } |
|
511 | ||
512 | /** |
|
513 | * Get an array of image insertions |