Index: trunk/extensions/ClickTracking/ClickTracking.hooks.php |
— | — | @@ -91,7 +91,6 @@ |
92 | 92 | return true; |
93 | 93 | } |
94 | 94 | |
95 | | - |
96 | 95 | //adds a bucket-testing campaign to the active campaigns |
97 | 96 | public static function addCampaign($localBasePath, $remoteExtPath, $name ){ |
98 | 97 | global $wgResourceModules; |
— | — | @@ -108,9 +107,7 @@ |
109 | 108 | ( array ) $wgResourceModules['ext.UserBuckets']['dependencies'], |
110 | 109 | array("ext.UserBuckets.$name")); |
111 | 110 | } |
112 | | - |
113 | | - |
114 | | - |
| 111 | + |
115 | 112 | /** |
116 | 113 | * Get event ID from name |
117 | 114 | * |
— | — | @@ -140,9 +137,6 @@ |
141 | 138 | return $id_num === false ? 0 : $id_num; |
142 | 139 | } |
143 | 140 | |
144 | | - |
145 | | - |
146 | | - |
147 | 141 | /** |
148 | 142 | * Returns bucket information |
149 | 143 | * @return Array array of buckets, or null |
— | — | @@ -230,8 +224,6 @@ |
231 | 225 | |
232 | 226 | $dbw->commit(); |
233 | 227 | return ($db_status && $db_status_buckets); |
234 | | - |
235 | | - |
236 | 228 | } |
237 | 229 | |
238 | 230 | public static function editPageShowEditFormFields( $editPage, $output ) { |
Index: trunk/extensions/ClickTracking/ApiClickTracking.php |
— | — | @@ -18,11 +18,10 @@ |
19 | 19 | * @see includes/api/ApiBase#execute() |
20 | 20 | */ |
21 | 21 | public function execute() { |
22 | | - global $wgUser, $wgTitle, $wgClickTrackContribGranularity1, $wgClickTrackContribGranularity2, |
| 22 | + global $wgUser, $wgClickTrackContribGranularity1, $wgClickTrackContribGranularity2, |
23 | 23 | $wgClickTrackContribGranularity3; |
24 | 24 | |
25 | 25 | $params = $this->extractRequestParams(); |
26 | | - $this->validateParams( $params ); |
27 | 26 | $eventid_to_lookup = $params['eventid']; |
28 | 27 | $sessionId = $params['token']; |
29 | 28 | $namespace = $params['namespacenumber']; |
— | — | @@ -81,19 +80,6 @@ |
82 | 81 | } |
83 | 82 | } |
84 | 83 | |
85 | | - /** |
86 | | - * Required parameter check |
87 | | - * @param $params params extracted from the POST |
88 | | - */ |
89 | | - protected function validateParams( $params ) { |
90 | | - $required = array( 'eventid', 'token', 'namespacenumber' ); |
91 | | - foreach ( $required as $arg ) { |
92 | | - if ( !isset( $params[$arg] ) ) { |
93 | | - $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
94 | | - } |
95 | | - } |
96 | | - } |
97 | | - |
98 | 84 | public function getParamDescription() { |
99 | 85 | return array( |
100 | 86 | 'eventid' => 'string of eventID', |
— | — | @@ -110,19 +96,20 @@ |
111 | 97 | ); |
112 | 98 | } |
113 | 99 | |
114 | | - public function getPossibleErrors() { |
115 | | - return array_merge( parent::getPossibleErrors(), array( |
116 | | - array( 'missingparam', 'eventid' ), |
117 | | - array( 'missingparam', 'token' ), |
118 | | - array( 'missingparam', 'namespacenumber'), |
119 | | - ) ); |
120 | | - } |
121 | | - |
122 | 100 | public function getAllowedParams() { |
123 | 101 | return array( |
124 | | - 'eventid' => null, |
125 | | - 'namespacenumber' => null, |
126 | | - 'token' => null, |
| 102 | + 'eventid' => array( |
| 103 | + ApiBase::PARAM_TYPE => 'string', |
| 104 | + ApiBase::PARAM_REQUIRED => true, |
| 105 | + ), |
| 106 | + 'namespacenumber' => array( |
| 107 | + ApiBase::PARAM_TYPE => 'namespace', |
| 108 | + ApiBase::PARAM_REQUIRED => true, |
| 109 | + ), |
| 110 | + 'token' => array( |
| 111 | + ApiBase::PARAM_TYPE => 'string', |
| 112 | + ApiBase::PARAM_REQUIRED => true, |
| 113 | + ), |
127 | 114 | 'redirectto' => null, |
128 | 115 | 'additional' => null |
129 | 116 | ); |
Index: trunk/extensions/ClickTracking/ApiSpecialClickTracking.php |
— | — | @@ -34,7 +34,6 @@ |
35 | 35 | $this->getResult()->addValue( array( 'tablevals' ), 'vals', $tableData ); |
36 | 36 | } else { |
37 | 37 | // Chart data |
38 | | - $click_data = array(); |
39 | 38 | try { |
40 | 39 | $click_data = SpecialClickTracking::getChartData( $eventId, $startDate, $endDate, $increment, $userDefString ); |
41 | 40 | $this->getResult()->addValue( array( 'datapoints' ), 'expert', $click_data['expert'] ); |
— | — | @@ -49,16 +48,9 @@ |
50 | 49 | /** |
51 | 50 | * Required parameter check |
52 | 51 | * |
53 | | - * @param $params params extracted from the POST |
| 52 | + * @param $params array params extracted from the POST |
54 | 53 | */ |
55 | 54 | protected function validateParams( $params ) { |
56 | | - $required = array( 'eventid', 'startdate', 'enddate', 'increment', 'userdefs' ); |
57 | | - foreach ( $required as $arg ) { |
58 | | - if ( !isset( $params[$arg] ) ) { |
59 | | - $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
60 | | - } |
61 | | - } |
62 | | - |
63 | 55 | // Check if event id parses to an int greater than zero |
64 | 56 | if ( (int) $params['eventid'] < 0 ) { |
65 | 57 | $this->dieUsage( 'Invalid event ID', 'badeventid' ); |
— | — | @@ -73,7 +65,7 @@ |
74 | 66 | } |
75 | 67 | |
76 | 68 | // Check if increment is a positive integer |
77 | | - if ( (int) $params['increment'] <= 0 ) { |
| 69 | + if ( $params['increment'] <= 0 ) { |
78 | 70 | $this->dieUsage( 'Invalid increment', 'badincrement' ); |
79 | 71 | } |
80 | 72 | |
— | — | @@ -101,11 +93,6 @@ |
102 | 94 | |
103 | 95 | public function getPossibleErrors() { |
104 | 96 | return array_merge( parent::getPossibleErrors(), array( |
105 | | - array( 'missingparam', 'eventid' ), |
106 | | - array( 'missingparam', 'startdate' ), |
107 | | - array( 'missingparam', 'enddate' ), |
108 | | - array( 'missingparam', 'increment' ), |
109 | | - array( 'missingparam', 'userdefs' ), |
110 | 97 | array( 'code' => 'badeventid', 'info' => 'Invalid event ID' ), |
111 | 98 | array( 'code' => 'badstartdate', 'info' => 'startdate not in YYYYMMDD format: <<\'startdate\'>>' ), |
112 | 99 | array( 'code' => 'badenddate', 'info' => 'enddate not in YYYYMMDD format: <<\'enddate\'>>' ), |
— | — | @@ -118,21 +105,26 @@ |
119 | 106 | return array( |
120 | 107 | 'eventid' => array( |
121 | 108 | ApiBase::PARAM_TYPE => 'integer', |
122 | | - ApiBase::PARAM_MIN => 1 |
| 109 | + ApiBase::PARAM_MIN => 1, |
| 110 | + ApiBase::PARAM_REQUIRED => true, |
123 | 111 | ), |
124 | 112 | 'startdate' => array( |
125 | | - ApiBase::PARAM_TYPE => 'integer' |
| 113 | + ApiBase::PARAM_TYPE => 'integer', |
| 114 | + ApiBase::PARAM_REQUIRED => true, |
126 | 115 | ), |
127 | 116 | 'enddate' => array( |
128 | | - ApiBase::PARAM_TYPE => 'integer' |
| 117 | + ApiBase::PARAM_TYPE => 'integer', |
| 118 | + ApiBase::PARAM_REQUIRED => true, |
129 | 119 | ), |
130 | 120 | 'increment' => array( |
131 | 121 | ApiBase::PARAM_TYPE => 'integer', |
132 | 122 | ApiBase::PARAM_MIN => 1, |
133 | | - ApiBase::PARAM_MAX => 365 // 1 year |
| 123 | + ApiBase::PARAM_MAX => 365, // 1 year |
| 124 | + ApiBase::PARAM_REQUIRED => true, |
134 | 125 | ), |
135 | 126 | 'userdefs' => array( |
136 | | - ApiBase::PARAM_TYPE => 'string' |
| 127 | + ApiBase::PARAM_TYPE => 'string', |
| 128 | + ApiBase::PARAM_REQUIRED => true, |
137 | 129 | ), |
138 | 130 | 'tabledata' => array( |
139 | 131 | ApiBase::PARAM_TYPE => 'integer' |
Index: trunk/extensions/EmailCapture/SpecialEmailCapture.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | } |
9 | 9 | |
10 | 10 | public function execute( $par ) { |
11 | | - global $wgOut, $wgUser, $wgRequest; |
| 11 | + global $wgOut, $wgRequest; |
12 | 12 | |
13 | 13 | $this->setHeaders(); |
14 | 14 | |
Index: trunk/extensions/EmailCapture/EmailCaptureHooks.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | class EmailCaptureHooks { |
7 | 7 | /** |
8 | 8 | * LoadExtensionSchemaUpdates hook |
| 9 | + * |
| 10 | + * @param $updater DatabaseUpdater |
| 11 | + * @return bool |
9 | 12 | */ |
10 | 13 | public static function loadExtensionSchemaUpdates( $updater ) { |
11 | 14 | $db = $updater->getDB(); |
Index: trunk/extensions/EmailCapture/api/ApiEmailCapture.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | |
33 | 33 | if ( $dbw->affectedRows() ) { |
34 | 34 | // Send auto-response |
35 | | - global $wgUser, $wgEmailCaptureSendAutoResponse, $wgEmailCaptureAutoResponse; |
| 35 | + global $wgEmailCaptureSendAutoResponse, $wgEmailCaptureAutoResponse; |
36 | 36 | $title = SpecialPage::getTitleFor( 'EmailCapture' ); |
37 | 37 | $link = $title->getFullURL(); |
38 | 38 | $fullLink = $title->getFullURL( array( 'verify' => $code ) ); |