From 4e567efa64cb396503c5d9250d48c23a8f18f85d Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Fri, 16 Feb 2018 14:03:44 -0800 Subject: [PATCH] Remove $wgScriptExtension (deprecated and ignored since 1.25) * Remove left-over mention of the .php5 entry points in docs. * Remove dead logic in NoLocalSettings for php5 entry points. * Remove dead match in WebRequest for php5 entry points (they'd redirect since 1.25, and not seen by PHP). Change-Id: Ia0ee8588591860b8fe34030c8503f38e9bce31f3 (cherry picked from commit de6dab71e3ea0166095b6c6e3837255d1e56b887) --- RELEASE-NOTES-1.31 | 2 ++ docs/scripts.txt | 6 +----- includes/DefaultSettings.php | 18 +----------------- includes/NoLocalSettings.php | 5 +---- includes/Setup.php | 1 - includes/WebRequest.php | 2 +- includes/filerepo/FileRepo.php | 12 +++--------- .../ResourceLoaderStartUpModule.php | 1 - includes/templates/NoLocalSettings.mustache | 6 +++--- tests/phpunit/ResourceLoaderTestCase.php | 1 - 10 files changed, 12 insertions(+), 42 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index b7c4c54c03..97b8f432e1 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -37,6 +37,8 @@ production. set $wgTidyConfig to null and also set $wgUseTidy to true. * $wgLogAutopatrol now defaults to false instead of true. * $wgValidateAllHtml was removed and will be ignored. +* $wgScriptExtension was removed (deprecated and ignored since 1.25). + See 1.25 release notes for more information. === New features in 1.31 === * (T76554) User sub-pages named ….json are now protected in the same way that ….js diff --git a/docs/scripts.txt b/docs/scripts.txt index 53dff36e42..dff428c5a2 100644 --- a/docs/scripts.txt +++ b/docs/scripts.txt @@ -39,14 +39,10 @@ Primary scripts: maintenance/archives/patch-profiling.sql patch to the database. To enable the profileinfo.php itself, you'll need to set $wgDBadminuser - and $wgDBadminpassword in your LocalSettings.php, as well as $wgEnableProfileInfo + and $wgDBadminpassword in your LocalSettings.php, as well as $wgEnableProfileInfo See also https://www.mediawiki.org/wiki/Manual:Profiling . thumb.php Script used to resize images if it is configured to be done when the web browser requests the image and not when generating the page. This script can be used as a 404 handler to generate image thumbs when they don't exist. - -There is also a file with a .php5 extension for each script. They can be used if -the web server needs a .php5 to run the file with the PHP 5 engine and runs .php -scripts with PHP 4. You should not use them anymore. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3f633a3947..9922410c55 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -157,19 +157,6 @@ $wgUsePathInfo = ( strpos( PHP_SAPI, 'cgi' ) === false ) && ( strpos( PHP_SAPI, 'apache2filter' ) === false ) && ( strpos( PHP_SAPI, 'isapi' ) === false ); -/** - * The extension to append to script names by default. - * - * Some hosting providers used PHP 4 for *.php files, and PHP 5 for *.php5. - * This variable was provided to support those providers. - * - * @since 1.11 - * @deprecated since 1.25; support for '.php5' has been phased out of MediaWiki - * proper. Backward-compatibility can be maintained by configuring your web - * server to rewrite URLs. See RELEASE-NOTES for details. - */ -$wgScriptExtension = '.php'; - /**@}*/ /************************************************************************//** @@ -503,9 +490,6 @@ $wgImgAuthUrlPathMap = []; * - descBaseUrl URL of image description pages, e.g. https://en.wikipedia.org/wiki/File: * - scriptDirUrl URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g. * https://en.wikipedia.org/w - * - scriptExtension Script extension of the MediaWiki installation, equivalent to - * $wgScriptExtension, e.g. ".php5". Defaults to ".php". - * * - articleUrl Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 * - fetchDescription Fetch the text of the remote file description page. Equivalent to * $wgFetchCommonsDescriptions. @@ -8251,7 +8235,7 @@ $wgMaxShellWallClockTime = 180; $wgShellCgroup = false; /** - * Executable path of the PHP cli binary (php/php5). Should be set up on install. + * Executable path of the PHP cli binary. Should be set up on install. */ $wgPhpCli = '/usr/bin/php'; diff --git a/includes/NoLocalSettings.php b/includes/NoLocalSettings.php index b8bfd6a4f0..46e9630f34 100644 --- a/includes/NoLocalSettings.php +++ b/includes/NoLocalSettings.php @@ -22,13 +22,11 @@ # T32219 : can not use pathinfo() on URLs since slashes do not match $matches = []; -$ext = 'php'; $path = '/'; foreach ( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) { - if ( !preg_match( '/\.(php5?)$/', $part, $matches ) ) { + if ( !preg_match( '/\.(php)$/', $part, $matches ) ) { $path .= "$part/"; } else { - $ext = $matches[1] == 'php5' ? 'php5' : 'php'; break; } } @@ -56,7 +54,6 @@ try { [ 'wgVersion' => ( isset( $wgVersion ) ? $wgVersion : 'VERSION' ), 'path' => $path, - 'ext' => $ext, 'localSettingsExists' => file_exists( MW_CONFIG_FILE ), 'installerStarted' => $installerStarted ] diff --git a/includes/Setup.php b/includes/Setup.php index cc6915a74b..f4025945eb 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -280,7 +280,6 @@ if ( !$wgLocalFileRepo ) { 'name' => 'local', 'directory' => $wgUploadDirectory, 'scriptDirUrl' => $wgScriptPath, - 'scriptExtension' => '.php', 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath, 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0, 'thumbScriptUrl' => $wgThumbnailScriptPath, diff --git a/includes/WebRequest.php b/includes/WebRequest.php index fa8f84d697..c6ddf81697 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -141,7 +141,7 @@ class WebRequest { $router->add( "$wgScript/$1" ); if ( isset( $_SERVER['SCRIPT_NAME'] ) - && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) + && preg_match( '/\.php/', $_SERVER['SCRIPT_NAME'] ) ) { # Check for SCRIPT_NAME, we handle index.php explicitly # But we do have some other .php files such as img_auth.php diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index e430bc8f43..a67e3d6427 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -78,10 +78,6 @@ class FileRepo { */ protected $scriptDirUrl; - /** @var string Script extension of the MediaWiki installation, equivalent - * to the old $wgScriptExtension, e.g. .php5 defaults to .php */ - protected $scriptExtension; - /** @var string Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 */ protected $articleUrl; @@ -166,7 +162,7 @@ class FileRepo { $optionalSettings = [ 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription', 'thumbScriptUrl', 'pathDisclosureProtection', 'descriptionCacheExpiry', - 'scriptExtension', 'favicon', 'thumbProxyUrl', 'thumbProxySecret' + 'favicon', 'thumbProxyUrl', 'thumbProxySecret', ]; foreach ( $optionalSettings as $var ) { if ( isset( $info[$var] ) ) { @@ -744,9 +740,7 @@ class FileRepo { */ public function makeUrl( $query = '', $entry = 'index' ) { if ( isset( $this->scriptDirUrl ) ) { - $ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php'; - - return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query ); + return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}.php", $query ); } return false; @@ -1928,7 +1922,7 @@ class FileRepo { $optionalSettings = [ 'url', 'thumbUrl', 'initialCapital', 'descBaseUrl', 'scriptDirUrl', 'articleUrl', - 'fetchDescription', 'descriptionCacheExpiry', 'scriptExtension', 'favicon' + 'fetchDescription', 'descriptionCacheExpiry', 'favicon' ]; foreach ( $optionalSettings as $k ) { if ( isset( $this->$k ) ) { diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 681e8dc005..56d88358fe 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -88,7 +88,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get( 'ArticlePath' ), 'wgScriptPath' => $conf->get( 'ScriptPath' ), - 'wgScriptExtension' => '.php', 'wgScript' => wfScript(), 'wgSearchType' => $conf->get( 'SearchType' ), 'wgVariantArticlePath' => $conf->get( 'VariantArticlePath' ), diff --git a/includes/templates/NoLocalSettings.mustache b/includes/templates/NoLocalSettings.mustache index 545794919e..36391f5bfd 100644 --- a/includes/templates/NoLocalSettings.mustache +++ b/includes/templates/NoLocalSettings.mustache @@ -28,12 +28,12 @@ {{^localSettingsExists}}

LocalSettings.php not found.

{{#installerStarted}} -

Please complete the installation and download LocalSettings.php.

+

Please complete the installation and download LocalSettings.php.

{{/installerStarted}} {{^installerStarted}} -

Please set up the wiki first.

+

Please set up the wiki first.

{{/installerStarted}} {{/localSettingsExists}} - \ No newline at end of file + diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index 514150c755..d5c14a2558 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -61,7 +61,6 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { // For wfScript() 'ScriptPath' => '/w', - 'ScriptExtension' => '.php', 'Script' => '/w/index.php', 'LoadScript' => '/w/load.php', ]; -- 2.20.1