diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 5e02c5cc6cf..ec7360e0d9a 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -79,6 +79,16 @@ class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate { */ private $linkDeletions = null; + /** + * @var null|array Added properties if calculated. + */ + private $propertyInsertions = null; + + /** + * @var null|array Deleted properties if calculated. + */ + private $propertyDeletions = null; + /** * @var User|null */ @@ -234,12 +244,13 @@ class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate { # Page properties $existing = $this->getExistingProperties(); - $propertiesDeletes = $this->getPropertyDeletions( $existing ); - $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes, + $this->propertyDeletions = $this->getPropertyDeletions( $existing ); + $this->incrTableUpdate( 'page_props', 'pp', $this->propertyDeletions, $this->getPropertyInsertions( $existing ) ); # Invalidate the necessary pages - $changed = $propertiesDeletes + array_diff_assoc( $this->mProperties, $existing ); + $this->propertyInsertions = array_diff_assoc( $this->mProperties, $existing ); + $changed = $this->propertyDeletions + $this->propertyInsertions; $this->invalidateProperties( $changed ); # Refresh links of all pages including this page @@ -1016,6 +1027,26 @@ class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate { return $result; } + /** + * Fetch page properties added by this LinksUpdate. + * Only available after the update is complete. + * @since 1.28 + * @return null|array + */ + public function getAddedProperties() { + return $this->propertyInsertions; + } + + /** + * Fetch page properties removed by this LinksUpdate. + * Only available after the update is complete. + * @since 1.28 + * @return null|array + */ + public function getRemovedProperties() { + return $this->propertyDeletions; + } + /** * Update links table freshness */