Merge "Show change tags on diffs"
[lhc/web/wiklou.git] / includes / WikiPage.php
index 5ed6c8d..8cf98ed 100644 (file)
@@ -2071,7 +2071,9 @@ class WikiPage implements Page, IDBAccessObject {
 
                // Update the links tables and other secondary data
                if ( $content ) {
-                       $updates = $content->getSecondaryDataUpdates( $this->getTitle(), null, true, $editInfo->output );
+                       $recursive = $options['changed']; // bug 50785
+                       $updates = $content->getSecondaryDataUpdates(
+                               $this->getTitle(), null, $recursive, $editInfo->output );
                        DataUpdate::runUpdates( $updates );
                }
 
@@ -2109,8 +2111,7 @@ class WikiPage implements Page, IDBAccessObject {
                }
 
                DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, $good, $total ) );
-               DeferredUpdates::addUpdate( new SearchUpdate( $id, $title, $content->getTextForSearchIndex() ) );
-               // @todo let the search engine decide what to do with the content object
+               DeferredUpdates::addUpdate( new SearchUpdate( $id, $title, $content ) );
 
                // If this is another user's talk page, update newtalk.
                // Don't do this if $options['changed'] = false (null-edits) nor if
@@ -2344,13 +2345,21 @@ class WikiPage implements Page, IDBAccessObject {
                                return Status::newGood();
                        }
 
-                       // Only certain restrictions can cascade... Otherwise, users who cannot normally protect pages
-                       // could "protect" them by transcluding them on protected pages they are allowed to edit.
+                       // Only certain restrictions can cascade...
                        $editrestriction = isset( $limit['edit'] ) ? array( $limit['edit'] ) : $this->mTitle->getRestrictions( 'edit' );
+                       foreach ( array_keys( $editrestriction, 'sysop' ) as $key ) {
+                               $editrestriction[$key] = 'editprotected'; // backwards compatibility
+                       }
+                       foreach ( array_keys( $editrestriction, 'autoconfirmed' ) as $key ) {
+                               $editrestriction[$key] = 'editsemiprotected'; // backwards compatibility
+                       }
 
                        $cascadingRestrictionLevels = $wgCascadingRestrictionLevels;
-                       if ( in_array( 'sysop', $cascadingRestrictionLevels ) ) {
-                               $cascadingRestrictionLevels[] = 'protect'; // backwards compatibility
+                       foreach ( array_keys( $cascadingRestrictionLevels, 'sysop' ) as $key ) {
+                               $cascadingRestrictionLevels[$key] = 'editprotected'; // backwards compatibility
+                       }
+                       foreach ( array_keys( $cascadingRestrictionLevels, 'autoconfirmed' ) as $key ) {
+                               $cascadingRestrictionLevels[$key] = 'editsemiprotected'; // backwards compatibility
                        }
 
                        // The schema allows multiple restrictions
@@ -2648,7 +2657,7 @@ class WikiPage implements Page, IDBAccessObject {
        /**
         * Do some database updates after deletion
         *
-        * @param int $id page_id value of the page being deleted (B/C, currently unused)
+        * @param int $id page_id value of the page being deleted
         * @param $content Content: optional page content to be used when determining the required updates.
         *        This may be needed because $this->getContent() may already return null when the page proper was deleted.
         */
@@ -2665,6 +2674,9 @@ class WikiPage implements Page, IDBAccessObject {
 
                // Reset this object and the Title object
                $this->loadFromRow( false, self::READ_LATEST );
+
+               // Search engine
+               DeferredUpdates::addUpdate( new SearchUpdate( $id, $this->mTitle ) );
        }
 
        /**