aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerick Alangi <alangiderick@gmail.com>2024-03-18 12:43:26 +0300
committerDerick Alangi <alangiderick@gmail.com>2024-03-18 12:54:18 +0300
commitcdd6a026f9bd89cfefa0f80ddaac38b5f1a5b732 (patch)
treeddba051910e7a2e56cdcc010b3b2ed99f4f638e9
parent7f9a5b6858259cb645a31e2162c9d6f64fcee836 (diff)
downloadmediawikicore-cdd6a026f9bd89cfefa0f80ddaac38b5f1a5b732.tar.gz
mediawikicore-cdd6a026f9bd89cfefa0f80ddaac38b5f1a5b732.zip
config: Drop `SiteConfiguration::getConfig()`
This patch deletes the `::getConfig()` method in the SiteConfiguration class. It's no longer used and due for removal. Bug: T289543 Change-Id: Ie94b95feb7fd0885b7c224533868e654453071cd
-rw-r--r--RELEASE-NOTES-1.421
-rw-r--r--includes/config/SiteConfiguration.php70
2 files changed, 1 insertions, 70 deletions
diff --git a/RELEASE-NOTES-1.42 b/RELEASE-NOTES-1.42
index f2ee236e636e..d81ca4abea9e 100644
--- a/RELEASE-NOTES-1.42
+++ b/RELEASE-NOTES-1.42
@@ -186,6 +186,7 @@ because of Phabricator reports.
have been removed.
* TitleArray, deprecated since 1.41, has been removed.
* UserRightsProxy, deprecated since 1.38, has been removed.
+* SiteConfiguration::getConfig(), deprecated in 1.41, has been removed.
* UserLoginCompleteHook is always called with its $direct parameter set to
boolean true. The false case has been removed.
* MagicWord::load() has been marked @internal and may change in the future
diff --git a/includes/config/SiteConfiguration.php b/includes/config/SiteConfiguration.php
index 2ef4b65106da..c817968d95be 100644
--- a/includes/config/SiteConfiguration.php
+++ b/includes/config/SiteConfiguration.php
@@ -20,10 +20,6 @@
namespace MediaWiki\Config;
-use MediaWiki\Shell\Shell;
-use MediaWiki\WikiMap\WikiMap;
-use RuntimeException;
-
/**
* Configuration holder, particularly for multi-wiki sites.
*
@@ -576,72 +572,6 @@ class SiteConfiguration {
}
/**
- * Get the resolved (post-setup) configuration of a potentially foreign wiki.
- * For foreign wikis, this is expensive, and only works if maintenance
- * scripts are setup to handle the --wiki parameter such as in wiki farms.
- *
- * @deprecated since 1.41. Use SiteConfiguration::get() instead.
- *
- * @param string $wiki
- * @param string|string[] $settings A setting name or array of setting names
- * @return mixed|mixed[] Array if $settings is an array, otherwise the value
- * @since 1.21
- */
- public function getConfig( $wiki, $settings ) {
- wfDeprecated( __METHOD__, '1.41' );
- $multi = is_array( $settings );
- $settings = (array)$settings;
- if ( WikiMap::isCurrentWikiId( $wiki ) ) { // $wiki is this wiki
- $res = [];
- foreach ( $settings as $name ) {
- if ( !preg_match( '/^wg[A-Z]/', $name ) ) {
- throw new ConfigException( "Variable '$name' does start with 'wg'." );
- } elseif ( !isset( $GLOBALS[$name] ) ) {
- throw new ConfigException( "Variable '$name' is not set." );
- }
- $res[$name] = $GLOBALS[$name];
- }
- } else { // $wiki is a foreign wiki
- if ( isset( $this->cfgCache[$wiki] ) ) {
- $res = array_intersect_key(
- $this->cfgCache[$wiki],
- array_fill_keys( $settings, true )
- );
- if ( count( $res ) == count( $settings ) ) {
- return $multi ? $res : current( $res ); // cache hit
- }
- } elseif ( !in_array( $wiki, $this->wikis ) ) {
- throw new ConfigException( "No such wiki '$wiki'." );
- } else {
- $this->cfgCache[$wiki] = [];
- }
- $result = Shell::makeScriptCommand(
- 'getConfiguration',
- [
- '--wiki', $wiki,
- '--settings', implode( ' ', $settings ),
- '--format', 'PHP',
- ]
- )
- // limit.sh breaks this call
- ->limits( [ 'memory' => 0, 'filesize' => 0 ] )
- ->execute();
-
- $data = trim( $result->getStdout() );
- if ( $result->getExitCode() || $data === '' ) {
- throw new RuntimeException( "Failed to run getConfiguration.php: {$result->getStderr()}" );
- }
- $res = unserialize( $data );
- if ( !is_array( $res ) ) {
- throw new RuntimeException( "Failed to unserialize configuration array." );
- }
- $this->cfgCache[$wiki] += $res;
- }
-
- return $multi ? $res : current( $res );
- }
-
- /**
* Merge multiple arrays together.
* On encountering duplicate keys, merge the two, but ONLY if they're arrays.
* PHP's array_merge_recursive() merges ANY duplicate values into arrays,