r114163 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114162‎ | r114163 | r114164 >
Date:18:40, 19 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on caching of special:institutions
Modified paths:
  • /trunk/extensions/EducationProgram/compat/SpecialCachedPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitutions.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/compat/SpecialCachedPage.php
@@ -2,15 +2,11 @@
33
44 /**
55 * Abstract special page class with scaffolding for caching the HTML output.
 6+ * This copy is kept for compatibility with MW < 1.20.
 7+ * As of 1.20, this class can be found at includes/specials/SpecialCachedPage.php
68 *
7 - * To enable the caching functionality, the cacheExpiry field should be set
8 - * in the constructor.
 9+ * TODO: uncomment when done w/ dev (double declaration makes PhpStorm mad :)
910 *
10 - * To add HTML that should be cached, use addCachedHTML like this:
11 - * $this->addCachedHTML( array( $this, 'displayCachedContent' ) );
12 - *
13 - * After adding the last HTML that should be cached, call $this->saveCache();
14 - *
1511 * @since 0.1
1612 *
1713 * @file SpecialCachedPage.php
@@ -19,241 +15,241 @@
2016 * @licence GNU GPL v3 or later
2117 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
2218 */
23 -abstract class SpecialCachedPage extends SpecialPage {
24 -
25 - /**
26 - * The time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
27 - *
28 - * @since 0.1
29 - * @var integer|null
30 - */
31 - protected $cacheExpiry = null;
32 -
33 - /**
34 - * List of HTML chunks to be cached (if !hasCached) or that where cashed (of hasCached).
35 - * If no cached already, then the newly computed chunks are added here,
36 - * if it as cached already, chunks are removed from this list as they are needed.
37 - *
38 - * @since 0.1
39 - * @var array
40 - */
41 - protected $cachedChunks;
42 -
43 - /**
44 - * Indicates if the to be cached content was already cached.
45 - * Null if this information is not available yet.
46 - *
47 - * @since 0.1
48 - * @var boolean|null
49 - */
50 - protected $hasCached = null;
51 -
52 - /**
53 - * Main method.
54 - *
55 - * @since 0.1
56 - *
57 - * @param string|null $subPage
58 - */
59 - public function execute( $subPage ) {
60 - if ( $this->getRequest()->getText( 'action' ) === 'purge' ) {
61 - $this->hasCached = false;
62 - }
63 -
64 - if ( !is_null( $this->cacheExpiry ) ) {
65 - $this->initCaching();
66 -
67 - if ( $this->hasCached === true ) {
68 - $this->getOutput()->setSubtitle( $this->getCachedNotice( $subPage ) );
69 - }
70 - }
71 - }
72 -
73 - /**
74 - * Returns a message that notifies the user he/she is looking at
75 - * a cached version of the page, including a refresh link.
76 - *
77 - * @since 0.1
78 - *
79 - * @param string|null $subPage
80 - *
81 - * @return string
82 - */
83 - protected function getCachedNotice( $subPage ) {
84 - $refreshArgs = $this->getRequest()->getQueryValues();
85 - unset( $refreshArgs['title'] );
86 - $refreshArgs['action'] = 'purge';
87 -
88 - $refreshLink = Linker::link(
89 - $this->getTitle( $subPage ),
90 - $this->msg( 'cachedspecial-refresh-now' )->escaped(),
91 - array(),
92 - $refreshArgs
93 - );
94 -
95 - if ( $this->cacheExpiry < 86400 * 3650 ) {
96 - $message = $this->msg(
97 - 'cachedspecial-viewing-cached-ttl',
98 - $this->getDurationText( $this->cacheExpiry )
99 - )->escaped();
100 - }
101 - else {
102 - $message = $this->msg(
103 - 'cachedspecial-viewing-cached-ts'
104 - )->escaped();
105 - }
106 -
107 - return $message . ' ' . $refreshLink;
108 - }
109 -
110 - /**
111 - * Returns a message with the time to live of the cache.
112 - * Takes care of compatibility with MW < 1.20, in which Language::formatDuration was introduced.
113 - *
114 - * @since 0.1
115 - *
116 - * @param integer $seconds
117 - * @param array $chosenIntervals
118 - *
119 - * @return string
120 - */
121 - protected function getDurationText( $seconds, array $chosenIntervals = array( 'years', 'days', 'hours', 'minutes', 'seconds' ) ) {
122 - if ( method_exists( $this->getLanguage(), 'formatDuration' ) ) {
123 - return $this->getLanguage()->formatDuration( $seconds, $chosenIntervals );
124 - }
125 - else {
126 - $intervals = array(
127 - 'years' => 31557600, // 86400 * 365.25
128 - 'weeks' => 604800,
129 - 'days' => 86400,
130 - 'hours' => 3600,
131 - 'minutes' => 60,
132 - 'seconds' => 1,
133 - );
134 -
135 - if ( !empty( $chosenIntervals ) ) {
136 - $intervals = array_intersect_key( $intervals, array_flip( $chosenIntervals ) );
137 - }
138 -
139 - $segments = array();
140 -
141 - foreach ( $intervals as $name => $length ) {
142 - $value = floor( $seconds / $length );
143 -
144 - if ( $value > 0 || ( $name == 'seconds' && empty( $segments ) ) ) {
145 - $seconds -= $value * $length;
146 - $segments[] = $this->msg( 'duration-' . $name, array( $value ) )->escaped();
147 - }
148 - }
149 -
150 - return $this->getLanguage()->listToText( $segments );
151 - }
152 - }
153 -
154 - /**
155 - * Initializes the caching if not already done so.
156 - * Should be called before any of the caching functionality is used.
157 - *
158 - * @since 0.1
159 - */
160 - protected function initCaching() {
161 - if ( is_null( $this->hasCached ) ) {
162 - $cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKey() );
163 -
164 - $this->hasCached = is_array( $cachedChunks );
165 - $this->cachedChunks = $this->hasCached ? $cachedChunks : array();
166 - }
167 - }
168 -
169 - /**
170 - * Add some HTML to be cached.
171 - * This is done by providing a callback function that should
172 - * return the HTML to be added. It will only be called if the
173 - * item is not in the cache yet or when the cache has been invalidated.
174 - *
175 - * @since 0.1
176 - *
177 - * @param {function} $callback
178 - * @param array $args
179 - * @param string|null $key
180 - */
181 - public function addCachedHTML( $callback, $args = array(), $key = null ) {
182 - $this->initCaching();
183 -
184 - if ( $this->hasCached ) {
185 - $html = '';
186 -
187 - if ( is_null( $key ) ) {
188 - $itemKey = array_keys( array_slice( $this->cachedChunks, 0, 1 ) );
189 - $itemKey = array_shift( $itemKey );
190 -
191 - if ( !is_integer( $itemKey ) ) {
192 - wfWarn( "Attempted to get item with non-numeric key while the next item in the queue has a key ($itemKey) in " . __METHOD__ );
193 - }
194 - elseif ( is_null( $itemKey ) ) {
195 - wfWarn( "Attempted to get an item while the queue is empty in " . __METHOD__ );
196 - }
197 - else {
198 - $html = array_shift( $this->cachedChunks );
199 - }
200 - }
201 - else {
202 - if ( array_key_exists( $key, $this->cachedChunks ) ) {
203 - $html = $this->cachedChunks[$key];
204 - unset( $this->cachedChunks[$key] );
205 - }
206 - else {
207 - wfWarn( "There is no item with key '$key' in this->cachedChunks in " . __METHOD__ );
208 - }
209 - }
210 - }
211 - else {
212 - $html = call_user_func_array( $callback, $args );
213 -
214 - if ( is_null( $key ) ) {
215 - $this->cachedChunks[] = $html;
216 - }
217 - else {
218 - $this->cachedChunks[$key] = $html;
219 - }
220 - }
221 -
222 - $this->getOutput()->addHTML( $html );
223 - }
224 -
225 - /**
226 - * Saves the HTML to the cache in case it got recomputed.
227 - * Should be called after the last time anything is added via addCachedHTML.
228 - *
229 - * @since 0.1
230 - */
231 - public function saveCache() {
232 - if ( $this->hasCached === false && !empty( $this->cachedChunks ) ) {
233 - wfGetCache( CACHE_ANYTHING )->set( $this->getCacheKey(), $this->cachedChunks, $this->cacheExpiry );
234 - }
235 - }
236 -
237 - /**
238 - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry..
239 - *
240 - * @since 0.1
241 - *
242 - * @param integer $cacheExpiry
243 - */
244 - protected function setExpirey( $cacheExpiry ) {
245 - $this->cacheExpiry = $cacheExpiry;
246 - }
247 -
248 - /**
249 - * Returns the cache key to use to cache this page's HTML output.
250 - * Is constructed from the special page name and language code.
251 - *
252 - * @since 0.1
253 - *
254 - * @return string
255 - */
256 - protected function getCacheKey() {
257 - return wfMemcKey( $this->mName, $this->getLanguage()->getCode() );
258 - }
259 -
260 -}
 19+//abstract class SpecialCachedPage extends SpecialPage {
 20+//
 21+// /**
 22+// * The time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
 23+// *
 24+// * @since 0.1
 25+// * @var integer|null
 26+// */
 27+// protected $cacheExpiry = null;
 28+//
 29+// /**
 30+// * List of HTML chunks to be cached (if !hasCached) or that where cashed (of hasCached).
 31+// * If no cached already, then the newly computed chunks are added here,
 32+// * if it as cached already, chunks are removed from this list as they are needed.
 33+// *
 34+// * @since 0.1
 35+// * @var array
 36+// */
 37+// protected $cachedChunks;
 38+//
 39+// /**
 40+// * Indicates if the to be cached content was already cached.
 41+// * Null if this information is not available yet.
 42+// *
 43+// * @since 0.1
 44+// * @var boolean|null
 45+// */
 46+// protected $hasCached = null;
 47+//
 48+// /**
 49+// * Main method.
 50+// *
 51+// * @since 0.1
 52+// *
 53+// * @param string|null $subPage
 54+// */
 55+// public function execute( $subPage ) {
 56+// if ( $this->getRequest()->getText( 'action' ) === 'purge' ) {
 57+// $this->hasCached = false;
 58+// }
 59+//
 60+// if ( !is_null( $this->cacheExpiry ) ) {
 61+// $this->initCaching();
 62+//
 63+// if ( $this->hasCached === true ) {
 64+// $this->getOutput()->setSubtitle( $this->getCachedNotice( $subPage ) );
 65+// }
 66+// }
 67+// }
 68+//
 69+// /**
 70+// * Returns a message that notifies the user he/she is looking at
 71+// * a cached version of the page, including a refresh link.
 72+// *
 73+// * @since 0.1
 74+// *
 75+// * @param string|null $subPage
 76+// *
 77+// * @return string
 78+// */
 79+// protected function getCachedNotice( $subPage ) {
 80+// $refreshArgs = $this->getRequest()->getQueryValues();
 81+// unset( $refreshArgs['title'] );
 82+// $refreshArgs['action'] = 'purge';
 83+//
 84+// $refreshLink = Linker::link(
 85+// $this->getTitle( $subPage ),
 86+// $this->msg( 'cachedspecial-refresh-now' )->escaped(),
 87+// array(),
 88+// $refreshArgs
 89+// );
 90+//
 91+// if ( $this->cacheExpiry < 86400 * 3650 ) {
 92+// $message = $this->msg(
 93+// 'cachedspecial-viewing-cached-ttl',
 94+// $this->getDurationText( $this->cacheExpiry )
 95+// )->escaped();
 96+// }
 97+// else {
 98+// $message = $this->msg(
 99+// 'cachedspecial-viewing-cached-ts'
 100+// )->escaped();
 101+// }
 102+//
 103+// return $message . ' ' . $refreshLink;
 104+// }
 105+//
 106+// /**
 107+// * Returns a message with the time to live of the cache.
 108+// * Takes care of compatibility with MW < 1.20, in which Language::formatDuration was introduced.
 109+// *
 110+// * @since 0.1
 111+// *
 112+// * @param integer $seconds
 113+// * @param array $chosenIntervals
 114+// *
 115+// * @return string
 116+// */
 117+// protected function getDurationText( $seconds, array $chosenIntervals = array( 'years', 'days', 'hours', 'minutes', 'seconds' ) ) {
 118+// if ( method_exists( $this->getLanguage(), 'formatDuration' ) ) {
 119+// return $this->getLanguage()->formatDuration( $seconds, $chosenIntervals );
 120+// }
 121+// else {
 122+// $intervals = array(
 123+// 'years' => 31557600, // 86400 * 365.25
 124+// 'weeks' => 604800,
 125+// 'days' => 86400,
 126+// 'hours' => 3600,
 127+// 'minutes' => 60,
 128+// 'seconds' => 1,
 129+// );
 130+//
 131+// if ( !empty( $chosenIntervals ) ) {
 132+// $intervals = array_intersect_key( $intervals, array_flip( $chosenIntervals ) );
 133+// }
 134+//
 135+// $segments = array();
 136+//
 137+// foreach ( $intervals as $name => $length ) {
 138+// $value = floor( $seconds / $length );
 139+//
 140+// if ( $value > 0 || ( $name == 'seconds' && empty( $segments ) ) ) {
 141+// $seconds -= $value * $length;
 142+// $segments[] = $this->msg( 'duration-' . $name, array( $value ) )->escaped();
 143+// }
 144+// }
 145+//
 146+// return $this->getLanguage()->listToText( $segments );
 147+// }
 148+// }
 149+//
 150+// /**
 151+// * Initializes the caching if not already done so.
 152+// * Should be called before any of the caching functionality is used.
 153+// *
 154+// * @since 0.1
 155+// */
 156+// protected function initCaching() {
 157+// if ( is_null( $this->hasCached ) ) {
 158+// $cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKey() );
 159+//
 160+// $this->hasCached = is_array( $cachedChunks );
 161+// $this->cachedChunks = $this->hasCached ? $cachedChunks : array();
 162+// }
 163+// }
 164+//
 165+// /**
 166+// * Add some HTML to be cached.
 167+// * This is done by providing a callback function that should
 168+// * return the HTML to be added. It will only be called if the
 169+// * item is not in the cache yet or when the cache has been invalidated.
 170+// *
 171+// * @since 0.1
 172+// *
 173+// * @param {function} $callback
 174+// * @param array $args
 175+// * @param string|null $key
 176+// */
 177+// public function addCachedHTML( $callback, $args = array(), $key = null ) {
 178+// $this->initCaching();
 179+//
 180+// if ( $this->hasCached ) {
 181+// $html = '';
 182+//
 183+// if ( is_null( $key ) ) {
 184+// $itemKey = array_keys( array_slice( $this->cachedChunks, 0, 1 ) );
 185+// $itemKey = array_shift( $itemKey );
 186+//
 187+// if ( !is_integer( $itemKey ) ) {
 188+// wfWarn( "Attempted to get item with non-numeric key while the next item in the queue has a key ($itemKey) in " . __METHOD__ );
 189+// }
 190+// elseif ( is_null( $itemKey ) ) {
 191+// wfWarn( "Attempted to get an item while the queue is empty in " . __METHOD__ );
 192+// }
 193+// else {
 194+// $html = array_shift( $this->cachedChunks );
 195+// }
 196+// }
 197+// else {
 198+// if ( array_key_exists( $key, $this->cachedChunks ) ) {
 199+// $html = $this->cachedChunks[$key];
 200+// unset( $this->cachedChunks[$key] );
 201+// }
 202+// else {
 203+// wfWarn( "There is no item with key '$key' in this->cachedChunks in " . __METHOD__ );
 204+// }
 205+// }
 206+// }
 207+// else {
 208+// $html = call_user_func_array( $callback, $args );
 209+//
 210+// if ( is_null( $key ) ) {
 211+// $this->cachedChunks[] = $html;
 212+// }
 213+// else {
 214+// $this->cachedChunks[$key] = $html;
 215+// }
 216+// }
 217+//
 218+// $this->getOutput()->addHTML( $html );
 219+// }
 220+//
 221+// /**
 222+// * Saves the HTML to the cache in case it got recomputed.
 223+// * Should be called after the last time anything is added via addCachedHTML.
 224+// *
 225+// * @since 0.1
 226+// */
 227+// public function saveCache() {
 228+// if ( $this->hasCached === false && !empty( $this->cachedChunks ) ) {
 229+// wfGetCache( CACHE_ANYTHING )->set( $this->getCacheKey(), $this->cachedChunks, $this->cacheExpiry );
 230+// }
 231+// }
 232+//
 233+// /**
 234+// * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry..
 235+// *
 236+// * @since 0.1
 237+// *
 238+// * @param integer $cacheExpiry
 239+// */
 240+// protected function setExpirey( $cacheExpiry ) {
 241+// $this->cacheExpiry = $cacheExpiry;
 242+// }
 243+//
 244+// /**
 245+// * Returns the cache key to use to cache this page's HTML output.
 246+// * Is constructed from the special page name and language code.
 247+// *
 248+// * @since 0.1
 249+// *
 250+// * @return string
 251+// */
 252+// protected function getCacheKey() {
 253+// return wfMemcKey( $this->mName, $this->getLanguage()->getCode() );
 254+// }
 255+//
 256+//}
Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php
@@ -31,16 +31,40 @@
3232 * @param string|null $subPage
3333 */
3434 public function execute( $subPage ) {
 35+
3536 parent::execute( $subPage );
3637
3738 if ( $this->subPage === '' ) {
 39+ $this->startCache( 3600, $this->getUser()->isAnon() );
 40+
3841 $this->displayNavigation();
39 - EPOrg::displayAddNewControl( $this->getContext() );
40 - EPOrg::displayPager( $this->getContext() );
 42+
 43+ if ( $this->getUser()->isAllowed( 'ep-org' ) ) {
 44+ $this->getOutput()->addModules( 'ep.addorg' );
 45+ $this->addCachedHTML( 'EPOrg::getAddNewControl', array( $this->getContext() ) );
 46+ }
 47+
 48+ $this->addCachedHTML( 'EPOrg::getPager', array( $this->getContext() ) );
 49+
 50+ $this->saveCache();
4151 }
4252 else {
4353 $this->getOutput()->redirect( Title::newFromText( $this->subPage, EP_NS_INSTITUTION )->getLocalURL() );
4454 }
4555 }
4656
 57+ /**
 58+ * @see SpecialCachedPage::getCacheKey
 59+ * @return array
 60+ */
 61+ protected function getCacheKey() {
 62+ $values = $this->getRequest()->getValues();
 63+
 64+ if ( array_key_exists( 'action', $values ) && $values['action'] === 'purge' ) {
 65+ unset( $values['action'] );
 66+ }
 67+
 68+ return array_merge( $values, parent::getCacheKey() );
 69+ }
 70+
