Merge "deferred: make DeferredUpdates::attemptUpdate() use callback owners for $fname...
[lhc/web/wiklou.git] / includes / Storage / DerivedPageDataUpdater.php
index 2d53682..4903cf0 100644 (file)
@@ -343,14 +343,6 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
                }
        }
 
-       /**
-        * @return bool|string
-        */
-       private function getWikiId() {
-               // TODO: get from RevisionStore
-               return false;
-       }
-
        /**
         * Checks whether this DerivedPageDataUpdater can be re-used for running updates targeting
         * the given revision.
@@ -667,7 +659,7 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
                        $hasLinks = (bool)count( $this->getCanonicalParserOutput()->getLinks() );
                }
 
-               foreach ( $this->getModifiedSlotRoles() as $role ) {
+               foreach ( $this->getSlots()->getSlotRoles() as $role ) {
                        $roleHandler = $this->slotRoleRegistry->getRoleHandler( $role );
                        if ( $roleHandler->supportsArticleCount() ) {
                                $content = $this->getRawContent( $role );
@@ -1216,7 +1208,8 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
                }
 
                // "created" is forced here
-               $this->options['created'] = ( $this->pageState['oldId'] === 0 );
+               $this->options['created'] = ( $this->options['created'] ||
+                                               ( $this->pageState['oldId'] === 0 ) );
 
                $this->revision = $revision;
 
@@ -1492,7 +1485,6 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
 
                $id = $this->getPageId();
                $title = $this->getTitle();
-               $dbKey = $title->getPrefixedDBkey();
                $shortTitle = $title->getDBkey();
 
                if ( !$title->exists() ) {
@@ -1530,7 +1522,7 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
                // TODO: make search infrastructure aware of slots!
                $mainSlot = $this->revision->getSlot( SlotRecord::MAIN );
                if ( !$mainSlot->isInherited() && !$this->isContentDeleted() ) {
-                       DeferredUpdates::addUpdate( new SearchUpdate( $id, $dbKey, $mainSlot->getContent() ) );
+                       DeferredUpdates::addUpdate( new SearchUpdate( $id, $title, $mainSlot->getContent() ) );
                }
 
                // If this is another user's talk page, update newtalk.
@@ -1581,7 +1573,10 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
 
                // TODO: In the wiring, register a listener for this on the new PageEventEmitter
                ResourceLoaderWikiModule::invalidateModuleCache(
-                       $title, $oldLegacyRevision, $legacyRevision, $this->getWikiId() ?: wfWikiID()
+                       $title,
+                       $oldLegacyRevision,
+                       $legacyRevision,
+                       $this->loadbalancerFactory->getLocalDomainID()
                );
 
                $this->doTransition( 'done' );