Index: trunk/phase3/includes/Title.php |
— | — | @@ -2984,7 +2984,7 @@ |
2985 | 2985 | if ( $this->getNamespace() == NS_FILE ) { |
2986 | 2986 | $errors = array_merge( $errors, $this->validateFileMoveOperation( $nt ) ); |
2987 | 2987 | } |
2988 | | - |
| 2988 | + |
2989 | 2989 | if ( $nt->getNamespace() == NS_FILE && $this->getNamespace() != NS_FILE ) { |
2990 | 2990 | $errors[] = array( 'nonfile-cannot-move-to-file' ); |
2991 | 2991 | } |
— | — | @@ -3028,7 +3028,7 @@ |
3029 | 3029 | } |
3030 | 3030 | return $errors; |
3031 | 3031 | } |
3032 | | - |
| 3032 | + |
3033 | 3033 | /** |
3034 | 3034 | * Check if the requested move target is a valid file move target |
3035 | 3035 | * @param Title $nt Target title |
— | — | @@ -3036,13 +3036,13 @@ |
3037 | 3037 | */ |
3038 | 3038 | protected function validateFileMoveOperation( $nt ) { |
3039 | 3039 | global $wgUser; |
3040 | | - |
| 3040 | + |
3041 | 3041 | $errors = array(); |
3042 | | - |
| 3042 | + |
3043 | 3043 | if ( $nt->getNamespace() != NS_FILE ) { |
3044 | 3044 | $errors[] = array( 'imagenocrossnamespace' ); |
3045 | 3045 | } |
3046 | | - |
| 3046 | + |
3047 | 3047 | $file = wfLocalFile( $this ); |
3048 | 3048 | if ( $file->exists() ) { |
3049 | 3049 | if ( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) { |
— | — | @@ -3052,12 +3052,12 @@ |
3053 | 3053 | $errors[] = array( 'imagetypemismatch' ); |
3054 | 3054 | } |
3055 | 3055 | } |
3056 | | - |
| 3056 | + |
3057 | 3057 | $destFile = wfLocalFile( $nt ); |
3058 | 3058 | if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destfile->exists() && wfFindFile( $nt ) ) { |
3059 | 3059 | $errors[] = array( 'file-exists-sharedrepo' ); |
3060 | 3060 | } |
3061 | | - |
| 3061 | + |
3062 | 3062 | return $errors; |
3063 | 3063 | } |
3064 | 3064 | |
— | — | @@ -3232,6 +3232,9 @@ |
3233 | 3233 | $oldid = $this->getArticleID(); |
3234 | 3234 | $latest = $this->getLatestRevID(); |
3235 | 3235 | |
| 3236 | + $oldns = $this->getNamespace(); |
| 3237 | + $olddbk = $this->getDBkey(); |
| 3238 | + |
3236 | 3239 | $dbw = wfGetDB( DB_MASTER ); |
3237 | 3240 | |
3238 | 3241 | if ( $moveOverRedirect ) { |
— | — | @@ -3316,6 +3319,17 @@ |
3317 | 3320 | __METHOD__ ); |
3318 | 3321 | $redirectSuppressed = false; |
3319 | 3322 | } 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 | + |
3320 | 3334 | $this->resetArticleID( 0 ); |
3321 | 3335 | $redirectSuppressed = true; |
3322 | 3336 | } |
— | — | @@ -4150,15 +4164,15 @@ |
4151 | 4165 | } |
4152 | 4166 | |
4153 | 4167 | wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); |
4154 | | - |
4155 | | - wfDebug( __METHOD__ . ': applicable restriction types for ' . |
| 4168 | + |
| 4169 | + wfDebug( __METHOD__ . ': applicable restriction types for ' . |
4156 | 4170 | $this->getPrefixedText() . ' are ' . implode( ',', $types ) . "\n" ); |
4157 | 4171 | |
4158 | 4172 | return $types; |
4159 | 4173 | } |
4160 | 4174 | /** |
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 |
4163 | 4177 | * titles that do exist, False for all restriction types that apply to |
4164 | 4178 | * titles that do not exist |
4165 | 4179 | * @return array |