return $errors ?: true;
}
- /**
- * Check if the requested move target is a valid file move target
- * @todo move this to MovePage
- * @param Title $nt Target title
- * @return array List of errors
- */
- protected function validateFileMoveOperation( $nt ) {
- global $wgUser;
-
- $errors = [];
-
- $destFile = wfLocalFile( $nt );
- $destFile->load( File::READ_LATEST );
- if ( !$wgUser->isAllowed( 'reupload-shared' )
- && !$destFile->exists() && wfFindFile( $nt )
- ) {
- $errors[] = [ 'file-exists-sharedrepo' ];
- }
-
- return $errors;
- }
-
/**
* Move a title to a new location
*
* @param array|string|bool $expected Required error
* @dataProvider provideTestIsValidMoveOperation
* @covers Title::isValidMoveOperation
- * @covers Title::validateFileMoveOperation
*/
public function testIsValidMoveOperation( $source, $target, $expected ) {
$this->setMwGlobals( 'wgContentHandlerUseDB', false );
[ 'Test', 'Special:FooBar', 'immobile-target-namespace' ],
[ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ],
[ 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ],
- // for Title::validateFileMoveOperation
[ 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ],
];
}