4771 }
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -54,7 +54,7 @@
5555 * @return boolean
5656 */
5757 public function execute( $subPage ) {
58 - parent::execute( $subPage );
 58+ // parent::execute( $subPage );
5959
6060 $subPage = is_null( $subPage ) ? '' : $subPage;
6161 $this->subPage = trim( str_replace( '_', ' ', $subPage ) );
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
@@ -19,7 +19,6 @@
2020 * @since 0.1
2121 */
2222 public function __construct() {
23 - $this->cacheExpiry = 3600;
2423 parent::__construct( 'EducationProgram' );
2524 }
2625
@@ -33,6 +32,8 @@
3433 public function execute( $subPage ) {
3534 parent::execute( $subPage );
3635
 36+ $this->startCache( 3600 );
 37+
3738 $this->displayNavigation();
3839
3940 $this->addCachedHTML( array( $this, 'displaySummaryTable' ) );
Index: trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php
@@ -19,7 +19,6 @@
2020 * @since 0.1
2121 */
2222 public function __construct() {
23 - $this->cacheExpiry = 180;
2423 parent::__construct( 'StudentActivity' );
2524 }
2625
@@ -33,6 +32,8 @@
3433 public function execute( $subPage ) {
3534 parent::execute( $subPage );
3635
 36+ $this->startCache( 180 );
 37+
3738 $this->getOutput()->addModules( 'ep.studentactivity' );
3839
3940 $this->displayNavigation();
Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -135,7 +135,7 @@
136136 }
137137
138138 /**
139 - * Adds a control to add a new org to the provided context.
 139+ * Returns thr HTML for a control to add a new org to the provided context.
140140 * Adittional arguments can be provided to set the default values for the control fields.
141141 *
142142 * @since 0.1
@@ -143,40 +143,34 @@
144144 * @param IContextSource $context
145145 * @param array $args
146146 *
147 - * @return boolean
 147+ * @return string
148148 */
149 - public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
150 - if ( !$context->getUser()->isAllowed( 'ep-org' ) ) {
151 - return false;
152 - }
153 -
154 - $out = $context->getOutput();
 149+ public static function getAddNewControl( IContextSource $context, array $args = array() ) {
 150+ $html = '';
155151
156 - $out->addModules( 'ep.addorg' );
157 -
158 - $out->addHTML( Html::openElement(
 152+ $html .= Html::openElement(
159153 'form',
160154 array(
161155 'method' => 'post',
162156 'action' => EPOrgs::singleton()->getTitleFor( 'NAME_PLACEHOLDER' )->getLocalURL( array( 'action' => 'edit' ) ),
163157 )
164 - ) );
 158+ );
165159
166 - $out->addHTML( '<fieldset>' );
 160+ $html .= '<fieldset>';
167161
168 - $out->addHTML( '<legend>' . wfMsgHtml( 'ep-institutions-addnew' ) . '</legend>' );
 162+ $html .= '<legend>' . wfMsgHtml( 'ep-institutions-addnew' ) . '</legend>';
169163
170 - $out->addElement( 'p', array(), wfMsg( 'ep-institutions-namedoc' ) );
 164+ $html .= Html::element( 'p', array(), wfMsg( 'ep-institutions-namedoc' ) );
171165
172 - $out->addHTML( Xml::inputLabel(
 166+ $html .= Xml::inputLabel(
173167 wfMsg( 'ep-institutions-newname' ),
174168 'newname',
175169 'newname',
176170 false,
177171 array_key_exists( 'name', $args ) ? $args['name'] : false
178 - ) );
 172+ );
179173
180 - $out->addHTML( '&#160;' . Html::input(
 174+ $html .= '&#160;' . Html::input(
181175 'addneworg',
182176 wfMsg( 'ep-institutions-add' ),
183177 'submit',
@@ -184,38 +178,39 @@
185179 'disabled' => 'disabled',
186180 'class' => 'ep-org-add',
187181 )
188 - ) );
 182+ );
189183
190 - $out->addHTML( Html::hidden( 'isnew', 1 ) );
 184+ $html .= Html::hidden( 'isnew', 1 );
191185
192 - $out->addHTML( '</fieldset></form>' );
 186+ $html .= '</fieldset></form>';
193187
194 - return true;
 188+ return $html;
195189 }
196190
197191 /**
198 - * Display a pager with courses.
 192+ * Returns the HTML for a pager with institutions.
199193 *
200194 * @since 0.1
201195 *
202196 * @param IContextSource $context
203197 * @param array $conditions
 198+ *
 199+ * @return string
204200 */
205 - public static function displayPager( IContextSource $context, array $conditions = array() ) {
 201+ public static function getPager( IContextSource $context, array $conditions = array() ) {
206202 $pager = new EPOrgPager( $context, $conditions );
207203
208204 if ( $pager->getNumRows() ) {
209 - $context->getOutput()->addHTML(
 205+ return
210206 $pager->getFilterControl() .
211207 $pager->getNavigationBar() .
212208 $pager->getBody() .
213209 $pager->getNavigationBar() .
214 - $pager->getMultipleItemControl()
215 - );
 210+ $pager->getMultipleItemControl();
216211 }
217212 else {
218 - $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
219 - $context->getOutput()->addWikiMsg( 'ep-institutions-noresults' );
 213+ return $pager->getFilterControl( true ) .
 214+ $context->msg( 'ep-institutions-noresults' );
220215 }
221216 }
222217

Status & tagging log