From bbe822603984795ce70c7e45eb47980709c84aa2 Mon Sep 17 00:00:00 2001 From: Catrope Date: Wed, 11 Apr 2012 23:10:11 -0700 Subject: [PATCH] (bug 35685) Add section with entry point URLs to Special:Version This'll make it easier for people to figure out where api.php is, and it should help debug bad settings for $wgArticlePath/$wgScriptPath too. Patchset 2: address review comments Patchset 3: rebased to fix conflict in RELEASE-NOTES-1.20 Patchset 4: [Sam] whitespace Patchset 5: moved down entry points list, fixed mw.org Manual: links Patchset 6: rebased for another RELEASE-NOTES-1.20 conflict Change-Id: I86eb84aca38abe214dfa3c3aeb3a9b6e586c8602 --- RELEASE-NOTES-1.20 | 2 ++ includes/specials/SpecialVersion.php | 36 ++++++++++++++++++++++++++++ languages/messages/MessagesEn.php | 8 +++++++ languages/messages/MessagesQqq.php | 8 +++++++ maintenance/language/messages.inc | 8 +++++++ 5 files changed, 62 insertions(+) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 9f9c380450..9722f48f30 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -42,6 +42,8 @@ production. repository viewer linked to from Special:Version. * Memcached debug logs can now be sent to their own file logs by setting $wgDebugLogFile['memcached'] to some filepath. +* (bug 35685) api.php URL and other entry point URLs are now listed on + Special:Version === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index d0e7ed99a4..2b4dc9555b 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -58,6 +58,7 @@ class SpecialVersion extends SpecialPage { $text = $this->getMediaWikiCredits() . $this->softwareInformation() . + $this->getEntryPointInfo() . $this->getExtensionCredits(); if ( $wgSpecialVersionShowHooks ) { $text .= $this->getWgHooks(); @@ -739,6 +740,41 @@ class SpecialVersion extends SpecialPage { return $repo->getHeadSHA1(); } + /** + * Get the list of entry points and their URLs + * @return string Wikitext + */ + public function getEntryPointInfo() { + global $wgArticlePath, $wgScriptPath; + $entryPoints = array( + 'version-entrypoints-articlepath' => $wgArticlePath, + 'version-entrypoints-scriptpath' => $wgScriptPath, + 'version-entrypoints-index-php' => wfScript( 'index' ), + 'version-entrypoints-api-php' => wfScript( 'api' ), + 'version-entrypoints-load-php' => wfScript( 'load' ), + ); + + $out = Html::element( 'h2', array( 'id' => 'mw-version-entrypoints' ), wfMsg( 'version-entrypoints' ) ) . + Html::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'mw-version-entrypoints-table' ) ) . + Html::openElement( 'tr' ) . + Html::element( 'th', array(), wfMessage( 'version-entrypoints-header-entrypoint' )->text() ) . + Html::element( 'th', array(), wfMessage( 'version-entrypoints-header-url' )->text() ) . + Html::closeElement( 'tr' ); + + foreach ( $entryPoints as $message => $value ) { + $url = wfExpandUrl( $value, PROTO_RELATIVE ); + $out .= Html::openElement( 'tr' ) . + // ->text() looks like it should be ->parse(), but this function + // returns wikitext, not HTML, boo + Html::rawElement( 'td', array(), wfMessage( $message )->text() ) . + Html::rawElement( 'td', array(), Html::rawElement( 'code', array(), "[$url $value]" ) ) . + Html::closeElement( 'tr' ); + } + + $out .= Html::closeElement( 'table' ); + return $out; + } + function showEasterEgg() { $rx = $rp = $xe = ''; $alpha = array("", "kbQW", "\$\n()"); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 01b8c14eef..cb43223455 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -4622,6 +4622,14 @@ You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU Gen 'version-software' => 'Installed software', 'version-software-product' => 'Product', 'version-software-version' => 'Version', +'version-entrypoints' => 'Entry point URLs', +'version-entrypoints-header-entrypoint' => 'Entry point', +'version-entrypoints-header-url' => 'URL', +'version-entrypoints-articlepath' => '[https://www.mediawiki.org/wiki/Manual:$wgArticlePath Article path]', +'version-entrypoints-scriptpath' => '[https://www.mediawiki.org/wiki/Manual:$wgScriptPath Script path]', +'version-entrypoints-index-php' => '[https://www.mediawiki.org/wiki/Manual:index.php index.php]', +'version-entrypoints-api-php' => '[https://www.mediawiki.org/wiki/Manual:api.php api.php]', +'version-entrypoints-load-php' => '[https://www.mediawiki.org/wiki/Manual:load.php load.php]', # Special:FilePath 'filepath' => 'File path', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 7f7e96743d..c36f707fee 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -4413,6 +4413,14 @@ This is being used in [[Special:Version]], preceeding the subversion revision nu 'version-license-info' => '[[wikipedia:GNU GPL|GNU GPL]] notice shown at [[Special:Version]]. See //www.gnu.org/licenses/old-licenses/gpl-2.0-translations.html for available translations.', 'version-software-product' => 'Shown in [[Special:Version]]', 'version-software-version' => '{{Identical|Version}}', +'version-entrypoints' => 'Header on [[Special:Version]] above a table that lists the URLs of various entry points in this MediaWiki installation.', +'version-entrypoints-header-entrypoint' => 'Header for the first column in the entry points table on [[Special:Version]].', +'version-entrypoints-header-url' => 'Header for the second column in the entry points table on [[Special:Version]].', +'version-entrypoints-articlepath' => 'A short description of the article path entry point. Links to the mediawiki.org documentation page for $wgArticlePath.', +'version-entrypoints-scriptpath' => 'A short description of the script path entry point. Links to the mediawiki.org documentation page for $wgScriptPath.', +'version-entrypoints-index-php' => 'A short description of the index.php entry point. Links to the mediawiki.org documentation page for index.php.', +'version-entrypoints-api-php' => 'A short description of the api.php entry point. Links to the mediawiki.org documentation page for api.php.', +'version-entrypoints-load-php' => 'A short description of the load.php entry point. Links to the mediawiki.org documentation page for load.php.', # Special:FilePath 'filepath' => 'Legend of fieldset around input box in [[Special:FilePath]].', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 40cfad3f90..0083f20386 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -3488,6 +3488,14 @@ $wgMessageStructure = array( 'version-software', 'version-software-product', 'version-software-version', + 'version-entrypoints', + 'version-entrypoints-header-entrypoint', + 'version-entrypoints-header-url', + 'version-entrypoints-articlepath', + 'version-entrypoints-scriptpath', + 'version-entrypoints-index-php', + 'version-entrypoints-api-php', + 'version-entrypoints-load-php', ), 'filepath' => array( 'filepath', -- 2.20.1