r104055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104054‎ | r104055 | r104056 >
Date:17:39, 23 November 2011
Author:bsitu
Status:ok
Tags:
Comment:
followup to r103881 - change datatype of user_ip to varbinary(40) and replace MWException with an extension specific exception
Modified paths:
  • /trunk/extensions/MoodBar/FeedbackResponseItem.php (modified) (history)
  • /trunk/extensions/MoodBar/sql/moodbar_feedback_response.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/sql/moodbar_feedback_response.sql
@@ -5,7 +5,7 @@
66
77 -- User who provided the response
88 mbfr_user_id int unsigned NOT NULL, -- User ID, or zero
9 - mbfr_user_ip varchar(255) binary NULL, -- If anonymous, user's IP address
 9+ mbfr_user_ip varbinary(40) NULL, -- If anonymous, user's IP address
1010
1111 mbfr_commenter_editcount int unsigned NOT NULL, -- number of edit for the user who writes the feedback
1212 mbfr_user_editcount int unsigned NOT NULL, -- number of edit for the responder
Index: trunk/extensions/MoodBar/FeedbackResponseItem.php
@@ -123,16 +123,17 @@
124124 /**
125125 * Set a group of properties. Throws an exception on invalid property.
126126 * @param $values An associative array of properties to set.
 127+ * @throws MWFeedbackResponseItemPropertyException
127128 */
128129 public function setProperties( $values ) {
129130
130131 foreach( $values as $key => $value ) {
131132 if ( ! $this->isValidKey($key) ) {
132 - throw new MWException( "Attempt to set invalid property $key" );
 133+ throw new MWFeedbackResponseItemPropertyException( "Attempt to set invalid property $key" );
133134 }
134135
135136 if ( ! $this->validatePropertyValue($key, $value) ) {
136 - throw new MWException( "Attempt to set invalid value for $key" );
 137+ throw new MWFeedbackResponseItemPropertyException( "Attempt to set invalid value for $key" );
137138 }
138139
139140 $this->data[$key] = $value;
@@ -152,10 +153,11 @@
153154 * Get a property.
154155 * @param $key The property to get
155156 * @return The property value.
 157+ * @throws MWFeedbackResponseItemPropertyException
156158 */
157159 public function getProperty( $key ) {
158160 if ( ! $this->isValidKey($key) ) {
159 - throw new MWException( "Attempt to get invalid property $key" );
 161+ throw new MWFeedbackResponseItemPropertyException( "Attempt to get invalid property $key" );
160162 }
161163
162164 return $this->data[$key];
@@ -280,3 +282,5 @@
281283 }
282284
283285 }
 286+
 287+class MWFeedbackResponseItemPropertyException extends MWException {};

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103881MoodBar Phase 2 - Feedback response APIbsitu01:45, 22 November 2011

Status & tagging log