/** * Warn the user when a parser limitation is reached * Will warn at most once the user per limitation type * * The results are shown during preview and run through the Parser (See EditPage.php) * * @param string $limitationType Should be one of: * 'expensive-parserfunction' (corresponding messages: * 'expensive-parserfunction-warning', * 'expensive-parserfunction-category') * 'post-expand-template-argument' (corresponding messages: * 'post-expand-template-argument-warning', * 'post-expand-template-argument-category') * 'post-expand-template-inclusion' (corresponding messages: * 'post-expand-template-inclusion-warning', * 'post-expand-template-inclusion-category') * 'node-count-exceeded' (corresponding messages: * 'node-count-exceeded-warning', * 'node-count-exceeded-category') * 'expansion-depth-exceeded' (corresponding messages: * 'expansion-depth-exceeded-warning', * 'expansion-depth-exceeded-category') * @param string|int|null $current Current value * @param string|int|null $max Maximum allowed, when an explicit limit has been * exceeded, provide the values (optional) */ public function limitationWarn($limitationType, $current = '', $max = '') { # does no harm if $current and $max are present but are unnecessary for the message # Not doing ->inLanguage( $this->mOptions->getUserLangObj() ), since this is shown # only during preview, and that would split the parser cache unnecessarily. $warning = wfMessage("{$limitationType}-warning")->numParams($current, $max)->text(); $this->mOutput->addWarning($warning); $this->addTrackingCategory("{$limitationType}-category"); }
/** * Warn the user when a parser limitation is reached * Will warn at most once the user per limitation type * * @param string $limitationType should be one of: * 'expensive-parserfunction' (corresponding messages: * 'expensive-parserfunction-warning', * 'expensive-parserfunction-category') * 'post-expand-template-argument' (corresponding messages: * 'post-expand-template-argument-warning', * 'post-expand-template-argument-category') * 'post-expand-template-inclusion' (corresponding messages: * 'post-expand-template-inclusion-warning', * 'post-expand-template-inclusion-category') * 'node-count-exceeded' (corresponding messages: * 'node-count-exceeded-warning', * 'node-count-exceeded-category') * 'expansion-depth-exceeded' (corresponding messages: * 'expansion-depth-exceeded-warning', * 'expansion-depth-exceeded-category') * @param int|null $current Current value * @param int|null $max Maximum allowed, when an explicit limit has been * exceeded, provide the values (optional) */ function limitationWarn($limitationType, $current = '', $max = '') { # does no harm if $current and $max are present but are unnecessary for the message $warning = wfMessage("{$limitationType}-warning")->numParams($current, $max)->inLanguage($this->mOptions->getUserLangObj())->text(); $this->mOutput->addWarning($warning); $this->addTrackingCategory("{$limitationType}-category"); }
/** * Warn the user when a parser limitation is reached * Will warn at most once the user per limitation type * * @param $limitationType String: should be one of: * 'expensive-parserfunction' (corresponding messages: * 'expensive-parserfunction-warning', * 'expensive-parserfunction-category') * 'post-expand-template-argument' (corresponding messages: * 'post-expand-template-argument-warning', * 'post-expand-template-argument-category') * 'post-expand-template-inclusion' (corresponding messages: * 'post-expand-template-inclusion-warning', * 'post-expand-template-inclusion-category') * @param $current Current value * @param $max Maximum allowed, when an explicit limit has been * exceeded, provide the values (optional) */ function limitationWarn($limitationType, $current = null, $max = null) { # does no harm if $current and $max are present but are unnecessary for the message $warning = wfMsgExt("{$limitationType}-warning", array('parsemag', 'escape'), $current, $max); $this->mOutput->addWarning($warning); $this->addTrackingCategory("{$limitationType}-category"); }