r84309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84308‎ | r84309 | r84310 >
Date:04:24, 19 March 2011
Author:mah
Status:reverted (Comments)
Tags:
Comment:
Fix for Bug# 17463: New pages log doesn't remove/update item after suppression redirect

Except for some whitespace changes, this is Baowolff's patch from http://bug-attachment.wikimedia.org/attachment.cgi?id=8312 which I am applying in the spirit of “apologize later”.

Baowolff writes:

Don't show new page entries in Special:newpage for supressed redirects.

Patch to remove the new page entry from Special:RecentChange and
special:newpages, if the new page gets moved with redirect supressed.


I'm not a 100% sure this is a good idea. This will only suppress the initial
new page line in the RC (And newpages), and won't supress any other edits to
the page. Does this behaviour really make sense? (Thats not rhetorical). It
seems somewhat different from deleting a page, where none of the content is
relevent, but when you move a page, the edits don't go away, they're just in a
new title.

I suppose we could just change the new page entry in the RC to point to the
other page, but that seems rather wrong too.

So anyhow, not sure what the right approach is.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2984,7 +2984,7 @@
29852985 if ( $this->getNamespace() == NS_FILE ) {
29862986 $errors = array_merge( $errors, $this->validateFileMoveOperation( $nt ) );
29872987 }
2988 -
 2988+
29892989 if ( $nt->getNamespace() == NS_FILE && $this->getNamespace() != NS_FILE ) {
29902990 $errors[] = array( 'nonfile-cannot-move-to-file' );
29912991 }
@@ -3028,7 +3028,7 @@
30293029 }
30303030 return $errors;
30313031 }
3032 -
 3032+
30333033 /**
30343034 * Check if the requested move target is a valid file move target
30353035 * @param Title $nt Target title
@@ -3036,13 +3036,13 @@
30373037 */
30383038 protected function validateFileMoveOperation( $nt ) {
30393039 global $wgUser;
3040 -
 3040+
30413041 $errors = array();
3042 -
 3042+
30433043 if ( $nt->getNamespace() != NS_FILE ) {
30443044 $errors[] = array( 'imagenocrossnamespace' );
30453045 }
3046 -
 3046+
30473047 $file = wfLocalFile( $this );
30483048 if ( $file->exists() ) {
30493049 if ( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) {
@@ -3052,12 +3052,12 @@
30533053 $errors[] = array( 'imagetypemismatch' );
30543054 }
30553055 }
3056 -
 3056+
30573057 $destFile = wfLocalFile( $nt );
30583058 if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destfile->exists() && wfFindFile( $nt ) ) {
30593059 $errors[] = array( 'file-exists-sharedrepo' );
30603060 }
3061 -
 3061+
30623062 return $errors;
30633063 }
30643064
@@ -3232,6 +3232,9 @@
32333233 $oldid = $this->getArticleID();
32343234 $latest = $this->getLatestRevID();
32353235
 3236+ $oldns = $this->getNamespace();
 3237+ $olddbk = $this->getDBkey();
 3238+
32363239 $dbw = wfGetDB( DB_MASTER );
32373240
32383241 if ( $moveOverRedirect ) {
@@ -3316,6 +3319,17 @@
33173320 __METHOD__ );
33183321 $redirectSuppressed = false;
33193322 } else {
 3323+ // Get rid of old new page entries in Special:NewPages and RC.
 3324+ // Needs to be before $this->resetArticleUD( 0 ).
 3325+ $dbw->delete( 'recentchanges', array(
 3326+ 'rc_timestamp' => $dbw->timestamp( $this->getEarliestRevTime() ),
 3327+ 'rc_namespace' => $oldns,
 3328+ 'rc_title' => $olddbk,
 3329+ 'rc_new' => 1
 3330+ ),
 3331+ __METHOD__
 3332+ );
 3333+
33203334 $this->resetArticleID( 0 );
33213335 $redirectSuppressed = true;
33223336 }
@@ -4150,15 +4164,15 @@
41514165 }
41524166
41534167 wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
4154 -
4155 - wfDebug( __METHOD__ . ': applicable restriction types for ' .
 4168+
 4169+ wfDebug( __METHOD__ . ': applicable restriction types for ' .
41564170 $this->getPrefixedText() . ' are ' . implode( ',', $types ) . "\n" );
41574171
41584172 return $types;
41594173 }
41604174 /**
4161 - * Get a filtered list of all restriction types supported by this wiki.
4162 - * @param bool $exists True to get all restriction types that apply to
 4175+ * Get a filtered list of all restriction types supported by this wiki.
 4176+ * @param bool $exists True to get all restriction types that apply to
41634177 * titles that do exist, False for all restriction types that apply to
41644178 * titles that do not exist
41654179 * @return array

Follow-up revisions

RevisionCommit summaryAuthorDate
r93986Reverting r84309 (New pages log doesn't remove/update item after suppression ...demon17:03, 5 August 2011

Comments

#Comment by 😂 (talk | contribs)   14:07, 15 July 2011

This looks ok, but feels totally wrong.

Status & tagging log