Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F585016
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/RELEASE-NOTES-1.44 b/RELEASE-NOTES-1.44
index 8c236d4b155..0c9d7633b35 100644
--- a/RELEASE-NOTES-1.44
+++ b/RELEASE-NOTES-1.44
@@ -685,6 +685,29 @@ because of Phabricator reports.
* The `moment` library is deprecated and consumers should explore using
alternatives. More information and support will be provided at
https://phabricator.wikimedia.org/T146798
+* Passing the wrong type or null as the various parameters to the public methods
+ of SiteConfiguration is now deprecated:
+ - SiteConfiguration::get
+ - Only pass a string to $settingName or $wiki
+ - Only pass null or a string to $site
+ - Only pass an array to $params or $wikiTags
+ - SiteConfiguration::getAll
+ - Only pass a string to $wiki
+ - Only pass null or a string to $site
+ - Only pass an array to $params or $wikiTags
+ - SiteConfiguration::getBool
+ - Only pass a string to $setting or $wiki
+ - Only pass null or a string to $site
+ - Only pass an array to $wikiTags
+ - SiteConfiguration::extractGlobalSetting
+ - Only pass a string to $setting or $wiki
+ - Only pass an array to $params
+ - SiteConfiguration::extractAllGlobals
+ - Only pass a string to $wiki
+ - Only pass null or a string to $site
+ - Only pass an array to $params or $wikiTags
+ - SiteConfiguration::siteFromDB
+ - Only pass a string to $wiki
* …
=== Other changes in 1.44 ===
diff --git a/includes/config/SiteConfiguration.php b/includes/config/SiteConfiguration.php
index e44907ac440..d8bf2d466ec 100644
--- a/includes/config/SiteConfiguration.php
+++ b/includes/config/SiteConfiguration.php
@@ -187,6 +187,29 @@ class SiteConfiguration {
$params = [],
$wikiTags = []
) {
+ if ( !is_string( $settingName ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $settingName', '1.44' );
+ $settingName = (string)$settingName;
+ }
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
+ if ( $site !== null && !is_string( $site ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $site', '1.44' );
+ $site = (string)$site;
+ }
+ if ( !is_array( $params ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $params', '1.44' );
+ $params = (array)$params;
+ }
+ if ( !is_array( $wikiTags ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $wikiTags', '1.44' );
+ $wikiTags = (array)$wikiTags;
+ }
$params = $this->mergeParams( $wiki, $site, $params, $wikiTags );
$overrides = $this->settings[$settingName] ?? null;
$value = $overrides ? $this->processSetting( $overrides, $wiki, $params['tags'] ) : null;
@@ -313,6 +336,25 @@ class SiteConfiguration {
* @return array Array of settings requested.
*/
public function getAll( $wiki, $site = null, $params = [], $wikiTags = [] ) {
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
+ if ( $site !== null && !is_string( $site ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $site', '1.44' );
+ $site = (string)$site;
+ }
+ if ( !is_array( $params ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $params', '1.44' );
+ $params = (array)$params;
+ }
+ if ( !is_array( $wikiTags ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $wikiTags', '1.44' );
+ $wikiTags = (array)$wikiTags;
+ }
$params = $this->mergeParams( $wiki, $site, $params, $wikiTags );
$tags = $params['tags'];
$localSettings = [];
@@ -354,6 +396,25 @@ class SiteConfiguration {
* @return bool The value of the setting requested.
*/
public function getBool( $setting, $wiki, $site = null, $wikiTags = [] ) {
+ if ( !is_string( $setting ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $setting', '1.44' );
+ $setting = (string)$setting;
+ }
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
+ if ( $site !== null && !is_string( $site ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $site', '1.44' );
+ $site = (string)$site;
+ }
+ if ( !is_array( $wikiTags ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $wikiTags', '1.44' );
+ $wikiTags = (array)$wikiTags;
+ }
return (bool)$this->get( $setting, $wiki, $site, [], $wikiTags );
}
@@ -372,6 +433,21 @@ class SiteConfiguration {
* @param array $params
*/
public function extractGlobalSetting( $setting, $wiki, $params ) {
+ if ( !is_string( $setting ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $setting', '1.44' );
+ $setting = (string)$setting;
+ }
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
+ if ( !is_array( $params ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $params', '1.44' );
+ $params = (array)$params;
+ }
$overrides = $this->settings[$setting] ?? null;
$value = $overrides ? $this->processSetting( $overrides, $wiki, $params['tags'] ) : null;
if ( !array_key_exists( '@replaceableSettings', $this->settings )
@@ -406,6 +482,25 @@ class SiteConfiguration {
$params = [],
$wikiTags = []
) {
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
+ if ( $site !== null && !is_string( $site ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $site', '1.44' );
+ $site = (string)$site;
+ }
+ if ( !is_array( $params ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $params', '1.44' );
+ $params = (array)$params;
+ }
+ if ( !is_array( $wikiTags ) ) {
+ wfDeprecated( __METHOD__ . ' with non-array $wikiTags', '1.44' );
+ $wikiTags = (array)$wikiTags;
+ }
$params = $this->mergeParams( $wiki, $site, $params, $wikiTags );
foreach ( $this->settings as $varName => $setting ) {
$this->extractGlobalSetting( $varName, $wiki, $params );
@@ -500,6 +595,13 @@ class SiteConfiguration {
* @return array [ string|null $site, string|null $languageCode ]
*/
public function siteFromDB( $wiki ) {
+ if ( $wiki === null ) {
+ wfDeprecated( __METHOD__ . ' with null $wiki', '1.44' );
+ }
+ if ( !is_string( $wiki ) ) {
+ wfDeprecated( __METHOD__ . ' with non-string $wiki', '1.44' );
+ }
+ $wiki = (string)$wiki;
// Allow override
$def = $this->getWikiParams( $wiki );
if ( $def['suffix'] !== null && $def['lang'] !== null ) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:31 AM (14 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227471
Default Alt Text
(6 KB)
Attached To
Mode
rMW mediawiki
Attached
Detach File
Event Timeline
Log In to Comment