Index: trunk/extensions/MoodBar/include/MoodBarUtil.php |
— | — | @@ -0,0 +1,70 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Utility class for MoodBar |
| 6 | + */ |
| 7 | +class MoodBarUtil { |
| 8 | + |
| 9 | + /** |
| 10 | + * Calculate the time diff between $time and now, format the time diff to have the largest time block |
| 11 | + * or 'less than 1 minute' if the time diff is less than 1 minute |
| 12 | + * @param $time string - the UNIX time stamp |
| 13 | + * @return string - formatted time string |
| 14 | + */ |
| 15 | + public static function formatTimeSince( $time ) { |
| 16 | + |
| 17 | + $blocks = array( array( 'total' => 60 * 60 * 24 * 365, 'name' => 'years' ), |
| 18 | + array( 'total' => 60 * 60 * 24 * 30, 'name' => 'months'), |
| 19 | + array( 'total' => 60 * 60 * 24 * 7, 'name' => 'weeks'), |
| 20 | + array( 'total' => 60 * 60 * 24, 'name' => 'days'), |
| 21 | + array( 'total' => 60 * 60, 'name' => 'hours'), |
| 22 | + array( 'total' => 60, 'name' => 'minutes') ); |
| 23 | + |
| 24 | + $since = wfTimestamp( TS_UNIX ) - $time; |
| 25 | + $displayTime = 0; |
| 26 | + $displayBlock = ''; |
| 27 | + |
| 28 | + // get the largest time block, 1 minute 35 seconds -> 2 minutes |
| 29 | + for ( $i = 0, $count = count( $blocks ); $i < $count; $i++ ) { |
| 30 | + $seconds = $blocks[$i]['total']; |
| 31 | + $displayTime = floor( $since / $seconds ); |
| 32 | + |
| 33 | + if ( $displayTime > 0 ) { |
| 34 | + $displayBlock = $blocks[$i]['name']; |
| 35 | + // round up if the remaining time is greater than |
| 36 | + // half of the time unit |
| 37 | + if ( ( $since % $seconds ) >= ( $seconds / 2 ) ) { |
| 38 | + $displayTime++; |
| 39 | + |
| 40 | + //advance to upper unit if possible, eg, 24 hours to 1 day |
| 41 | + if ( isset( $blocks[$i-1] ) && $displayTime * $seconds == $blocks[$i-1]['total'] ) { |
| 42 | + $displayTime = 1; |
| 43 | + $displayBlock = $blocks[$i-1]['name']; |
| 44 | + } |
| 45 | + |
| 46 | + } |
| 47 | + break; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + if ( $displayTime > 0 ) { |
| 52 | + global $wgLang; |
| 53 | + |
| 54 | + // message key defined in moodbar only |
| 55 | + if ( in_array( $displayBlock, array( 'years', 'months', 'weeks' ) ) ) { |
| 56 | + $messageKey = 'moodbar-' . $displayBlock; |
| 57 | + } |
| 58 | + else { |
| 59 | + $messageKey = $displayBlock; |
| 60 | + } |
| 61 | + |
| 62 | + return wfMessage( $messageKey )->inLanguage( $wgLang ) |
| 63 | + ->params( $wgLang->formatNum( $displayTime ) )->escaped(); |
| 64 | + |
| 65 | + } else { |
| 66 | + return wfMessage( 'moodbar-seconds' )->escaped(); |
| 67 | + } |
| 68 | + |
| 69 | + } |
| 70 | + |
| 71 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/MoodBar/include/MoodBarUtil.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 72 | + native |
Index: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php |
— | — | @@ -71,33 +71,33 @@ |
72 | 72 | public function getMoodBarTypeStats( ) { |
73 | 73 | |
74 | 74 | global $wgMemc; |
75 | | - |
76 | | - $timestamp = time() - 24 * 60 * 60; // 24 hours ago |
| 75 | + |
| 76 | + $timestamp = wfTimestamp( TS_UNIX ) - 24 * 60 * 60; // 24 hours ago |
77 | 77 | |
78 | 78 | // Try cache first |
79 | 79 | $key = wfMemcKey( 'moodbar_feedback', 'type_stats', 'last_day' ); |
80 | 80 | $moodbarStat = $wgMemc->get( $key ); |
81 | | - |
82 | | - if ( $moodbarStat === false ) { |
83 | | - $dbr = wfGetDB( DB_SLAVE ); |
84 | | - $res = $dbr->select( array( 'moodbar_feedback' ), |
85 | | - array( 'mbf_type', 'COUNT(*) AS number' ), |
86 | | - array( 'mbf_hidden_state' => 0, 'mbf_timestamp > ' . $dbr->addQuotes( wfTimestamp( TS_MW, $timestamp ) ) ), |
87 | | - __METHOD__, |
88 | | - array( 'GROUP BY' => 'mbf_type' ) |
89 | | - ); |
90 | | - |
91 | | - $moodbarStat = array('happy' => 0, 'sad' => 0, 'confused' => 0); |
92 | | - |
93 | | - foreach ( $res as $row ) { |
94 | | - $moodbarStat[$row->mbf_type] = $row->number; |
95 | | - } |
96 | | - |
97 | | - // Cache the results in cache for 1 hour |
98 | | - $wgMemc->set( $key, $moodbarStat, 60 * 60 ); |
99 | | - } |
100 | | - |
101 | | - return $moodbarStat; |
| 81 | + |
| 82 | + if ( $moodbarStat === false ) { |
| 83 | + $dbr = wfGetDB( DB_SLAVE ); |
| 84 | + $res = $dbr->select( array( 'moodbar_feedback' ), |
| 85 | + array( 'mbf_type', 'COUNT(*) AS number' ), |
| 86 | + array( 'mbf_hidden_state' => 0, 'mbf_timestamp > ' . $dbr->addQuotes( wfTimestamp( TS_MW, $timestamp ) ) ), |
| 87 | + __METHOD__, |
| 88 | + array( 'GROUP BY' => 'mbf_type' ) |
| 89 | + ); |
| 90 | + |
| 91 | + $moodbarStat = array( 'happy' => 0, 'sad' => 0, 'confused' => 0 ); |
| 92 | + |
| 93 | + foreach ( $res as $row ) { |
| 94 | + $moodbarStat[$row->mbf_type] = $row->number; |
| 95 | + } |
| 96 | + |
| 97 | + // Cache the results in cache for 1 hour |
| 98 | + $wgMemc->set( $key, $moodbarStat, 60 * 60 ); |
| 99 | + } |
| 100 | + |
| 101 | + return $moodbarStat; |
102 | 102 | |
103 | 103 | } |
104 | 104 | |
— | — | @@ -222,12 +222,8 @@ |
223 | 223 | $typeMsg = wfMessage( "moodbar-type-$type" )->params( $feedbackItem->getProperty('user') )->escaped(); |
224 | 224 | |
225 | 225 | // Timestamp |
226 | | - $now = wfTimestamp( TS_UNIX ); |
227 | 226 | $timestamp = wfTimestamp( TS_UNIX, $feedbackItem->getProperty('timestamp') ); |
228 | | - $time = $wgLang->formatTimePeriod( $now - $timestamp, |
229 | | - array( 'avoid' => 'avoidminutes', 'noabbrevs' => true ) |
230 | | - ); |
231 | | - $timeMsg = wfMessage( 'ago' )->params( $time )->escaped(); |
| 227 | + $timeMsg = wfMessage( 'ago' )->params( MoodBarUtil::formatTimeSince( $timestamp ) )->escaped(); |
232 | 228 | |
233 | 229 | // Comment |
234 | 230 | $comment = htmlspecialchars( $feedbackItem->getProperty('comment') ); |
— | — | @@ -296,40 +292,29 @@ |
297 | 293 | $showResponseBox = true; |
298 | 294 | |
299 | 295 | //Do not show response box if there is a response already |
300 | | - if ( isset( $response[$id] ) ) { |
301 | | - //for now we only display the latest response |
302 | | - foreach ( $response[$id] AS $response_detail ) { |
| 296 | + if ( isset( $response[$id] ) ) { |
| 297 | + $response_detail = $response[$id]; |
| 298 | + |
| 299 | + $responder = User::newFromId( $response_detail->mbfr_user_id ); |
| 300 | + |
| 301 | + if ( $responder && !$responder->isAnon() ) { |
| 302 | + $responsetime = MoodBarUtil::formatTimeSince( wfTimestamp( TS_UNIX, $response_detail->mbfr_timestamp ) ); |
303 | 303 | |
304 | | - $responder = User::newFromId( $response_detail->mbfr_user_id ); |
| 304 | + $permalinkTitle = $feedbackItem->getProperty('user')->getTalkPage()->getFullText(); |
305 | 305 | |
306 | | - if ( !$responder->isAnon() ) { |
307 | | - |
308 | | - $now = wfTimestamp( TS_UNIX ); |
309 | | - $responsetimestamp = wfTimestamp( TS_UNIX, $response_detail->mbfr_timestamp ); |
310 | | - |
311 | | - $responsetime = $wgLang->formatTimePeriod( $now - $responsetimestamp, |
312 | | - array( 'avoid' => 'avoidminutes', 'noabbrevs' => true ) |
313 | | - ); |
314 | | - |
315 | | - $permalinkTitle = $feedbackItem->getProperty('user')->getTalkPage()->getFullText(); |
316 | | - |
317 | | - $individual_response = wfMsgExt('moodbar-feedback-response-summary', array('parse'), |
318 | | - $responder->getUserPage()->getFullText(), |
319 | | - $responder->getName(), |
320 | | - $permalinkTitle . '#feedback-dashboard-response-' . $response_detail->mbfr_id, |
321 | | - $responsetime); |
322 | | - $showResponseBox = false; |
323 | | - |
324 | | - $responseElements = <<<HTML |
325 | | - <div class="fbd-item-response"> |
326 | | - $individual_response |
327 | | - </div> |
| 306 | + $individual_response = wfMsgExt('moodbar-feedback-response-summary', array('parse'), |
| 307 | + $responder->getUserPage()->getFullText(), |
| 308 | + $responder->getName(), |
| 309 | + $permalinkTitle . '#feedback-dashboard-response-' . $response_detail->mbfr_id, |
| 310 | + $responsetime); |
| 311 | + $showResponseBox = false; |
| 312 | + |
| 313 | + $responseElements = <<<HTML |
| 314 | + <div class="fbd-item-response"> |
| 315 | + $individual_response |
| 316 | + </div> |
328 | 317 | HTML; |
329 | | - break; |
330 | | - |
331 | | - } |
332 | | - } |
333 | | - |
| 318 | + } |
334 | 319 | } |
335 | 320 | //only show response elements if feedback is not hidden, and user is logged in |
336 | 321 | else if ( $showResponseBox && $feedbackItem->getProperty('hidden-state') == false |
— | — | @@ -410,15 +395,15 @@ |
411 | 396 | |
412 | 397 | if($feedback_hidden_detail === false) { |
413 | 398 | $footer = wfMessage('moodbar-hidden-footer-without-log')-> |
414 | | - rawParams( $link )->escaped(); |
| 399 | + rawParams( $link )->escaped(); |
415 | 400 | } |
416 | 401 | else { |
417 | 402 | $footer = wfMessage('moodbar-hidden-footer')-> |
418 | | - rawParams( htmlspecialchars( $feedback_hidden_detail->log_user_text ), |
419 | | - $wgLang->date($feedback_hidden_detail->log_timestamp), |
420 | | - $wgLang->time($feedback_hidden_detail->log_timestamp), |
421 | | - htmlspecialchars( $feedback_hidden_detail->log_comment ), |
422 | | - $link )->escaped(); |
| 403 | + rawParams( htmlspecialchars( $feedback_hidden_detail->log_user_text ), |
| 404 | + $wgLang->date($feedback_hidden_detail->log_timestamp), |
| 405 | + $wgLang->time($feedback_hidden_detail->log_timestamp), |
| 406 | + htmlspecialchars( $feedback_hidden_detail->log_comment ), |
| 407 | + $link )->escaped(); |
423 | 408 | } |
424 | 409 | |
425 | 410 | return Xml::tags( 'div', array( 'class' => 'error' ), $footer ); |
— | — | @@ -673,49 +658,64 @@ |
674 | 659 | */ |
675 | 660 | protected static function getFeedbackHiddenDetail( $mbf_id ) { |
676 | 661 | $dbr = wfGetDB( DB_SLAVE ); |
677 | | - |
678 | | - return $dbr->selectRow( array( 'logging' ), |
679 | | - array( 'log_user_text', 'log_timestamp', 'log_comment' ), |
680 | | - array( 'log_namespace' => NS_SPECIAL, |
681 | | - 'log_title' => 'FeedbackDashboard/' . intval( $mbf_id ), |
682 | | - 'log_action' => 'hide', |
683 | | - 'log_type' => 'moodbar' ), |
684 | | - __METHOD__, |
685 | | - array( 'LIMIT' => 1, 'ORDER BY' => "log_timestamp DESC" ) |
| 662 | + |
| 663 | + return $dbr->selectRow( array( 'logging' ), |
| 664 | + array( 'log_user_text', 'log_timestamp', 'log_comment' ), |
| 665 | + array( 'log_namespace' => NS_SPECIAL, |
| 666 | + 'log_title' => 'FeedbackDashboard/' . intval( $mbf_id ), |
| 667 | + 'log_action' => 'hide', |
| 668 | + 'log_type' => 'moodbar' ), |
| 669 | + __METHOD__, |
| 670 | + array( 'LIMIT' => 1, 'ORDER BY' => "log_timestamp DESC" ) |
686 | 671 | ); |
687 | 672 | } |
688 | 673 | |
689 | 674 | /** |
690 | | - * Get the response summary for a set of feedback |
| 675 | + * Get the latest response summary for a set of feedback, |
691 | 676 | * @param $res Iterator of Db row with index mbf_id for feedback |
692 | 677 | * @return array |
693 | 678 | */ |
694 | 679 | public static function getResponseSummary( $res ) { |
695 | 680 | $dbr = wfGetDB( DB_SLAVE ); |
696 | | - |
| 681 | + |
697 | 682 | $feedback = array(); |
698 | | - |
| 683 | + |
699 | 684 | foreach ( $res as $row ) { |
700 | | - $feedback[] = $row->mbf_id; |
| 685 | + $feedback[] = $row->mbf_id; |
701 | 686 | } |
702 | | - |
| 687 | + |
703 | 688 | $response = array(); |
704 | | - |
| 689 | + |
705 | 690 | if ( count( $feedback ) > 0 ) { |
| 691 | + // query to get the latest mbfr_id for each mbfr_mbf_id |
706 | 692 | $res = $dbr->select( array( 'moodbar_feedback_response' ), |
707 | | - array( 'mbfr_id', 'mbfr_mbf_id', 'mbfr_user_id', 'mbfr_timestamp' ), |
708 | | - array( 'mbfr_mbf_id' => $feedback, 'mbfr_user_id != 0' ), |
709 | | - __METHOD__, |
710 | | - array( 'ORDER BY' => "mbfr_mbf_id DESC, mbfr_timestamp DESC, mbfr_id DESC" ) |
711 | | - ); |
712 | | - |
713 | | - foreach ( $res AS $row ) { |
714 | | - $response[$row->mbfr_mbf_id][] = $row; |
715 | | - } |
| 693 | + array( 'MAX(mbfr_id) AS latest_mbfr_id' ), |
| 694 | + array( 'mbfr_mbf_id' => $feedback, 'mbfr_user_id != 0' ), |
| 695 | + __METHOD__, |
| 696 | + array( 'GROUP BY' => "mbfr_mbf_id" ) |
| 697 | + ); |
| 698 | + |
| 699 | + $mbfrId = array(); |
| 700 | + |
| 701 | + foreach ( $res as $row ) { |
| 702 | + $mbfrId[] = $row->latest_mbfr_id; |
| 703 | + } |
| 704 | + |
| 705 | + // get the detail for each mbfr_id |
| 706 | + if ( count( $mbfrId ) > 0 ) { |
| 707 | + $res = $dbr->select( array( 'moodbar_feedback_response' ), |
| 708 | + array( 'mbfr_id', 'mbfr_mbf_id', 'mbfr_user_id', 'mbfr_timestamp' ), |
| 709 | + array( 'mbfr_id' => $mbfrId ), |
| 710 | + __METHOD__ |
| 711 | + ); |
| 712 | + |
| 713 | + foreach ( $res as $row ) { |
| 714 | + $response[$row->mbfr_mbf_id] = $row; |
| 715 | + } |
| 716 | + } |
716 | 717 | } |
717 | | - |
718 | | - |
| 718 | + |
719 | 719 | return $response; |
720 | 720 | } |
721 | 721 | |
722 | | -} |
| 722 | +} |
\ No newline at end of file |
Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -20,6 +20,11 @@ |
21 | 21 | 'tooltip-p-moodbar-trigger-feedback' => '', |
22 | 22 | 'tooltip-p-moodbar-trigger-share' => '', |
23 | 23 | 'tooltip-p-moodbar-trigger-editing' => '', |
| 24 | + // Time format |
| 25 | + 'moodbar-weeks' => '{{PLURAL:$1|$1 week|$1 weeks}}', |
| 26 | + 'moodbar-months' => '{{PLURAL:$1|$1 month|$1 months}}', |
| 27 | + 'moodbar-years' => '{{PLURAL:$1|$1 year|$1 years}}', |
| 28 | + 'moodbar-seconds' => 'less than 1 minute', |
24 | 29 | // Overlay |
25 | 30 | 'moodbar-close' => '(close)', |
26 | 31 | 'moodbar-intro-feedback' => 'Editing $1 made me...', |
Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -137,8 +137,14 @@ |
138 | 138 | $updater->addExtensionIndex( 'moodbar_feedback', 'mbf_timestamp_id', "$dir/mbf_timestamp_id.sql" ); |
139 | 139 | $updater->addExtensionField( 'moodbar_feedback', 'mbf_hidden_state', "$dir/mbf_hidden_state.sql" ); |
140 | 140 | $updater->addExtensionTable( 'moodbar_feedback_response', "$dir/moodbar_feedback_response.sql" ); |
141 | | - $updater->addExtensionIndex( 'moodbar_feedback_response', 'mbfr_timestamp_id', "$dir/mbfr_timestamp_id_index.sql" ); |
142 | | - |
| 141 | + $updater->addExtensionUpdate( array( |
| 142 | + 'dropIndex', |
| 143 | + 'moodbar_feedback_response', |
| 144 | + 'mbfr_timestamp_id', |
| 145 | + "$dir/mbfr_timestamp_id_index.sql", true |
| 146 | + ) ); |
| 147 | + $updater->addExtensionIndex( 'moodbar_feedback_response', 'mbfr_mbf_mbfr_id', "$dir/mbfr_mbf_mbfr_id_index.sql" ); |
| 148 | + |
143 | 149 | return true; |
144 | 150 | } |
145 | 151 | |
Index: trunk/extensions/MoodBar/sql/mbfr_mbf_mbfr_id_index.sql |
— | — | @@ -0,0 +1 @@ |
| 2 | +CREATE INDEX /*i*/mbfr_mbf_mbfr_id ON /*_*/moodbar_feedback_response (mbfr_mbf_id, mbfr_id); |
Property changes on: trunk/extensions/MoodBar/sql/mbfr_mbf_mbfr_id_index.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 3 | + native |
Index: trunk/extensions/MoodBar/sql/mbfr_timestamp_id_index.sql |
— | — | @@ -1,2 +1 @@ |
2 | | - |
3 | | -CREATE INDEX /*i*/mbfr_timestamp_id ON /*_*/moodbar_feedback_response (mbfr_mbf_id, mbfr_timestamp, mbfr_id); |
| 2 | +DROP INDEX /*i*/mbfr_timestamp_id ON /*_*/moodbar_feedback_response; |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -13,29 +13,32 @@ |
14 | 14 | 'path' => __FILE__, |
15 | 15 | ); |
16 | 16 | |
| 17 | +$moodBarDir = dirname(__FILE__) . '/'; |
| 18 | + |
17 | 19 | // Object model |
18 | | -$wgAutoloadClasses['MBFeedbackItem'] = dirname(__FILE__).'/FeedbackItem.php'; |
19 | | -$wgAutoloadClasses['MBFeedbackResponseItem'] = dirname(__FILE__).'/FeedbackResponseItem.php'; |
20 | | -$wgAutoloadClasses['MWFeedbackResponseItemPropertyException'] = dirname(__FILE__).'/FeedbackResponseItem.php'; |
21 | | -$wgAutoloadClasses['MoodBarFormatter'] = dirname(__FILE__).'/Formatter.php'; |
22 | | -$wgAutoloadClasses['MoodBarHTMLEmailNotification'] = dirname(__FILE__).'/include/MoodBarHTMLEmailNotification.php'; |
23 | | -$wgAutoloadClasses['MoodBarHTMLMailerJob'] = dirname( __FILE__ ) . '/include/MoodBarHTMLMailerJob.php'; |
| 20 | +$wgAutoloadClasses['MBFeedbackItem'] = $moodBarDir . 'FeedbackItem.php'; |
| 21 | +$wgAutoloadClasses['MBFeedbackResponseItem'] = $moodBarDir . 'FeedbackResponseItem.php'; |
| 22 | +$wgAutoloadClasses['MWFeedbackResponseItemPropertyException'] = $moodBarDir . 'FeedbackResponseItem.php'; |
| 23 | +$wgAutoloadClasses['MoodBarFormatter'] = $moodBarDir . 'Formatter.php'; |
| 24 | +$wgAutoloadClasses['MoodBarHTMLEmailNotification'] = $moodBarDir . 'include/MoodBarHTMLEmailNotification.php'; |
| 25 | +$wgAutoloadClasses['MoodBarHTMLMailerJob'] = $moodBarDir . 'include/MoodBarHTMLMailerJob.php'; |
| 26 | +$wgAutoloadClasses['MoodBarUtil'] = $moodBarDir . 'include/MoodBarUtil.php'; |
24 | 27 | |
25 | 28 | // API |
26 | | -$wgAutoloadClasses['ApiMoodBar'] = dirname(__FILE__).'/ApiMoodBar.php'; |
| 29 | +$wgAutoloadClasses['ApiMoodBar'] = $moodBarDir . 'ApiMoodBar.php'; |
27 | 30 | $wgAPIModules['moodbar'] = 'ApiMoodBar'; |
28 | | -$wgAutoloadClasses['ApiQueryMoodBarComments'] = dirname( __FILE__ ). '/ApiQueryMoodBarComments.php'; |
| 31 | +$wgAutoloadClasses['ApiQueryMoodBarComments'] = $moodBarDir . 'ApiQueryMoodBarComments.php'; |
29 | 32 | $wgAPIListModules['moodbarcomments'] = 'ApiQueryMoodBarComments'; |
30 | | -$wgAutoloadClasses['ApiFeedbackDashboard'] = dirname(__FILE__).'/ApiFeedbackDashboard.php'; |
| 33 | +$wgAutoloadClasses['ApiFeedbackDashboard'] = $moodBarDir . 'ApiFeedbackDashboard.php'; |
31 | 34 | $wgAPIModules['feedbackdashboard'] = 'ApiFeedbackDashboard'; |
32 | | -$wgAutoloadClasses['ApiFeedbackDashboardResponse'] = dirname(__FILE__).'/ApiFeedbackDashboardResponse.php'; |
| 35 | +$wgAutoloadClasses['ApiFeedbackDashboardResponse'] = $moodBarDir . 'ApiFeedbackDashboardResponse.php'; |
33 | 36 | $wgAPIModules['feedbackdashboardresponse'] = 'ApiFeedbackDashboardResponse'; |
34 | | -$wgAutoloadClasses['ApiMoodBarSetUserEmail'] = dirname(__FILE__).'/ApiMoodBarSetUserEmail.php'; |
35 | | -$wgAutoloadClasses['MWApiMoodBarSetUserEmailInvalidActionException'] = dirname(__FILE__).'/ApiMoodBarSetUserEmail.php'; |
| 37 | +$wgAutoloadClasses['ApiMoodBarSetUserEmail'] = $moodBarDir . 'ApiMoodBarSetUserEmail.php'; |
| 38 | +$wgAutoloadClasses['MWApiMoodBarSetUserEmailInvalidActionException'] = $moodBarDir . 'ApiMoodBarSetUserEmail.php'; |
36 | 39 | $wgAPIModules['moodbarsetuseremail'] = 'ApiMoodBarSetUserEmail'; |
37 | 40 | |
38 | 41 | // Hooks |
39 | | -$wgAutoloadClasses['MoodBarHooks'] = dirname(__FILE__).'/MoodBar.hooks.php'; |
| 42 | +$wgAutoloadClasses['MoodBarHooks'] = $moodBarDir . 'MoodBar.hooks.php'; |
40 | 43 | $wgHooks['BeforePageDisplay'][] = 'MoodBarHooks::onPageDisplay'; |
41 | 44 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'MoodBarHooks::resourceLoaderGetConfigVars'; |
42 | 45 | $wgHooks['MakeGlobalVariablesScript'][] = 'MoodBarHooks::makeGlobalVariablesScript'; |
— | — | @@ -43,12 +46,12 @@ |
44 | 47 | $wgHooks['onMarkItemAsHelpful'][] = 'MoodBarHooks::onMarkItemAsHelpful'; |
45 | 48 | |
46 | 49 | // Special pages |
47 | | -$wgAutoloadClasses['SpecialMoodBar'] = dirname(__FILE__).'/SpecialMoodBar.php'; |
| 50 | +$wgAutoloadClasses['SpecialMoodBar'] = $moodBarDir . 'SpecialMoodBar.php'; |
48 | 51 | $wgSpecialPages['MoodBar'] = 'SpecialMoodBar'; |
49 | | -$wgAutoloadClasses['SpecialFeedbackDashboard'] = dirname( __FILE__ ) . '/SpecialFeedbackDashboard.php'; |
| 52 | +$wgAutoloadClasses['SpecialFeedbackDashboard'] = $moodBarDir . 'SpecialFeedbackDashboard.php'; |
50 | 53 | $wgSpecialPages['FeedbackDashboard'] = 'SpecialFeedbackDashboard'; |
51 | 54 | |
52 | | -$dashboardFormsPath = dirname(__FILE__) . '/DashboardForms.php'; |
| 55 | +$dashboardFormsPath = $moodBarDir . 'DashboardForms.php'; |
53 | 56 | $wgAutoloadClasses['MBDashboardForm'] = $dashboardFormsPath; |
54 | 57 | $wgAutoloadClasses['MBActionForm'] = $dashboardFormsPath; |
55 | 58 | $wgAutoloadClasses['MBHideForm'] = $dashboardFormsPath; |
— | — | @@ -72,12 +75,12 @@ |
73 | 76 | $wgGroupPermissions['sysop']['moodbar-admin'] = true; |
74 | 77 | |
75 | 78 | // Internationalisation |
76 | | -$wgExtensionMessagesFiles['MoodBar'] = dirname(__FILE__).'/MoodBar.i18n.php'; |
77 | | -$wgExtensionMessagesFiles['MoodBarAliases'] = dirname( __FILE__ ) . '/MoodBar.alias.php'; |
| 79 | +$wgExtensionMessagesFiles['MoodBar'] = $moodBarDir . 'MoodBar.i18n.php'; |
| 80 | +$wgExtensionMessagesFiles['MoodBarAliases'] = $moodBarDir . 'MoodBar.alias.php'; |
78 | 81 | |
79 | 82 | // Resources |
80 | 83 | $mbResourceTemplate = array( |
81 | | - 'localBasePath' => dirname(__FILE__) . '/modules', |
| 84 | + 'localBasePath' => $moodBarDir . 'modules', |
82 | 85 | 'remoteExtPath' => 'MoodBar/modules' |
83 | 86 | ); |
84 | 87 | |