Merge "Deprecate setting $wgAllowImageMoving to false"

This commit is contained in:
jenkins-bot 2020-06-09 00:35:04 +00:00 committed by Gerrit Code Review
commit eafe225ed8
4 changed files with 15 additions and 0 deletions

View file

@ -118,6 +118,9 @@ For notes on 1.34.x and older releases, see HISTORY.
Configure the ParserFactory service in order to customize the Parser used.
* $wgAutoloadAttemptLowercase has been deprecated and the default value changed
to false.
* $wgAllowImageMoving - This configuration is now deprecated. Use
$wgGroupPermissions instead; eg, to revoke sysop's ability to move images use
$wgGroupPermissions['sysop']['movefile'] = false.
* …
==== Removed configuration ====

View file

@ -448,6 +448,10 @@ $wgUploadStashMaxAge = 6 * 3600; // 6 hours
/**
* Allows to move images and other media files
*
* @deprecated since 1.35, use group permission settings instead.
* (eg $wgGroupPermissions['sysop']['movefile'] = false; to revoke the
* ability from sysops)
*/
$wgAllowImageMoving = true;

View file

@ -154,6 +154,10 @@ class NamespaceInfo {
* @return bool
*/
public function isMovable( $index ) {
if ( !$this->options->get( 'AllowImageMoving' ) ) {
wfDeprecated( 'Setting $wgAllowImageMoving to false', '1.35' );
}
$result = $index >= NS_MAIN &&
( $index != NS_FILE || $this->options->get( 'AllowImageMoving' ) );

View file

@ -122,6 +122,10 @@ class NamespaceInfoTest extends MediaWikiTestCase {
* @param bool $allowImageMoving
*/
public function testIsMovable( $expected, $ns, $allowImageMoving = true ) {
if ( $allowImageMoving === false ) {
$this->hideDeprecated( 'Setting $wgAllowImageMoving to false' );
}
$obj = $this->newObj( [ 'AllowImageMoving' => $allowImageMoving ] );
$this->assertSame( $expected, $obj->isMovable( $ns ) );
}