diff --git a/RELEASE-NOTES-1.35 b/RELEASE-NOTES-1.35 index e7a19e6a1c6..c26f72e52a3 100644 --- a/RELEASE-NOTES-1.35 +++ b/RELEASE-NOTES-1.35 @@ -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 ==== diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e48002272b5..5d69c346364 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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; diff --git a/includes/title/NamespaceInfo.php b/includes/title/NamespaceInfo.php index 92fb99802cc..b865dff0041 100644 --- a/includes/title/NamespaceInfo.php +++ b/includes/title/NamespaceInfo.php @@ -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' ) ); diff --git a/tests/phpunit/includes/title/NamespaceInfoTest.php b/tests/phpunit/includes/title/NamespaceInfoTest.php index 810f054cdc3..bf93d9b581f 100644 --- a/tests/phpunit/includes/title/NamespaceInfoTest.php +++ b/tests/phpunit/includes/title/NamespaceInfoTest.php @@ -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 ) ); }