r38247 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38246‎ | r38247 | r38248 >
Date:19:45, 30 July 2008
Author:brion
Status:old
Tags:
Comment:
Revert r38221, 38238 -- "Add new parser function {{apiurl}}. Also, add new global $wgApiScript because manually constructing the api script's path seemed like a bad idea."

I don't really like this in general; the API isn't meant for the UI and there should be little to no call to link to it from body content.

Additionally, I believe we're trying to move all new parser functions to the convention of using the # prefix to avoid conflict with the template namespace.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -25,7 +25,6 @@
2626 $parser->setFunctionHook( 'localurle', array( __CLASS__, 'localurle' ), SFH_NO_HASH );
2727 $parser->setFunctionHook( 'fullurl', array( __CLASS__, 'fullurl' ), SFH_NO_HASH );
2828 $parser->setFunctionHook( 'fullurle', array( __CLASS__, 'fullurle' ), SFH_NO_HASH );
29 - $parser->setFunctionHook( 'apiurl', array( __CLASS__, 'apiurl' ), SFH_NO_HASH );
3029 $parser->setFunctionHook( 'formatnum', array( __CLASS__, 'formatnum' ), SFH_NO_HASH );
3130 $parser->setFunctionHook( 'grammar', array( __CLASS__, 'grammar' ), SFH_NO_HASH );
3231 $parser->setFunctionHook( 'plural', array( __CLASS__, 'plural' ), SFH_NO_HASH );
@@ -120,19 +119,6 @@
121120 static function localurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeLocalURL', $s, $arg ); }
122121 static function fullurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getFullURL', $s, $arg ); }
123122 static function fullurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeFullURL', $s, $arg ); }
124 - static function apiurl( $parser, $s = '', $arg = null ) {
125 - global $wgEnableAPI;
126 - # Don't bother linking to the API if they can't use it.
127 - if ( $wgEnableAPI === false ) {
128 - return array( 'found' => false );
129 - }
130 - global $wgServer, $wgApiScript;
131 - $path = $wgServer . $wgApiScript . '?action=' . $s;
132 - if ( !is_null($arg ) ) {
133 - $path .= '&' . $arg;
134 - }
135 - return $path;
136 - }
137123
138124 static function urlFunction( $func, $s = '', $arg = null ) {
139125 $title = Title::newFromText( $s );
Index: trunk/phase3/includes/Setup.php
@@ -53,7 +53,6 @@
5454
5555 if( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
5656 if( $wgFileCacheDirectory === false ) $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
57 -if( $wgApiScript == false ) $wgApiScript = "$wgScriptPath/api$wgScriptExtension";
5857
5958 if ( empty( $wgFileStore['deleted']['directory'] ) ) {
6059 $wgFileStore['deleted']['directory'] = "{$wgUploadDirectory}/deleted";
Index: trunk/phase3/includes/DefaultSettings.php
@@ -166,7 +166,6 @@
167167 $wgMathDirectory = false; ///< defaults to "{$wgUploadDirectory}/math"
168168 $wgTmpDirectory = false; ///< defaults to "{$wgUploadDirectory}/tmp"
169169 $wgUploadBaseUrl = "";
170 -$wgApiScript = false; ///< defaults to "{$wgScriptPath}/api{$wgScriptExtension}"
171170 /**@}*/
172171
173172 /**
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -312,7 +312,6 @@
313313 'plural' => array( 0, 'PLURAL:' ),
314314 'fullurl' => array( 0, 'FULLURL:' ),
315315 'fullurle' => array( 0, 'FULLURLE:' ),
316 - 'apiurl' => array( 0, 'APIURL:' ),
317316 'lcfirst' => array( 0, 'LCFIRST:' ),
318317 'ucfirst' => array( 0, 'UCFIRST:' ),
319318 'lc' => array( 0, 'LC:' ),
Index: trunk/phase3/RELEASE-NOTES
@@ -25,9 +25,6 @@
2626 empt all content namespaces.)
2727 * $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4
2828 has been $wgSearchForwardUrl.
29 -* $wgApiScript can now be defined if your API isn't named api.php or it's not
30 - in the usual location. Setting to false defaults to "$wgScriptPath/api
31 - $wgScriptExtension".
3229
3330 === New features in 1.14 ===
3431
@@ -39,8 +36,6 @@
4037 'EditSectionLinkForOther' hook has been removed, but 'EditSectionLink' is
4138 run in all cases instead, so extensions using the old hooks should still work
4239 if they ran roughly the same code for both hooks (as is almost certain).
43 -* New parser function {{apiurl:}} links to the local API. {{apiurl:help}} would
44 - link to action=help. Other params are passed as well.
4540
4641 === Bug fixes in 1.14 ===
4742

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r38221Add new parser function {{apiurl}}. Also, add new global $wgApiScript because...demon07:46, 30 July 2008

Status & tagging log