r106521 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106520‎ | r106521 | r106522 >
Date:19:10, 17 December 2011
Author:reedy
Status:reverted (Comments)
Tags:
Comment:
More example conversions/additions

Ping r106439
Modified paths:
  • /trunk/phase3/includes/api/ApiComparePages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiDelete.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEmailUser.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFileRevert.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiHelp.php (modified) (history)
  • /trunk/phase3/includes/api/ApiImport.php (modified) (history)
  • /trunk/phase3/includes/api/ApiLogout.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPurge.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiComparePages.php
@@ -120,7 +120,7 @@
121121
122122 public function getExamples() {
123123 return array(
124 - 'api.php?action=compare&fromrev=1&torev=2',
 124+ 'api.php?action=compare&fromrev=1&torev=2' => 'Creates a diff between revision 1 and 2',
125125 );
126126 }
127127
Index: trunk/phase3/includes/api/ApiFileRevert.php
@@ -171,8 +171,8 @@
172172
173173 public function getExamples() {
174174 return array(
175 - 'Revert Wiki.png to the version of 20110305152740:',
176 - ' api.php?action=filerevert&filename=Wiki.png&comment=Revert&archivename=20110305152740!Wiki.png&token=+\\',
 175+ 'api.php?action=filerevert&filename=Wiki.png&comment=Revert&archivename=20110305152740!Wiki.png&token=+\\'
 176+ => 'Revert Wiki.png to the version of 20110305152740',
177177 );
178178 }
179179
Index: trunk/phase3/includes/api/ApiLogout.php
@@ -64,7 +64,7 @@
6565
6666 public function getExamples() {
6767 return array(
68 - 'api.php?action=logout'
 68+ 'api.php?action=logout' => 'Logs the current user out',
6969 );
7070 }
7171
Index: trunk/phase3/includes/api/ApiPurge.php
@@ -149,7 +149,7 @@
150150
151151 public function getExamples() {
152152 return array(
153 - 'api.php?action=purge&titles=Main_Page|API'
 153+ 'api.php?action=purge&titles=Main_Page|API' => 'Purges the "Main Page" and the "API" page',
154154 );
155155 }
156156
Index: trunk/phase3/includes/api/ApiDelete.php
@@ -268,8 +268,8 @@
269269
270270 public function getExamples() {
271271 return array(
272 - 'api.php?action=delete&title=Main%20Page&token=123ABC',
273 - 'api.php?action=delete&title=Main%20Page&token=123ABC&reason=Preparing%20for%20move'
 272+ 'api.php?action=delete&title=Main%20Page&token=123ABC' => 'Deletes the Main Page',
 273+ 'api.php?action=delete&title=Main%20Page&token=123ABC&reason=Preparing%20for%20move' => 'Deletes the Main Page with the reason "Preparing for move"',
274274 );
275275 }
276276
Index: trunk/phase3/includes/api/ApiImport.php
@@ -154,8 +154,8 @@
155155
156156 public function getExamples() {
157157 return array(
158 - 'Import [[meta:Help:Parserfunctions]] to namespace 100 with full history:',
159 - ' api.php?action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&namespace=100&fullhistory=&token=123ABC',
 158+ 'api.php?action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&namespace=100&fullhistory=&token=123ABC'
 159+ => 'Import [[meta:Help:Parserfunctions]] to namespace 100 with full history',
160160 );
161161 }
162162
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -493,12 +493,14 @@
494494
495495 public function getExamples() {
496496 return array(
497 - 'Edit a page (anonymous user):',
498 - ' api.php?action=edit&title=Test&summary=test%20summary&text=article%20content&basetimestamp=20070824123454&token=%2B\\',
499 - 'Prepend __NOTOC__ to a page (anonymous user):',
500 - ' api.php?action=edit&title=Test&summary=NOTOC&minor=&prependtext=__NOTOC__%0A&basetimestamp=20070824123454&token=%2B\\',
501 - 'Undo r13579 through r13585 with autosummary (anonymous user):',
502 - ' api.php?action=edit&title=Test&undo=13585&undoafter=13579&basetimestamp=20070824123454&token=%2B\\',
 497+
 498+ 'api.php?action=edit&title=Test&summary=test%20summary&text=article%20content&basetimestamp=20070824123454&token=%2B\\'
 499+ => 'Edit a page (anonymous user)',
 500+
 501+ 'api.php?action=edit&title=Test&summary=NOTOC&minor=&prependtext=__NOTOC__%0A&basetimestamp=20070824123454&token=%2B\\'
 502+ => 'Prepend __NOTOC__ to a page (anonymous user)',
 503+ 'api.php?action=edit&title=Test&undo=13585&undoafter=13579&basetimestamp=20070824123454&token=%2B\\'
 504+ => 'Undo r13579 through r13585 with autosummary (anonymous user)',
503505 );
504506 }
505507
Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -286,7 +286,10 @@
287287 }
288288
289289 public function getExamples() {
290 - return 'api.php?action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName();
 290+ return array(
 291+ 'api.php?action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName()
 292+ => "Formats the query result in the {$this->getModuleName()} format",
 293+ );
291294 }
292295
293296 public function getHelpUrls() {
Index: trunk/phase3/includes/api/ApiEmailUser.php
@@ -133,7 +133,7 @@
134134
135135 public function getExamples() {
136136 return array(
137 - 'api.php?action=emailuser&target=WikiSysop&text=Content'
 137+ 'api.php?action=emailuser&target=WikiSysop&text=Content' => 'Sends an email to the User "WikiSysop" with the text "Content"',
138138 );
139139 }
140140
Index: trunk/phase3/includes/api/ApiHelp.php
@@ -136,16 +136,11 @@
137137
138138 public function getExamples() {
139139 return array(
140 - 'Whole help page:',
141 - ' api.php?action=help',
142 - 'Module (action) help page:',
143 - ' api.php?action=help&modules=protect',
144 - 'Query (list) modules help page:',
145 - ' api.php?action=help&querymodules=categorymembers',
146 - 'Query (prop) modules help page:',
147 - ' api.php?action=help&querymodules=info',
148 - 'Query (meta) modules help page:',
149 - ' api.php?action=help&querymodules=siteinfo',
 140+ 'api.php?action=help' => 'Whole help page',
 141+ 'api.php?action=help&modules=protect' => 'Module (action) help page',
 142+ 'api.php?action=help&querymodules=categorymembers' => 'Query (list) modules help page',
 143+ 'api.php?action=help&querymodules=info' => 'Query (prop) modules help page',
 144+ 'api.php?action=help&querymodules=siteinfo' => 'Query (meta) modules help page',
150145 );
151146 }
152147
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -646,10 +646,10 @@
647647
648648 public function getExamples() {
649649 return array(
650 - 'Upload from a URL:',
651 - ' api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png',
652 - 'Complete an upload that failed due to warnings:',
653 - ' api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1',
 650+ 'api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
 651+ => 'Upload from a URL',
 652+ 'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1'
 653+ => 'Complete an upload that failed due to warnings',
654654 );
655655 }
656656

Follow-up revisions

RevisionCommit summaryAuthorDate
r106865Revert r106521: creates lots of long, unwrappable lines in help outputbrion21:26, 20 December 2011
r106870For r106521/r106865, wrap long example description strings...reedy21:37, 20 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106439Prep work for * (bug 33147) API examples should explain what they do...reedy15:28, 16 December 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:27, 20 December 2011

Reverted in r106865: creates lots of long, unwrappable lines in help output

#Comment by Reedy (talk | contribs)   21:29, 20 December 2011

Then we should add wrapping code like we do for the list of classes, using wordwrap at 100 characters or so

It's to make the output of the examples more programatically readable. In this case it's for the ApiSandbox

Status & tagging log