Expand the default watchlist time from 3 to 7 days
[lhc/web/wiklou.git] / includes / EditPage.php
index 3c97fe6..dfb2b43 100644 (file)
@@ -948,12 +948,7 @@ class EditPage {
                        } else {
                                // If we receive the last parameter of the request, we can fairly
                                // claim the POST request has not been truncated.
-
-                               // TODO: softened the check for cutover.  Once we determine
-                               // that it is safe, we should complete the transition by
-                               // removing the "edittime" clause.
-                               $this->incompleteForm = ( !$request->getVal( 'wpUltimateParam' )
-                                       && is_null( $this->edittime ) );
+                               $this->incompleteForm = !$request->getVal( 'wpUltimateParam' );
                        }
                        if ( $this->incompleteForm ) {
                                # If the form is incomplete, force to preview.
@@ -1202,6 +1197,7 @@ class EditPage {
                                if ( $undo > 0 && $undoafter > 0 ) {
                                        $undorev = Revision::newFromId( $undo );
                                        $oldrev = Revision::newFromId( $undoafter );
+                                       $undoMsg = null;
 
                                        # Sanity check, make sure it's the right page,
                                        # the revisions exist and they were not deleted.
@@ -1210,12 +1206,19 @@ class EditPage {
                                                !$undorev->isDeleted( Revision::DELETED_TEXT ) &&
                                                !$oldrev->isDeleted( Revision::DELETED_TEXT )
                                        ) {
-                                               $content = $this->page->getUndoContent( $undorev, $oldrev );
-
-                                               if ( $content === false ) {
-                                                       # Warn the user that something went wrong
-                                                       $undoMsg = 'failure';
+                                               if ( WikiPage::hasDifferencesOutsideMainSlot( $undorev, $oldrev ) ) {
+                                                       // Cannot yet undo edits that involve anything other the main slot.
+                                                       $undoMsg = 'main-slot-only';
                                                } else {
+                                                       $content = $this->page->getUndoContent( $undorev, $oldrev );
+
+                                                       if ( $content === false ) {
+                                                               # Warn the user that something went wrong
+                                                               $undoMsg = 'failure';
+                                                       }
+                                               }
+
+                                               if ( $undoMsg === null ) {
                                                        $oldContent = $this->page->getContent( Revision::RAW );
                                                        $popts = ParserOptions::newFromUserAndLang( $user, $wgContLang );
                                                        $newContent = $content->preSaveTransform( $this->mTitle, $user, $popts );
@@ -1272,7 +1275,8 @@ class EditPage {
                                        }
 
                                        $out = $this->context->getOutput();
-                                       // Messages: undo-success, undo-failure, undo-norev, undo-nochange
+                                       // Messages: undo-success, undo-failure, undo-main-slot-only, undo-norev,
+                                       // undo-nochange.
                                        $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}";
                                        $this->editFormPageTop .= $out->parse( "<div class=\"{$class}\">" .
                                                $this->context->msg( 'undo-' . $undoMsg )->plain() . '</div>', true, /* interface */true );
@@ -3189,8 +3193,8 @@ ERROR;
         * Builds a standard summary input with a label.
         *
         * @param string $summary The value of the summary input
-        * @param string $labelText The html to place inside the label
-        * @param array $inputAttrs Array of attrs to use on the input
+        * @param string|null $labelText The html to place inside the label
+        * @param array|null $inputAttrs Array of attrs to use on the input
         *
         * @return OOUI\FieldLayout OOUI FieldLayout with Label and Input
         */
@@ -3323,8 +3327,8 @@ ERROR;
         * The $textoverride method can be used by subclasses overriding showContentForm
         * to pass back to this method.
         *
-        * @param array $customAttribs Array of html attributes to use in the textarea
-        * @param string $textoverride Optional text to override $this->textarea1 with
+        * @param array|null $customAttribs Array of html attributes to use in the textarea
+        * @param string|null $textoverride Optional text to override $this->textarea1 with
         */
        protected function showTextbox1( $customAttribs = null, $textoverride = null ) {
                if ( $this->wasDeletedSinceLastEdit() && $this->formtype == 'save' ) {
@@ -4022,7 +4026,7 @@ ERROR;
         * Shows a bulletin board style toolbar for common editing functions.
         * It can be disabled in the user preferences.
         *
-        * @param Title $title Title object for the page being edited (optional)
+        * @param Title|null $title Title object for the page being edited (optional)
         * @return string
         */
        public static function getEditToolbar( $title = null ) {