From b900efa97fda3ba056ac6915a3f6a3f32293dd8b Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 4 Nov 2006 05:24:59 +0000 Subject: [PATCH] API * version param now links to the SVN * debug case fixes * renamed ApiQueryContributions to ApiQueryUserContributions (a bit clearer) --- includes/AutoLoader.php | 2 +- includes/api/ApiBase.php | 12 +++++++++++- includes/api/ApiPageSet.php | 6 +++--- includes/api/ApiQueryBacklinks.php | 2 +- ...ntributions.php => ApiQueryUserContributions.php} | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) rename includes/api/{ApiQueryContributions.php => ApiQueryUserContributions.php} (98%) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 3232a0b66c..15fe3e79d1 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -256,7 +256,7 @@ function __autoload($className) { 'ApiQueryAllpages' => 'includes/api/ApiQueryAllpages.php', 'ApiQueryBase' => 'includes/api/ApiQueryBase.php', 'ApiQueryBacklinks' => 'includes/api/ApiQueryBacklinks.php', - 'ApiQueryContributions' => 'includes/api/ApiQueryContributions.php', + 'ApiQueryContributions' => 'includes/api/ApiQueryUserContributions.php', 'ApiQueryInfo' => 'includes/api/ApiQueryInfo.php', 'ApiQueryLogEvents' => 'includes/api/ApiQueryLogEvents.php', 'ApiQueryRecentChanges'=> 'includes/api/ApiQueryRecentChanges.php', diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 569845fb90..e12a256cda 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -150,8 +150,18 @@ abstract class ApiBase { if ($this->getMain()->getShowVersions()) { $versions = $this->getVersion(); - if (is_array($versions)) + $pattern = '(\$.*) ([0-9a-z_]+\.php) (.*\$)'; + $replacement = '\\0' . "\n " . 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/\\2'; + + if (is_array($versions)) { + $ver2 = array(); + foreach ($versions as &$v) + $v = eregi_replace($pattern, $replacement, $v); $versions = implode("\n ", $versions); + } + else + $versions = eregi_replace($pattern, $replacement, $versions); + $msg .= "Version:\n $versions\n"; } } diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index ef05465e90..b5424bbcf9 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -358,7 +358,7 @@ class ApiPageSet extends ApiQueryBase { */ private function initFromQueryResult($db, $res, &$remaining = null, $processTitles = null) { if (!is_null($remaining) && is_null($processTitles)) - ApiBase :: dieDebug('Missing $processTitles parameter when $remaining is provided'); + ApiBase :: dieDebug(__METHOD__, 'Missing $processTitles parameter when $remaining is provided'); while ($row = $db->fetchObject($res)) { @@ -431,7 +431,7 @@ class ApiPageSet extends ApiQueryBase { // Populate all the page information if($this->mResolveRedirects) - $this->dieDebug('revids may not be used with redirect resolution'); + ApiBase :: dieDebug(__METHOD__, 'revids may not be used with redirect resolution'); $this->initFromPageIds(array_keys($pageids)); } @@ -527,7 +527,7 @@ class ApiPageSet extends ApiQueryBase { // All IDs must exist in the page table if (!empty($this->mPendingRedirectIDs[$plfrom])) - $this->dieDebug('Invalid redirect IDs were found'); + ApiBase :: dieDebug(__METHOD__, 'Invalid redirect IDs were found'); return $linkBatch; } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 30228d4882..2c171f89b5 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -95,7 +95,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { extract($this->extractRequestParams()); if ($redirect) - $this->dieDebug('Redirect is not yet been implemented', 'notimplemented'); + ApiBase :: dieDebug(__METHOD__, 'Redirect is not yet been implemented', 'notimplemented'); $this->processContinue($continue, $redirect); diff --git a/includes/api/ApiQueryContributions.php b/includes/api/ApiQueryUserContributions.php similarity index 98% rename from includes/api/ApiQueryContributions.php rename to includes/api/ApiQueryUserContributions.php index 5bb880ae10..1d8ae69dc3 100644 --- a/includes/api/ApiQueryContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -166,7 +166,7 @@ class ApiQueryContributions extends ApiQueryBase { } public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryContributions.php 17335 2006-11-01 09:36:00Z Werdna $'; + return __CLASS__ . ': $Id$'; } } ?> -- 2.20.1