r44205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44204‎ | r44205 | r44206 >
Date:23:55, 3 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Add rfp_ratings CSV value to allow for greater flexibility in aggregating values
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.sql (modified) (history)
  • /trunk/extensions/FlaggedRevs/archives/patch-rfb_ratings.sql (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -529,6 +529,7 @@
530530 $wgExtNewTables[] = array( 'flaggedrevs_tracking', "$base/archives/patch-flaggedrevs_tracking.sql" );
531531 $wgExtNewFields[] = array( 'flaggedpages', 'fp_pending_since', "$base/archives/patch-fp_pending_since.sql" );
532532 $wgExtNewFields[] = array( 'reader_feedback', 'rfb_timestamp', "$base/archives/patch-rfb_timestamp.sql" );
 533+ $wgExtNewFields[] = array( 'reader_feedback', 'rfb_ratings', "$base/archives/patch-rfb_ratings.sql" );
533534 } else if( $wgDBtype == 'postgres' ) {
534535 $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ); // Inital install tables
535536 $wgExtPGNewFields[] = array('flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql
@@ -126,6 +126,8 @@
127127 rfb_user integer NOT NULL,
128128 rfb_ip varchar(255) NOT NULL default '',
129129 rfb_timestamp char(14) NOT NULL default '',
 130+ --Vote info
 131+ rfb_ratings mediumblob NOT NULL,
130132 -- No double voting!
131133 PRIMARY KEY (rfb_rev_id,rfb_user,rfb_ip)
132134 ) /*$wgDBTableOptions*/;
Index: trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php
@@ -226,12 +226,21 @@
227227 }
228228 return false;
229229 }
 230+
 231+ protected function flattenRatings( $dims ) {
 232+ $s = array();
 233+ foreach( $dims as $tag => $value ) {
 234+ $s[] = "{$tag}={$value}";
 235+ }
 236+ return implode("\n",$s);
 237+ }
230238
231239 private function submit() {
232240 global $wgUser;
233241 $dbw = wfGetDB( DB_MASTER );
234242 # Get date timestamp...
235243 $date = str_pad( substr( wfTimestampNow(), 0, 8 ), 14, '0' );
 244+ $ratings = $this->flattenRatings( $this->dims );
236245 # Make sure revision is valid!
237246 $rev = Revision::newFromId( $this->oldid );
238247 if( !$rev || !$rev->getTitle()->equals( $this->page ) ) {
@@ -247,7 +256,8 @@
248257 'rfb_rev_id' => $this->oldid,
249258 'rfb_user' => $wgUser->getId(),
250259 'rfb_ip' => wfGetIP(),
251 - 'rfb_timestamp' => $dbw->timestamp()
 260+ 'rfb_timestamp' => $dbw->timestamp(),
 261+ 'rfb_ratings' => $ratings
252262 );
253263 $dbw->insert( 'reader_feedback', $insertRow, __METHOD__, 'IGNORE' );
254264 # Make sure initial page data is there to begin with...
Index: trunk/extensions/FlaggedRevs/archives/patch-rfb_ratings.sql
@@ -0,0 +1,2 @@
 2+ALTER TABLE /*$wgDBprefix*/reader_feedback
 3+ ADD rfb_ratings mediumblob NOT NULL;
Property changes on: trunk/extensions/FlaggedRevs/archives/patch-rfb_ratings.sql
___________________________________________________________________
Added: svn:eol-style
14 + native

Status & tagging log