*/
private $linkDeletions = null;
+ /**
+ * @var null|array Added external links if calculated.
+ */
+ private $externalLinkInsertions = null;
+
+ /**
+ * @var null|array Deleted external links if calculated.
+ */
+ private $externalLinkDeletions = null;
+
/**
* @var null|array Added properties if calculated.
*/
# External links
$existingEL = $this->getExistingExternals();
+ $this->externalLinkDeletions = $this->getExternalDeletions( $existingEL );
+ $this->externalLinkInsertions = $this->getExternalInsertions(
+ $existingEL );
$this->incrTableUpdate(
'externallinks',
'el',
- $this->getExternalDeletions( $existingEL ),
- $this->getExternalInsertions( $existingEL ) );
+ $this->externalLinkDeletions,
+ $this->externalLinkInsertions );
# Language links
$existingLL = $this->getExistingInterlangs();
$arr = [];
$diffs = array_diff_key( $this->mExternals, $existing );
foreach ( $diffs as $url => $dummy ) {
- foreach ( wfMakeUrlIndexes( $url ) as $index ) {
+ foreach ( LinkFilter::makeIndexes( $url ) as $index ) {
$arr[] = [
'el_from' => $this->mId,
'el_to' => $url,
* @param array $existing
* @return array
*/
- function getPropertyDeletions( $existing ) {
+ private function getPropertyDeletions( $existing ) {
return array_diff_assoc( $existing, $this->mProperties );
}
return $result;
}
+ /**
+ * Fetch external links added by this LinksUpdate. Only available after
+ * the update is complete.
+ * @since 1.33
+ * @return null|array Array of Strings
+ */
+ public function getAddedExternalLinks() {
+ if ( $this->externalLinkInsertions === null ) {
+ return null;
+ }
+ $result = [];
+ foreach ( $this->externalLinkInsertions as $key => $value ) {
+ $result[] = $value['el_to'];
+ }
+ return $result;
+ }
+
+ /**
+ * Fetch external links removed by this LinksUpdate. Only available after
+ * the update is complete.
+ * @since 1.33
+ * @return null|array Array of Strings
+ */
+ public function getRemovedExternalLinks() {
+ if ( $this->externalLinkDeletions === null ) {
+ return null;
+ }
+ return array_keys( $this->externalLinkDeletions );
+ }
+
/**
* Fetch page properties added by this LinksUpdate.
* Only available after the update is complete.
}
return [
- 'wiki' => WikiMap::getWikiIdFromDomain( $this->getDB()->getDomainID() ),
+ 'wiki' => WikiMap::getWikiIdFromDbDomain( $this->getDB()->getDomainID() ),
'job' => new JobSpecification(
'refreshLinksPrioritized',
[