r99611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99610‎ | r99611 | r99612 >
Date:00:40, 12 October 2011
Author:kaldari
Status:deferred (Comments)
Tags:
Comment:
adding API, cant use action as an API param twice
Modified paths:
  • /trunk/extensions/PageTriage/PageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/api/ApiQueryPageTriage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/api/ApiQueryPageTriage.php
@@ -39,7 +39,7 @@
4040 $userId = $context->getUser()->getId();
4141
4242 $params = $this->extractRequestParams();
43 - $action = $params['action'];
 43+ $mode = $params['mode'];
4444
4545 if( !preg_match('/^\D+$/', $params['id'] ) ) {
4646 $this->dieUsageMsg( array( 'pagetriage-api-invalidid', $params['id'] ) );
@@ -57,7 +57,7 @@
5858
5959 $res = $this->getResult();
6060
61 - if( $action === 'checkout' ) {
 61+ if( $mode === 'checkout' ) {
6262 // the unique index on ptc_recentchanges_id ensures that this will fail if there's an existing row.
6363 // doing it this way allows for atomic checking w/o starting a transaction.
6464 //
@@ -82,7 +82,7 @@
8383 } else {
8484 $res->addValue( 'pagetriage', 'result', 'already-checked-out' );
8585 }
86 - } elseif ( $action === 'checkin' ) {
 86+ } elseif ( $mode === 'checkin' ) {
8787 // delete this user's row, if any.
8888 $dbw->delete(
8989 'pagetriage_checkouts',
@@ -102,7 +102,7 @@
103103 'id' => array(
104104 ApiBase::PARAM_REQUIRED => true,
105105 ),
106 - 'action' => array(
 106+ 'mode' => array(
107107 ApiBase::PARAM_DFLT => 'checkout',
108108 ApiBase::PARAM_ISMULTI => false,
109109 ApiBase::PARAM_TYPE => array(
@@ -115,7 +115,7 @@
116116 public function getParamDescription() {
117117 return array(
118118 'id' => 'The ID of the recentchanges entry you\'d like to check out/in',
119 - 'action' => 'What you\'d like to do',
 119+ 'mode' => 'What you\'d like to do',
120120 );
121121 }
122122
@@ -125,8 +125,8 @@
126126
127127 public function getExamples() {
128128 return array(
129 - 'api.php?action=pagetriage&ptrid=12345',
130 - 'api.php?action=pagetriage&ptrid=12345&action=checkin',
 129+ 'api.php?action=pagetriage&id=12345',
 130+ 'api.php?action=pagetriage&id=12345&mode=checkin',
131131 );
132132 }
133133
Index: trunk/extensions/PageTriage/PageTriage.php
@@ -32,6 +32,11 @@
3333 $wgSpecialPages['PageTriageList'] = 'SpecialPageTriageList';
3434 $wgSpecialPageGroups['PageTriageList'] = 'changes';
3535
 36+$wgAutoloadClasses['ApiWikiLove'] = $dir . 'api/ApiWikiLove.php';
 37+
 38+// api modules
 39+$wgAPIModules['pagetriage'] = 'ApiQueryPageTriage';
 40+
3641 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efPageTriageSchemaUpdates';
3742
3843 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r99617some clean-up/fixes and more JS codekaldari01:59, 12 October 2011

Comments

#Comment by Kaldari (talk | contribs)   01:59, 12 October 2011

+$wgAutoloadClasses['ApiWikiLove'] = $dir . 'api/ApiWikiLove.php';

#Comment by Kaldari (talk | contribs)   02:00, 12 October 2011

... is fixed in r99617. Can you tell I'm writing this in a hurry :)

Status & tagging log