r107566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107565‎ | r107566 | r107567 >
Date:12:59, 29 December 2011
Author:siebrand
Status:ok
Tags:
Comment:
Follow-up r107522: Moar whitespace and indentation updates.
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.hooks.php
@@ -7,7 +7,6 @@
88 * @param $output OutputPage
99 * @param $skin Skin
1010 */
11 -
1211 public static function onPageDisplay( &$output, &$skin ) {
1312 if ( self::shouldShowMoodbar( $output, $skin ) ) {
1413 $output->addModules( array( 'ext.moodBar.init', 'ext.moodBar.tooltip', 'ext.moodBar.core' ) );
@@ -27,31 +26,28 @@
2827 * @return bool
2928 */
3029 public static function onMarkItemAsHelpful( $mahaction, $type, $item, $User, &$isAbleToMark ) {
31 -
3230 if ( $User->isAnon() ) {
3331 $isAbleToMark = false;
3432 return true;
3533 }
3634
3735 if ( $type == 'mbresponse' ) {
38 -
3936 switch ( $mahaction ) {
40 -
4137 case 'mark':
4238 $dbr = wfGetDB( DB_SLAVE );
4339
44 - $res = $dbr->selectRow( array( 'moodbar_feedback', 'moodbar_feedback_response' ),
45 - array( 'mbf_id' ),
46 - array( 'mbf_id = mbfr_mbf_id',
47 - 'mbfr_id' => intval( $item ),
48 - 'mbf_user_id' => $User->getId()
49 - ), __METHOD__ );
 40+ $res = $dbr->selectRow(
 41+ array( 'moodbar_feedback', 'moodbar_feedback_response' ),
 42+ array( 'mbf_id' ),
 43+ array( 'mbf_id = mbfr_mbf_id',
 44+ 'mbfr_id' => intval( $item ),
 45+ 'mbf_user_id' => $User->getId()
 46+ ), __METHOD__ );
5047
5148 if ( $res === false ) {
5249 $isAbleToMark = false;
5350 }
5451 break;
55 -
5652 case 'unmark':
5753 default:
5854 //We will leve the MarkAsHelpFul extension to check if the user has unmark right
@@ -60,7 +56,6 @@
6157 }
6258
6359 return true;
64 -
6560 }
6661
6762 /**
@@ -78,9 +73,9 @@
7974 if ( $skin->getSkinName() !== 'vector' ) {
8075 return false;
8176 }
 77+
8278 global $wgUser;
8379 $user = $wgUser;
84 -
8580 if ( $user->isAnon() ) {
8681 return false;
8782 }
@@ -128,22 +123,20 @@
129124 */
130125 public static function onLoadExtensionSchemaUpdates( $updater = null ) {
131126 $dir = dirname(__FILE__) . '/sql';
132 - $updater->addExtensionTable( 'moodbar_feedback', "$dir/MoodBar.sql" );
133127
 128+ $updater->addExtensionTable( 'moodbar_feedback', "$dir/MoodBar.sql" );
134129 $updater->addExtensionField( 'moodbar_feedback', 'mbf_user_editcount', "$dir/mbf_user_editcount.sql" );
135 -
136130 $updater->addExtensionIndex( 'moodbar_feedback', 'mbf_type_timestamp_id', "$dir/AddIDToIndexes.sql" );
 131+ $updater->addExtensionUpdate( array(
 132+ 'dropIndex',
 133+ 'moodbar_feedback',
 134+ 'mbf_userid_ip_timestamp',
 135+ "$dir/AddIDToIndexes2.sql", true
 136+ ) );
137137
138 - $updater->addExtensionUpdate( array( 'dropIndex', 'moodbar_feedback',
139 - 'mbf_userid_ip_timestamp', "$dir/AddIDToIndexes2.sql", true )
140 - );
141 -
142138 $updater->addExtensionIndex( 'moodbar_feedback', 'mbfr_timestamp_id', "$dir/mbf_timestamp_id.sql" );
143 -
144139 $updater->addExtensionField( 'moodbar_feedback', 'mbf_hidden_state', "$dir/mbf_hidden_state.sql" );
145 -
146140 $updater->addExtensionTable( 'moodbar_feedback_response', "$dir/moodbar_feedback_response.sql" );
147 -
148141 $updater->addExtensionIndex( 'moodbar_feedback_response', 'mbfr_timestamp_id', "$dir/mbfr_timestamp_id_index.sql" );
149142
150143 return true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107522Cleanup onLoadExtensionSchemaUpdates to use utility functions rather than arr...reedy20:37, 28 December 2011

Status & tagging log