$status->fatal( 'spamprotectiontext' );
}
- # The move is allowed only if (1) the target doesn't exist, or
- # (2) the target is a redirect to the source, and has no history
- # (so we can undo bad moves right after they're done).
-
- if ( $this->newTitle->getArticleID() ) { # Target exists; check for validity
- if ( !$this->isValidMoveTarget() ) {
- $status->fatal( 'articleexists' );
- }
- } else {
- $tp = $this->newTitle->getTitleProtection();
- if ( $tp !== false ) {
- if ( !$user->isAllowed( $tp['permission'] ) ) {
- $status->fatal( 'cantmove-titleprotected' );
- }
- }
+ $tp = $this->newTitle->getTitleProtection();
+ if ( $tp !== false && !$user->isAllowed( $tp['permission'] ) ) {
+ $status->fatal( 'cantmove-titleprotected' );
}
Hooks::run( 'MovePageCheckPermissions',
$status->fatal( 'badarticleerror' );
}
+ # The move is allowed only if (1) the target doesn't exist, or
+ # (2) the target is a redirect to the source, and has no history
+ # (so we can undo bad moves right after they're done).
+ if ( $this->newTitle->getArticleID() && !$this->isValidMoveTarget() ) {
+ $status->fatal( 'articleexists' );
+ }
+
// Content model checks
if ( !$wgContentHandlerUseDB &&
$this->oldTitle->getContentModel() !== $this->newTitle->getContentModel() ) {
protected function isValidFileMove() {
$status = new Status();
$file = wfLocalFile( $this->oldTitle );
+ $file->load( File::READ_LATEST );
if ( $file->exists() ) {
if ( $this->newTitle->getText() != wfStripIllegalFilenameChars( $this->newTitle->getText() ) ) {
$status->fatal( 'imageinvalidfilename' );
# Is it an existing file?
if ( $this->newTitle->inNamespace( NS_FILE ) ) {
$file = wfLocalFile( $this->newTitle );
+ $file->load( File::READ_LATEST );
if ( $file->exists() ) {
wfDebug( __METHOD__ . ": file exists\n" );
return false;
$dbw = wfGetDB( DB_MASTER );
if ( $this->oldTitle->getNamespace() == NS_FILE ) {
$file = wfLocalFile( $this->oldTitle );
+ $file->load( File::READ_LATEST );
if ( $file->exists() ) {
$status = $file->move( $this->newTitle );
if ( !$status->isOk() ) {