r114204 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114203‎ | r114204 | r114205 >
Date:22:25, 19 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
caching of special:students, cas, oas
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPCA.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOA.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCAs.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialOAs.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialStudents.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialStudents.php
@@ -34,11 +34,22 @@
3535
3636 if ( $this->subPage === '' ) {
3737 $this->displayNavigation();
38 - EPStudent::displayPager( $this->getContext() );
 38+
 39+ $this->startCache( 3600 );
 40+ $this->addCachedHTML( 'EPStudent::getPager', $this->getContext() );
 41+ $this->saveCache();
3942 }
4043 else {
4144 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Student', $this->subPage )->getLocalURL() );
4245 }
4346 }
4447
 48+ /**
 49+ * @see SpecialCachedPage::getCacheKey
 50+ * @return array
 51+ */
 52+ protected function getCacheKey() {
 53+ return array_merge( $this->getRequest()->getValues(), parent::getCacheKey() );
 54+ }
 55+
4556 }
Index: trunk/extensions/EducationProgram/specials/SpecialOAs.php
@@ -34,7 +34,10 @@
3535
3636 if ( $this->subPage === '' ) {
3737 $this->displayNavigation();
38 - EPOA::displayPager( $this->getContext() );
 38+
 39+ $this->startCache( 3600 );
 40+ $this->addCachedHTML( 'EPOA::getPager', $this->getContext() );
 41+ $this->saveCache();
3942 }
4043 else {
4144 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'OnlineAmbassador', $this->subPage )->getLocalURL() );
Index: trunk/extensions/EducationProgram/specials/SpecialCAs.php
@@ -34,7 +34,10 @@
3535
3636 if ( $this->subPage === '' ) {
3737 $this->displayNavigation();
38 - EPCA::displayPager( $this->getContext() );
 38+
 39+ $this->startCache( 3600 );
 40+ $this->addCachedHTML( 'EPCA::getPager', $this->getContext() );
 41+ $this->saveCache();
3942 }
4043 else {
4144 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'CampusAmbassador', $this->subPage )->getLocalURL() );
Index: trunk/extensions/EducationProgram/includes/EPCA.php
@@ -20,22 +20,23 @@
2121 *
2222 * @param IContextSource $context
2323 * @param array $conditions
 24+ *
 25+ * @return string
2426 */
25 - public static function displayPager( IContextSource $context, array $conditions = array() ) {
 27+ public static function getPager( IContextSource $context, array $conditions = array() ) {
2628 $pager = new EPCAPager( $context, $conditions );
2729
2830 if ( $pager->getNumRows() ) {
29 - $context->getOutput()->addHTML(
 31+ return
3032 $pager->getFilterControl() .
31 - $pager->getNavigationBar() .
32 - $pager->getBody() .
33 - $pager->getNavigationBar() .
34 - $pager->getMultipleItemControl()
35 - );
 33+ $pager->getNavigationBar() .
 34+ $pager->getBody() .
 35+ $pager->getNavigationBar() .
 36+ $pager->getMultipleItemControl();
3637 }
3738 else {
38 - $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
39 - $context->getOutput()->addWikiMsg( 'ep-ca-noresults' );
 39+ return $pager->getFilterControl( true ) .
 40+ $context->msg( 'ep-ca-noresults' )->escaped();
4041 }
4142 }
4243
Index: trunk/extensions/EducationProgram/includes/EPOA.php
@@ -20,22 +20,23 @@
2121 *
2222 * @param IContextSource $context
2323 * @param array $conditions
 24+ *
 25+ * @return string
2426 */
25 - public static function displayPager( IContextSource $context, array $conditions = array() ) {
 27+ public static function getPager( IContextSource $context, array $conditions = array() ) {
2628 $pager = new EPOAPager( $context, $conditions );
2729
2830 if ( $pager->getNumRows() ) {
29 - $context->getOutput()->addHTML(
 31+ return
3032 $pager->getFilterControl() .
31 - $pager->getNavigationBar() .
32 - $pager->getBody() .
33 - $pager->getNavigationBar() .
34 - $pager->getMultipleItemControl()
35 - );
 33+ $pager->getNavigationBar() .
 34+ $pager->getBody() .
 35+ $pager->getNavigationBar() .
 36+ $pager->getMultipleItemControl();
3637 }
3738 else {
38 - $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
39 - $context->getOutput()->addWikiMsg( 'ep-oa-noresults' );
 39+ return $pager->getFilterControl( true ) .
 40+ $context->msg( 'ep-oa-noresults' )->escaped();
4041 }
4142 }
4243
Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -20,22 +20,23 @@
2121 *
2222 * @param IContextSource $context
2323 * @param array $conditions
 24+ *
 25+ * @return string
2426 */
25 - public static function displayPager( IContextSource $context, array $conditions = array() ) {
 27+ public static function getPager( IContextSource $context, array $conditions = array() ) {
2628 $pager = new EPStudentPager( $context, $conditions );
2729
2830 if ( $pager->getNumRows() ) {
29 - $context->getOutput()->addHTML(
 31+ return
3032 $pager->getFilterControl() .
31 - $pager->getNavigationBar() .
32 - $pager->getBody() .
33 - $pager->getNavigationBar() .
34 - $pager->getMultipleItemControl()
35 - );
 33+ $pager->getNavigationBar() .
 34+ $pager->getBody() .
 35+ $pager->getNavigationBar() .
 36+ $pager->getMultipleItemControl();
3637 }
3738 else {
38 - $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
39 - $context->getOutput()->addWikiMsg( 'ep-students-noresults' );
 39+ return $pager->getFilterControl( true ) .
 40+ $context->msg( 'ep-students-noresults' )->escaped();
4041 }
4142 }
4243

Status & tagging log