Merge "update.php: Don't check for mbstring extension"
[lhc/web/wiklou.git] / includes / specialpage / SpecialPage.php
1 <?php
2 use MediaWiki\MediaWikiServices;
3
4 /**
5 * Parent class for all special pages.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
21 *
22 * @file
23 * @ingroup SpecialPage
24 */
25
26 use MediaWiki\Auth\AuthManager;
27
28 /**
29 * Parent class for all special pages.
30 *
31 * Includes some static functions for handling the special page list deprecated
32 * in favor of SpecialPageFactory.
33 *
34 * @ingroup SpecialPage
35 */
36 class SpecialPage {
37 // The canonical name of this special page
38 // Also used for the default <h1> heading, @see getDescription()
39 protected $mName;
40
41 // The local name of this special page
42 private $mLocalName;
43
44 // Minimum user level required to access this page, or "" for anyone.
45 // Also used to categorise the pages in Special:Specialpages
46 protected $mRestriction;
47
48 // Listed in Special:Specialpages?
49 private $mListed;
50
51 // Whether or not this special page is being included from an article
52 protected $mIncluding;
53
54 // Whether the special page can be included in an article
55 protected $mIncludable;
56
57 /**
58 * Current request context
59 * @var IContextSource
60 */
61 protected $mContext;
62
63 /**
64 * Get a localised Title object for a specified special page name
65 *
66 * @since 1.9
67 * @since 1.21 $fragment parameter added
68 *
69 * @param string $name
70 * @param string|bool $subpage Subpage string, or false to not use a subpage
71 * @param string $fragment The link fragment (after the "#")
72 * @return Title
73 * @throws MWException
74 */
75 public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
76 $name = SpecialPageFactory::getLocalNameFor( $name, $subpage );
77
78 return Title::makeTitle( NS_SPECIAL, $name, $fragment );
79 }
80
81 /**
82 * Get a localised Title object for a page name with a possibly unvalidated subpage
83 *
84 * @param string $name
85 * @param string|bool $subpage Subpage string, or false to not use a subpage
86 * @return Title|null Title object or null if the page doesn't exist
87 */
88 public static function getSafeTitleFor( $name, $subpage = false ) {
89 $name = SpecialPageFactory::getLocalNameFor( $name, $subpage );
90 if ( $name ) {
91 return Title::makeTitleSafe( NS_SPECIAL, $name );
92 } else {
93 return null;
94 }
95 }
96
97 /**
98 * Default constructor for special pages
99 * Derivative classes should call this from their constructor
100 * Note that if the user does not have the required level, an error message will
101 * be displayed by the default execute() method, without the global function ever
102 * being called.
103 *
104 * If you override execute(), you can recover the default behavior with userCanExecute()
105 * and displayRestrictionError()
106 *
107 * @param string $name Name of the special page, as seen in links and URLs
108 * @param string $restriction User right required, e.g. "block" or "delete"
109 * @param bool $listed Whether the page is listed in Special:Specialpages
110 * @param callable|bool $function Unused
111 * @param string $file Unused
112 * @param bool $includable Whether the page can be included in normal pages
113 */
114 public function __construct(
115 $name = '', $restriction = '', $listed = true,
116 $function = false, $file = '', $includable = false
117 ) {
118 $this->mName = $name;
119 $this->mRestriction = $restriction;
120 $this->mListed = $listed;
121 $this->mIncludable = $includable;
122 }
123
124 /**
125 * Get the name of this Special Page.
126 * @return string
127 */
128 function getName() {
129 return $this->mName;
130 }
131
132 /**
133 * Get the permission that a user must have to execute this page
134 * @return string
135 */
136 function getRestriction() {
137 return $this->mRestriction;
138 }
139
140 // @todo FIXME: Decide which syntax to use for this, and stick to it
141 /**
142 * Whether this special page is listed in Special:SpecialPages
143 * @since 1.3 (r3583)
144 * @return bool
145 */
146 function isListed() {
147 return $this->mListed;
148 }
149
150 /**
151 * Set whether this page is listed in Special:Specialpages, at run-time
152 * @since 1.3
153 * @param bool $listed
154 * @return bool
155 */
156 function setListed( $listed ) {
157 return wfSetVar( $this->mListed, $listed );
158 }
159
160 /**
161 * Get or set whether this special page is listed in Special:SpecialPages
162 * @since 1.6
163 * @param bool $x
164 * @return bool
165 */
166 function listed( $x = null ) {
167 return wfSetVar( $this->mListed, $x );
168 }
169
170 /**
171 * Whether it's allowed to transclude the special page via {{Special:Foo/params}}
172 * @return bool
173 */
174 public function isIncludable() {
175 return $this->mIncludable;
176 }
177
178 /**
179 * How long to cache page when it is being included.
180 *
181 * @note If cache time is not 0, then the current user becomes an anon
182 * if you want to do any per-user customizations, than this method
183 * must be overriden to return 0.
184 * @since 1.26
185 * @return int Time in seconds, 0 to disable caching altogether,
186 * false to use the parent page's cache settings
187 */
188 public function maxIncludeCacheTime() {
189 global $wgMiserMode;
190 if ( !$wgMiserMode ) {
191 return 0;
192 } else {
193 return 60*60;
194 }
195 }
196
197 /**
198 * Whether the special page is being evaluated via transclusion
199 * @param bool $x
200 * @return bool
201 */
202 function including( $x = null ) {
203 return wfSetVar( $this->mIncluding, $x );
204 }
205
206 /**
207 * Get the localised name of the special page
208 * @return string
209 */
210 function getLocalName() {
211 if ( !isset( $this->mLocalName ) ) {
212 $this->mLocalName = SpecialPageFactory::getLocalNameFor( $this->mName );
213 }
214
215 return $this->mLocalName;
216 }
217
218 /**
219 * Is this page expensive (for some definition of expensive)?
220 * Expensive pages are disabled or cached in miser mode. Originally used
221 * (and still overridden) by QueryPage and subclasses, moved here so that
222 * Special:SpecialPages can safely call it for all special pages.
223 *
224 * @return bool
225 */
226 public function isExpensive() {
227 return false;
228 }
229
230 /**
231 * Is this page cached?
232 * Expensive pages are cached or disabled in miser mode.
233 * Used by QueryPage and subclasses, moved here so that
234 * Special:SpecialPages can safely call it for all special pages.
235 *
236 * @return bool
237 * @since 1.21
238 */
239 public function isCached() {
240 return false;
241 }
242
243 /**
244 * Can be overridden by subclasses with more complicated permissions
245 * schemes.
246 *
247 * @return bool Should the page be displayed with the restricted-access
248 * pages?
249 */
250 public function isRestricted() {
251 // DWIM: If anons can do something, then it is not restricted
252 return $this->mRestriction != '' && !User::groupHasPermission( '*', $this->mRestriction );
253 }
254
255 /**
256 * Checks if the given user (identified by an object) can execute this
257 * special page (as defined by $mRestriction). Can be overridden by sub-
258 * classes with more complicated permissions schemes.
259 *
260 * @param User $user The user to check
261 * @return bool Does the user have permission to view the page?
262 */
263 public function userCanExecute( User $user ) {
264 return $user->isAllowed( $this->mRestriction );
265 }
266
267 /**
268 * Output an error message telling the user what access level they have to have
269 * @throws PermissionsError
270 */
271 function displayRestrictionError() {
272 throw new PermissionsError( $this->mRestriction );
273 }
274
275 /**
276 * Checks if userCanExecute, and if not throws a PermissionsError
277 *
278 * @since 1.19
279 * @return void
280 * @throws PermissionsError
281 */
282 public function checkPermissions() {
283 if ( !$this->userCanExecute( $this->getUser() ) ) {
284 $this->displayRestrictionError();
285 }
286 }
287
288 /**
289 * If the wiki is currently in readonly mode, throws a ReadOnlyError
290 *
291 * @since 1.19
292 * @return void
293 * @throws ReadOnlyError
294 */
295 public function checkReadOnly() {
296 if ( wfReadOnly() ) {
297 throw new ReadOnlyError;
298 }
299 }
300
301 /**
302 * If the user is not logged in, throws UserNotLoggedIn error
303 *
304 * The user will be redirected to Special:Userlogin with the given message as an error on
305 * the form.
306 *
307 * @since 1.23
308 * @param string $reasonMsg [optional] Message key to be displayed on login page
309 * @param string $titleMsg [optional] Passed on to UserNotLoggedIn constructor
310 * @throws UserNotLoggedIn
311 */
312 public function requireLogin(
313 $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
314 ) {
315 if ( $this->getUser()->isAnon() ) {
316 throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
317 }
318 }
319
320 /**
321 * Tells if the special page does something security-sensitive and needs extra defense against
322 * a stolen account (e.g. a reauthentication). What exactly that will mean is decided by the
323 * authentication framework.
324 * @return bool|string False or the argument for AuthManager::securitySensitiveOperationStatus().
325 * Typically a special page needing elevated security would return its name here.
326 */
327 protected function getLoginSecurityLevel() {
328 return false;
329 }
330
331 /**
332 * Verifies that the user meets the security level, possibly reauthenticating them in the process.
333 *
334 * This should be used when the page does something security-sensitive and needs extra defense
335 * against a stolen account (e.g. a reauthentication). The authentication framework will make
336 * an extra effort to make sure the user account is not compromised. What that exactly means
337 * will depend on the system and user settings; e.g. the user might be required to log in again
338 * unless their last login happened recently, or they might be given a second-factor challenge.
339 *
340 * Calling this method will result in one if these actions:
341 * - return true: all good.
342 * - return false and set a redirect: caller should abort; the redirect will take the user
343 * to the login page for reauthentication, and back.
344 * - throw an exception if there is no way for the user to meet the requirements without using
345 * a different access method (e.g. this functionality is only available from a specific IP).
346 *
347 * Note that this does not in any way check that the user is authorized to use this special page
348 * (use checkPermissions() for that).
349 *
350 * @param string $level A security level. Can be an arbitrary string, defaults to the page name.
351 * @return bool False means a redirect to the reauthentication page has been set and processing
352 * of the special page should be aborted.
353 * @throws ErrorPageError If the security level cannot be met, even with reauthentication.
354 */
355 protected function checkLoginSecurityLevel( $level = null ) {
356 $level = $level ?: $this->getName();
357 $securityStatus = AuthManager::singleton()->securitySensitiveOperationStatus( $level );
358 if ( $securityStatus === AuthManager::SEC_OK ) {
359 return true;
360 } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
361 $request = $this->getRequest();
362 $title = SpecialPage::getTitleFor( 'Userlogin' );
363 $query = [
364 'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
365 'returntoquery' => wfArrayToCgi( array_diff_key( $request->getQueryValues(),
366 [ 'title' => true ] ) ),
367 'force' => $level,
368 ];
369 $url = $title->getFullURL( $query, false, PROTO_HTTPS );
370
371 $this->getOutput()->redirect( $url );
372 return false;
373 }
374
375 $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
376 $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
377 throw new ErrorPageError( $titleMessage, $errorMessage );
378 }
379
380 /**
381 * Return an array of subpages beginning with $search that this special page will accept.
382 *
383 * For example, if a page supports subpages "foo", "bar" and "baz" (as in Special:PageName/foo,
384 * etc.):
385 *
386 * - `prefixSearchSubpages( "ba" )` should return `array( "bar", "baz" )`
387 * - `prefixSearchSubpages( "f" )` should return `array( "foo" )`
388 * - `prefixSearchSubpages( "z" )` should return `array()`
389 * - `prefixSearchSubpages( "" )` should return `array( foo", "bar", "baz" )`
390 *
391 * @param string $search Prefix to search for
392 * @param int $limit Maximum number of results to return (usually 10)
393 * @param int $offset Number of results to skip (usually 0)
394 * @return string[] Matching subpages
395 */
396 public function prefixSearchSubpages( $search, $limit, $offset ) {
397 $subpages = $this->getSubpagesForPrefixSearch();
398 if ( !$subpages ) {
399 return [];
400 }
401
402 return self::prefixSearchArray( $search, $limit, $subpages, $offset );
403 }
404
405 /**
406 * Return an array of subpages that this special page will accept for prefix
407 * searches. If this method requires a query you might instead want to implement
408 * prefixSearchSubpages() directly so you can support $limit and $offset. This
409 * method is better for static-ish lists of things.
410 *
411 * @return string[] subpages to search from
412 */
413 protected function getSubpagesForPrefixSearch() {
414 return [];
415 }
416
417 /**
418 * Perform a regular substring search for prefixSearchSubpages
419 * @param string $search Prefix to search for
420 * @param int $limit Maximum number of results to return (usually 10)
421 * @param int $offset Number of results to skip (usually 0)
422 * @return string[] Matching subpages
423 */
424 protected function prefixSearchString( $search, $limit, $offset ) {
425 $title = Title::newFromText( $search );
426 if ( !$title || !$title->canExist() ) {
427 // No prefix suggestion in special and media namespace
428 return [];
429 }
430
431 $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
432 $searchEngine->setLimitOffset( $limit, $offset );
433 $searchEngine->setNamespaces( [] );
434 $result = $searchEngine->defaultPrefixSearch( $search );
435 return array_map( function( Title $t ) {
436 return $t->getPrefixedText();
437 }, $result );
438 }
439
440 /**
441 * Helper function for implementations of prefixSearchSubpages() that
442 * filter the values in memory (as opposed to making a query).
443 *
444 * @since 1.24
445 * @param string $search
446 * @param int $limit
447 * @param array $subpages
448 * @param int $offset
449 * @return string[]
450 */
451 protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
452 $escaped = preg_quote( $search, '/' );
453 return array_slice( preg_grep( "/^$escaped/i",
454 array_slice( $subpages, $offset ) ), 0, $limit );
455 }
456
457 /**
458 * Sets headers - this should be called from the execute() method of all derived classes!
459 */
460 function setHeaders() {
461 $out = $this->getOutput();
462 $out->setArticleRelated( false );
463 $out->setRobotPolicy( $this->getRobotPolicy() );
464 $out->setPageTitle( $this->getDescription() );
465 if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
466 $out->addModuleStyles( [
467 'mediawiki.ui.input',
468 'mediawiki.ui.radio',
469 'mediawiki.ui.checkbox',
470 ] );
471 }
472 }
473
474 /**
475 * Entry point.
476 *
477 * @since 1.20
478 *
479 * @param string|null $subPage
480 */
481 final public function run( $subPage ) {
482 /**
483 * Gets called before @see SpecialPage::execute.
484 * Return false to prevent calling execute() (since 1.27+).
485 *
486 * @since 1.20
487 *
488 * @param SpecialPage $this
489 * @param string|null $subPage
490 */
491 if ( !Hooks::run( 'SpecialPageBeforeExecute', [ $this, $subPage ] ) ) {
492 return;
493 }
494
495 if ( $this->beforeExecute( $subPage ) === false ) {
496 return;
497 }
498 $this->execute( $subPage );
499 $this->afterExecute( $subPage );
500
501 /**
502 * Gets called after @see SpecialPage::execute.
503 *
504 * @since 1.20
505 *
506 * @param SpecialPage $this
507 * @param string|null $subPage
508 */
509 Hooks::run( 'SpecialPageAfterExecute', [ $this, $subPage ] );
510 }
511
512 /**
513 * Gets called before @see SpecialPage::execute.
514 * Return false to prevent calling execute() (since 1.27+).
515 *
516 * @since 1.20
517 *
518 * @param string|null $subPage
519 * @return bool|void
520 */
521 protected function beforeExecute( $subPage ) {
522 // No-op
523 }
524
525 /**
526 * Gets called after @see SpecialPage::execute.
527 *
528 * @since 1.20
529 *
530 * @param string|null $subPage
531 */
532 protected function afterExecute( $subPage ) {
533 // No-op
534 }
535
536 /**
537 * Default execute method
538 * Checks user permissions
539 *
540 * This must be overridden by subclasses; it will be made abstract in a future version
541 *
542 * @param string|null $subPage
543 */
544 public function execute( $subPage ) {
545 $this->setHeaders();
546 $this->checkPermissions();
547 $this->checkLoginSecurityLevel( $this->getLoginSecurityLevel() );
548 $this->outputHeader();
549 }
550
551 /**
552 * Outputs a summary message on top of special pages
553 * Per default the message key is the canonical name of the special page
554 * May be overridden, i.e. by extensions to stick with the naming conventions
555 * for message keys: 'extensionname-xxx'
556 *
557 * @param string $summaryMessageKey Message key of the summary
558 */
559 function outputHeader( $summaryMessageKey = '' ) {
560 global $wgContLang;
561
562 if ( $summaryMessageKey == '' ) {
563 $msg = $wgContLang->lc( $this->getName() ) . '-summary';
564 } else {
565 $msg = $summaryMessageKey;
566 }
567 if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
568 $this->getOutput()->wrapWikiMsg(
569 "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
570 }
571 }
572
573 /**
574 * Returns the name that goes in the \<h1\> in the special page itself, and
575 * also the name that will be listed in Special:Specialpages
576 *
577 * Derived classes can override this, but usually it is easier to keep the
578 * default behavior.
579 *
580 * @return string
581 */
582 function getDescription() {
583 return $this->msg( strtolower( $this->mName ) )->text();
584 }
585
586 /**
587 * Get a self-referential title object
588 *
589 * @param string|bool $subpage
590 * @return Title
591 * @deprecated since 1.23, use SpecialPage::getPageTitle
592 */
593 function getTitle( $subpage = false ) {
594 return $this->getPageTitle( $subpage );
595 }
596
597 /**
598 * Get a self-referential title object
599 *
600 * @param string|bool $subpage
601 * @return Title
602 * @since 1.23
603 */
604 function getPageTitle( $subpage = false ) {
605 return self::getTitleFor( $this->mName, $subpage );
606 }
607
608 /**
609 * Sets the context this SpecialPage is executed in
610 *
611 * @param IContextSource $context
612 * @since 1.18
613 */
614 public function setContext( $context ) {
615 $this->mContext = $context;
616 }
617
618 /**
619 * Gets the context this SpecialPage is executed in
620 *
621 * @return IContextSource|RequestContext
622 * @since 1.18
623 */
624 public function getContext() {
625 if ( $this->mContext instanceof IContextSource ) {
626 return $this->mContext;
627 } else {
628 wfDebug( __METHOD__ . " called and \$mContext is null. " .
629 "Return RequestContext::getMain(); for sanity\n" );
630
631 return RequestContext::getMain();
632 }
633 }
634
635 /**
636 * Get the WebRequest being used for this instance
637 *
638 * @return WebRequest
639 * @since 1.18
640 */
641 public function getRequest() {
642 return $this->getContext()->getRequest();
643 }
644
645 /**
646 * Get the OutputPage being used for this instance
647 *
648 * @return OutputPage
649 * @since 1.18
650 */
651 public function getOutput() {
652 return $this->getContext()->getOutput();
653 }
654
655 /**
656 * Shortcut to get the User executing this instance
657 *
658 * @return User
659 * @since 1.18
660 */
661 public function getUser() {
662 return $this->getContext()->getUser();
663 }
664
665 /**
666 * Shortcut to get the skin being used for this instance
667 *
668 * @return Skin
669 * @since 1.18
670 */
671 public function getSkin() {
672 return $this->getContext()->getSkin();
673 }
674
675 /**
676 * Shortcut to get user's language
677 *
678 * @return Language
679 * @since 1.19
680 */
681 public function getLanguage() {
682 return $this->getContext()->getLanguage();
683 }
684
685 /**
686 * Shortcut to get main config object
687 * @return Config
688 * @since 1.24
689 */
690 public function getConfig() {
691 return $this->getContext()->getConfig();
692 }
693
694 /**
695 * Return the full title, including $par
696 *
697 * @return Title
698 * @since 1.18
699 */
700 public function getFullTitle() {
701 return $this->getContext()->getTitle();
702 }
703
704 /**
705 * Return the robot policy. Derived classes that override this can change
706 * the robot policy set by setHeaders() from the default 'noindex,nofollow'.
707 *
708 * @return string
709 * @since 1.23
710 */
711 protected function getRobotPolicy() {
712 return 'noindex,nofollow';
713 }
714
715 /**
716 * Wrapper around wfMessage that sets the current context.
717 *
718 * @since 1.16
719 * @return Message
720 * @see wfMessage
721 */
722 public function msg( /* $args */ ) {
723 $message = call_user_func_array(
724 [ $this->getContext(), 'msg' ],
725 func_get_args()
726 );
727 // RequestContext passes context to wfMessage, and the language is set from
728 // the context, but setting the language for Message class removes the
729 // interface message status, which breaks for example usernameless gender
730 // invocations. Restore the flag when not including special page in content.
731 if ( $this->including() ) {
732 $message->setInterfaceMessageFlag( false );
733 }
734
735 return $message;
736 }
737
738 /**
739 * Adds RSS/atom links
740 *
741 * @param array $params
742 */
743 protected function addFeedLinks( $params ) {
744 $feedTemplate = wfScript( 'api' );
745
746 foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
747 $theseParams = $params + [ 'feedformat' => $format ];
748 $url = wfAppendQuery( $feedTemplate, $theseParams );
749 $this->getOutput()->addFeedLink( $format, $url );
750 }
751 }
752
753 /**
754 * Adds help link with an icon via page indicators.
755 * Link target can be overridden by a local message containing a wikilink:
756 * the message key is: lowercase special page name + '-helppage'.
757 * @param string $to Target MediaWiki.org page title or encoded URL.
758 * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
759 * @since 1.25
760 */
761 public function addHelpLink( $to, $overrideBaseUrl = false ) {
762 global $wgContLang;
763 $msg = $this->msg( $wgContLang->lc( $this->getName() ) . '-helppage' );
764
765 if ( !$msg->isDisabled() ) {
766 $helpUrl = Skin::makeUrl( $msg->plain() );
767 $this->getOutput()->addHelpLink( $helpUrl, true );
768 } else {
769 $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
770 }
771 }
772
773 /**
774 * Get the group that the special page belongs in on Special:SpecialPage
775 * Use this method, instead of getGroupName to allow customization
776 * of the group name from the wiki side
777 *
778 * @return string Group of this special page
779 * @since 1.21
780 */
781 public function getFinalGroupName() {
782 $name = $this->getName();
783
784 // Allow overbidding the group from the wiki side
785 $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
786 if ( !$msg->isBlank() ) {
787 $group = $msg->text();
788 } else {
789 // Than use the group from this object
790 $group = $this->getGroupName();
791 }
792
793 return $group;
794 }
795
796 /**
797 * Indicates whether this special page may perform database writes
798 *
799 * @return bool
800 * @since 1.27
801 */
802 public function doesWrites() {
803 return false;
804 }
805
806 /**
807 * Under which header this special page is listed in Special:SpecialPages
808 * See messages 'specialpages-group-*' for valid names
809 * This method defaults to group 'other'
810 *
811 * @return string
812 * @since 1.21
813 */
814 protected function getGroupName() {
815 return 'other';
816 }
817
818 /**
819 * Call wfTransactionalTimeLimit() if this request was POSTed
820 * @since 1.26
821 */
822 protected function useTransactionalTimeLimit() {
823 if ( $this->getRequest()->wasPosted() ) {
824 wfTransactionalTimeLimit();
825 }
826 }
827 }