Index: trunk/extensions/EducationProgram/EducationProgram.settings.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | 'ambassadorCommonsUrl' => 'https://commons.wikimedia.org/wiki/Special:UploadWizard', |
42 | 42 | 'citylessCountries' => array( 'BT', 'BV', 'IO', 'VG', 'TD', 'CX', 'CC', 'KM', 'DJ', 'GQ', 'FK', 'FX', 'TF', 'GW', 'HM', 'KI', 'YT', 'MS', 'NR', 'NU', 'NF', 'PN', 'SH', 'PM', 'WS', 'SC', 'GS', 'SJ', 'TK', 'TP', 'TV', 'UM', 'VU', 'EH' ), |
43 | 43 | 'ambassadorImgWidth' => 140, |
44 | | - 'recentActivityLimit' => 17 * 60 * 60, |
| 44 | + 'recentActivityLimit' => 24 * 60 * 60, |
45 | 45 | 'resourceDir' => $resourceDir, |
46 | 46 | 'imageDir' => $resourceDir . 'images/', |
47 | 47 | ); |
Index: trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php |
— | — | @@ -32,14 +32,35 @@ |
33 | 33 | public function execute( $subPage ) { |
34 | 34 | parent::execute( $subPage ); |
35 | 35 | |
| 36 | + $cache = wfGetCache( CACHE_ANYTHING ); |
| 37 | + $cacheKey = wfMemcKey( get_class( $this ), $this->getLanguage()->getCode() ); |
| 38 | + $cachedHTML = $cache->get( $cacheKey ); |
| 39 | + |
| 40 | + $out = $this->getOutput(); |
| 41 | + |
| 42 | + if ( $this->getRequest()->getText( 'action' ) !== 'purge' && is_string( $cachedHTML ) ) { |
| 43 | + $html = $cachedHTML; |
| 44 | + } |
| 45 | + else { |
| 46 | + $conds = array( 'last_active > ' . wfGetDB( DB_SLAVE )->addQuotes( |
| 47 | + wfTimestamp( TS_MW, time() - ( EPSettings::get( 'recentActivityLimit' ) ) ) |
| 48 | + ) ); |
| 49 | + |
| 50 | + $this->displayStudentMeter( $conds ); |
| 51 | + $this->displayPager( $conds ); |
| 52 | + |
| 53 | + $html = $out->getHTML(); |
| 54 | + $cache->set( $cacheKey, $html, 3600 ); |
| 55 | + } |
| 56 | + |
| 57 | + $out->clearHTML(); |
| 58 | + |
36 | 59 | $this->displayNavigation(); |
37 | 60 | |
38 | | - $conds = array( 'last_active > ' . wfGetDB( DB_SLAVE )->addQuotes( |
39 | | - wfTimestamp( TS_MW, time() - ( EPSettings::get( 'recentActivityLimit' ) ) ) |
40 | | - ) ); |
| 61 | + $out->addHTML( $html ); |
| 62 | + } |
41 | 63 | |
42 | | - $this->showStudentMeter( $conds ); |
43 | | - |
| 64 | + public function displayPager( array $conds ) { |
44 | 65 | $out = $this->getOutput(); |
45 | 66 | |
46 | 67 | $pager = new EPStudentActivityPager( $this->getContext(), $conds ); |
— | — | @@ -59,14 +80,14 @@ |
60 | 81 | } |
61 | 82 | } |
62 | 83 | |
63 | | - public function showStudentMeter( array $conds ) { |
| 84 | + public function displayStudentMeter( array $conds ) { |
64 | 85 | $studentCount = EPStudents::singleton()->count( $conds ); |
65 | 86 | |
66 | 87 | if ( $studentCount < 10 ) { |
67 | 88 | $image = $studentCount < 5 ? 0 : 5; |
68 | 89 | } |
69 | 90 | else { |
70 | | - $image = floor( $studentCount / 10 ); |
| 91 | + $image = min( round( $studentCount / 10 ) * 10, 60 ); |
71 | 92 | } |
72 | 93 | |
73 | 94 | $message = $this->msg( 'ep-studentactivity-count', $studentCount )->escaped(); |
Index: trunk/extensions/EducationProgram/includes/EPStudentActivityPager.php |
— | — | @@ -113,7 +113,8 @@ |
114 | 114 | $value = EPCourses::singleton()->getLinkFor( $this->courseNames[$value] ); |
115 | 115 | } |
116 | 116 | else { |
117 | | - wfWarn( 'Course id not in $this->courseNames in ' . __METHOD__ ); |
| 117 | + // TODO: enable |
| 118 | + //wfWarn( 'Course id not in $this->courseNames in ' . __METHOD__ ); |
118 | 119 | } |
119 | 120 | break; |
120 | 121 | case 'org_id': |
— | — | @@ -130,7 +131,8 @@ |
131 | 132 | } |
132 | 133 | } |
133 | 134 | else { |
134 | | - wfWarn( 'Course id not in $this->courseOrgs in ' . __METHOD__ ); |
| 135 | + // TODO: enable |
| 136 | + //wfWarn( 'Course id not in $this->courseOrgs in ' . __METHOD__ ); |
135 | 137 | } |
136 | 138 | break; |
137 | 139 | } |