Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/DailyTotal_body.php |
— | — | @@ -1,137 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Special Page for Contribution statistics extension |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -class SpecialDailyTotal extends IncludableSpecialPage { |
11 | | - |
12 | | - protected $sharedMaxAge = 300; // Cache for 5 minutes on the server side |
13 | | - protected $maxAge = 300; // Cache for 5 minutes on the client side |
14 | | - |
15 | | - /* Functions */ |
16 | | - |
17 | | - public function __construct() { |
18 | | - parent::__construct( 'DailyTotal' ); |
19 | | - } |
20 | | - |
21 | | - public function execute( $sub ) { |
22 | | - global $wgRequest, $wgOut; |
23 | | - |
24 | | - $js = $wgRequest->getBool( 'js', false ); |
25 | | - |
26 | | - $timezone = $wgRequest->getText( 'timezone', '0' ); |
27 | | - |
28 | | - /* Setup */ |
29 | | - $wgOut->disable(); |
30 | | - $this->sendHeaders(); |
31 | | - |
32 | | - $zoneList = array ( |
33 | | - '-12' => array( 'name' => 'Kwajalein', 'offset' => '-12:00' ), |
34 | | - '-11' => array( 'name' => 'Pacific/Midway', 'offset' => '-11:00' ), |
35 | | - '-10' => array( 'name' => 'Pacific/Honolulu', 'offset' => '-10:00' ), |
36 | | - '-9' => array( 'name' => 'America/Anchorage', 'offset' => '-09:00' ), |
37 | | - '-8' => array( 'name' => 'America/Los_Angeles', 'offset' => '-08:00' ), |
38 | | - '-7' => array( 'name' => 'America/Denver', 'offset' => '-07:00' ), |
39 | | - '-6' => array( 'name' => 'America/Tegucigalpa', 'offset' => '-06:00' ), |
40 | | - '-5' => array( 'name' => 'America/New_York', 'offset' => '-05:00' ), |
41 | | - '-4.5' => array( 'name' => 'America/Caracas', 'offset' => '-04:30' ), |
42 | | - '-4' => array( 'name' => 'America/Halifax', 'offset' => '-04:00' ), |
43 | | - '-3.5' => array( 'name' => 'America/St_Johns', 'offset' => '-03:30' ), |
44 | | - '-3' => array( 'name' => 'America/Sao_Paulo', 'offset' => '-03:00' ), |
45 | | - '-2' => array( 'name' => 'Atlantic/South_Georgia', 'offset' => '-02:00' ), |
46 | | - '-1' => array( 'name' => 'Atlantic/Azores', 'offset' => '-01:00' ), |
47 | | - '0' => array( 'name' => 'UTC', 'offset' => '+00:00' ), |
48 | | - '1' => array( 'name' => 'Europe/Belgrade', 'offset' => '+01:00' ), |
49 | | - '2' => array( 'name' => 'Europe/Minsk', 'offset' => '+02:00' ), |
50 | | - '3' => array( 'name' => 'Asia/Kuwait', 'offset' => '+03:00' ), |
51 | | - '3.5' => array( 'name' => 'Asia/Tehran', 'offset' => '+03:30' ), |
52 | | - '4' => array( 'name' => 'Asia/Muscat', 'offset' => '+04:00' ), |
53 | | - '5' => array( 'name' => 'Asia/Yekaterinburg', 'offset' => '+05:00' ), |
54 | | - '5.5' => array( 'name' => 'Asia/Kolkata', 'offset' => '+05:30' ), |
55 | | - '5.75' => array( 'name' => 'Asia/Katmandu', 'offset' => '+05:45' ), |
56 | | - '6' => array( 'name' => 'Asia/Dhaka', 'offset' => '+06:00' ), |
57 | | - '6.5' => array( 'name' => 'Asia/Rangoon', 'offset' => '+06:30' ), |
58 | | - '7' => array( 'name' => 'Asia/Krasnoyarsk', 'offset' => '+07:00' ), |
59 | | - '8' => array( 'name' => 'Asia/Brunei', 'offset' => '+08:00' ), |
60 | | - '9' => array( 'name' => 'Asia/Seoul', 'offset' => '+09:00' ), |
61 | | - '9.5' => array( 'name' => 'Australia/Darwin', 'offset' => '+09:30' ), |
62 | | - '10' => array( 'name' => 'Australia/Canberra', 'offset' => '+10:00' ), |
63 | | - '11' => array( 'name' => 'Asia/Magadan', 'offset' => '+11:00' ), |
64 | | - '12' => array( 'name' => 'Pacific/Fiji', 'offset' => '+12:00' ), |
65 | | - '13' => array( 'name' => 'Pacific/Tongatapu', 'offset' => '+13:00' ), |
66 | | - ); |
67 | | - |
68 | | - // Translate timezone param to timezone name for PHP |
69 | | - if ( array_key_exists( $timezone, $zoneList ) ) { |
70 | | - $timeZoneName = $zoneList[$timezone]['name']; |
71 | | - } else { |
72 | | - $timeZoneName = 'UTC'; |
73 | | - } |
74 | | - |
75 | | - // Translate timezone param to timezone offset for MySQL |
76 | | - if ( array_key_exists( $timezone, $zoneList ) ) { |
77 | | - $timeZoneOffset = $zoneList[$timezone]['offset']; |
78 | | - } else { |
79 | | - $timeZoneOffset = '+00:00'; |
80 | | - } |
81 | | - |
82 | | - $setTimeZone = date_default_timezone_set( $timeZoneName ); |
83 | | - $start = date( 'Y-m-d' ); // Get the current date in the requested timezone |
84 | | - $total = $this->query( $timeZoneOffset, $start ); |
85 | | - |
86 | | - $content = "wgFundraisingDailyTotal = $total;"; |
87 | | - |
88 | | - if ( $js ) { |
89 | | - echo $content; |
90 | | - } else { |
91 | | - echo $total; |
92 | | - } |
93 | | - } |
94 | | - |
95 | | - /* Private Functions */ |
96 | | - |
97 | | - private function query( $timeZoneOffset, $start ) { |
98 | | - global $wgMemc, $egFundraiserStatisticsMinimum, $egFundraiserStatisticsMaximum, $egFundraiserStatisticsCacheTimeout; |
99 | | - |
100 | | - $key = wfMemcKey( 'fundraiserstatistics', $timeZoneOffset, $start ); |
101 | | - $cache = $wgMemc->get( $key ); |
102 | | - if ( $cache != false && $cache != -1 ) { |
103 | | - return $cache; |
104 | | - } |
105 | | - |
106 | | - // Use database |
107 | | - $dbr = efContributionReportingConnection(); |
108 | | - #$dbr = wfGetDB( DB_MASTER ); |
109 | | - $conditions = array( |
110 | | - 'converted_amount >= ' . $egFundraiserStatisticsMinimum, |
111 | | - 'converted_amount <= ' . $egFundraiserStatisticsMaximum, |
112 | | - "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$timeZoneOffset'),'%Y-%m-%d') = '$start'" |
113 | | - ); |
114 | | - |
115 | | - $select = $dbr->select( 'public_reporting', |
116 | | - array( |
117 | | - 'sum(converted_amount)' |
118 | | - ), |
119 | | - $conditions, |
120 | | - __METHOD__, |
121 | | - array( |
122 | | - 'ORDER BY' => 'received' |
123 | | - ) |
124 | | - ); |
125 | | - $row = $dbr->fetchRow( $select ); |
126 | | - $total = $row['sum(converted_amount)']; |
127 | | - if ( !$total ) $total = 0; |
128 | | - |
129 | | - $wgMemc->set( $key, $total, $egFundraiserStatisticsCacheTimeout ); |
130 | | - return $total; |
131 | | - } |
132 | | - |
133 | | - private function sendHeaders() { |
134 | | - global $wgJsMimeType; |
135 | | - header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
136 | | - header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
137 | | - } |
138 | | -} |
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/YearlyTotal_body.php |
— | — | @@ -1,77 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Special Page for Contribution statistics extension |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -class SpecialYearlyTotal extends IncludableSpecialPage { |
11 | | - |
12 | | - protected $sharedMaxAge = 600; // Cache for 10 minutes on the server side |
13 | | - protected $maxAge = 600; // Cache for 10 minutes on the client side |
14 | | - |
15 | | - /* Functions */ |
16 | | - |
17 | | - public function __construct() { |
18 | | - parent::__construct( 'YearlyTotal' ); |
19 | | - } |
20 | | - |
21 | | - public function execute( $sub ) { |
22 | | - global $wgRequest, $wgOut, $egFundraiserStatisticsFundraisers; |
23 | | - |
24 | | - $js = $wgRequest->getBool( 'js', false ); |
25 | | - |
26 | | - $adjustment = $wgRequest->getVal( 'adjustment' ); |
27 | | - // Make sure it's a number |
28 | | - if ( is_nan( $adjustment ) ) { |
29 | | - $adjustment = 0; |
30 | | - } |
31 | | - |
32 | | - /* Setup */ |
33 | | - $wgOut->disable(); |
34 | | - $this->sendHeaders(); |
35 | | - |
36 | | - $total = $this->query( $adjustment ); |
37 | | - |
38 | | - $content = "wgFundraisingYearlyTotal = $total;"; |
39 | | - |
40 | | - if ( $js ) { |
41 | | - echo $content; |
42 | | - } else { |
43 | | - echo $total; |
44 | | - } |
45 | | - } |
46 | | - |
47 | | - /* Private Functions */ |
48 | | - |
49 | | - private function query( $adjustment ) { |
50 | | - global $wgMemc, $egFundraiserStatisticsCacheTimeout, $egFundraiserStatisticsFundraisers; |
51 | | - |
52 | | - $currenctFundraiserIndex = count( $egFundraiserStatisticsFundraisers ) - 1; |
53 | | - $year = $egFundraiserStatisticsFundraisers[$currenctFundraiserIndex]['id']; |
54 | | - |
55 | | - $key = wfMemcKey( 'fundraiserstatistics', $year, $adjustment ); |
56 | | - $cache = $wgMemc->get( $key ); |
57 | | - if ( $cache != false && $cache != -1 ) { |
58 | | - return $cache; |
59 | | - } |
60 | | - |
61 | | - // Get the timestamp for the start of the current fundraiser |
62 | | - // Note: This depends on the fundraisers being listed in chronological order |
63 | | - $start = strtotime( $egFundraiserStatisticsFundraisers[$currenctFundraiserIndex]['start'] ); |
64 | | - $start = intval( wfTimestampOrNull( TS_UNIX, $start ) ); |
65 | | - |
66 | | - $total = efContributionReportingTotal( $start, $adjustment ); |
67 | | - if ( !$total ) $total = 0; |
68 | | - |
69 | | - $wgMemc->set( $key, $total, $egFundraiserStatisticsCacheTimeout ); |
70 | | - return $total; |
71 | | - } |
72 | | - |
73 | | - private function sendHeaders() { |
74 | | - global $wgJsMimeType; |
75 | | - header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
76 | | - header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
77 | | - } |
78 | | -} |
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php |
— | — | @@ -41,16 +41,12 @@ |
42 | 42 | $wgAutoloadClasses['SpecialContributionStatistics'] = $dir . 'ContributionStatistics_body.php'; |
43 | 43 | $wgAutoloadClasses['SpecialFundraiserStatistics'] = $dir . 'FundraiserStatistics_body.php'; |
44 | 44 | $wgAutoloadClasses['SpecialContributionTrackingStatistics'] = $dir . 'ContributionTrackingStatistics_body.php'; |
45 | | -$wgAutoloadClasses['SpecialDailyTotal'] = $dir . 'DailyTotal_body.php'; |
46 | | -$wgAutoloadClasses['SpecialYearlyTotal'] = $dir . 'YearlyTotal_body.php'; |
47 | 45 | |
48 | 46 | $wgSpecialPages['ContributionHistory'] = 'ContributionHistory'; |
49 | 47 | $wgSpecialPages['ContributionTotal'] = 'ContributionTotal'; |
50 | 48 | $wgSpecialPages['ContributionStatistics'] = 'SpecialContributionStatistics'; |
51 | 49 | $wgSpecialPages['FundraiserStatistics'] = 'SpecialFundraiserStatistics'; |
52 | 50 | $wgSpecialPages['ContributionTrackingStatistics'] = 'SpecialContributionTrackingStatistics'; |
53 | | -$wgSpecialPages['DailyTotal'] = 'SpecialDailyTotal'; |
54 | | -$wgSpecialPages['YearlyTotal'] = 'SpecialYearlyTotal'; |
55 | 51 | $wgSpecialPageGroups['ContributionHistory'] = 'contribution'; |
56 | 52 | $wgSpecialPageGroups['ContributionTotal'] = 'contribution'; |
57 | 53 | $wgSpecialPageGroups['ContributionStatistics'] = 'contribution'; |
— | — | @@ -69,7 +65,6 @@ |
70 | 66 | $egContributionStatisticsViewDays = 7; |
71 | 67 | |
72 | 68 | // Fundraiser dates |
73 | | -// Please list these in chronological order |
74 | 69 | $egFundraiserStatisticsFundraisers = array( |
75 | 70 | array( |
76 | 71 | 'id' => '2007', |
— | — | @@ -165,7 +160,6 @@ |
166 | 161 | |
167 | 162 | function efContributionReportingTotal( $start, $fudgeFactor ) { |
168 | 163 | $db = efContributionReportingConnection(); |
169 | | - #$db = wfGetDB( DB_MASTER ); |
170 | 164 | |
171 | 165 | $sql = 'SELECT ROUND( SUM(converted_amount) ) AS ttl FROM public_reporting'; |
172 | 166 | |
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
173 | 167 | Reverse-merged /trunk/extensions/ContributionReporting/ContributionReporting.php:r103884,103947,103959,103967,103991,103996 |
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function execute( $sub ) { |
19 | | - global $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
| 19 | + global $wgRequest, $wgOut, $wgUser, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
20 | 20 | |
21 | 21 | $showYear = array(); |
22 | 22 | foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { |
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
23 | 23 | Reverse-merged /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php:r75680 |
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionTotal_body.php |
— | — | @@ -8,6 +8,8 @@ |
9 | 9 | function execute( $par ) { |
10 | 10 | global $wgRequest, $wgOut; |
11 | 11 | |
| 12 | + wfLoadExtensionMessages( 'ContributionReporting' ); |
| 13 | + |
12 | 14 | $this->setHeaders(); |
13 | 15 | |
14 | 16 | # Get request data from, e.g. |
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionTotal_body.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
15 | 17 | Reverse-merged /trunk/extensions/ContributionReporting/ContributionTotal_body.php:r75671,75680 |
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php |
— | — | @@ -171,6 +171,7 @@ |
172 | 172 | public function showCurrencyTotals() { |
173 | 173 | global $wgOut, $wgLang; |
174 | 174 | |
| 175 | + $msg = ''; |
175 | 176 | if ( $this->mMode == 'range' ) { |
176 | 177 | $msg = wfMsg( 'contribstats-currency-range-totals', |
177 | 178 | $wgLang->date( wfTimestamp( TS_MW, $this->mStartDate ) ), |
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
178 | 179 | Reverse-merged /trunk/extensions/ContributionReporting/ContributionStatistics_body.php:r75680 |
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting |
___________________________________________________________________ |
Modified: svn:mergeinfo |
179 | 180 | Reverse-merged /trunk/extensions/ContributionReporting:r75671,75680,103884,103947,103959,103967,103991,103996 |