mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-12 01:11:55 +00:00
Remove support for deprecated ParserLimitReport hook
It was deprecated in 1.22, which Scribunto no longer supports. Change-Id: I0e8e1d56062f0cba1749d2a3e64df400d6a46f27
This commit is contained in:
parent
1ace41131f
commit
e17a3118a5
|
@ -62,7 +62,6 @@ $wgAutoloadClasses['Scribunto_LuaEngineTestSkip'] =
|
|||
$wgHooks['SoftwareInfo'][] = 'ScribuntoHooks::getSoftwareInfo';
|
||||
|
||||
$wgHooks['ParserFirstCallInit'][] = 'ScribuntoHooks::setupParserHook';
|
||||
$wgHooks['ParserLimitReport']['scribunto'] = 'ScribuntoHooks::reportLimits';
|
||||
$wgHooks['ParserLimitReportPrepare'][] = 'ScribuntoHooks::reportLimitData';
|
||||
$wgHooks['ParserLimitReportFormat'][] = 'ScribuntoHooks::formatLimitData';
|
||||
$wgHooks['ParserClearState'][] = 'ScribuntoHooks::clearState';
|
||||
|
|
|
@ -274,16 +274,6 @@ abstract class ScribuntoEngineBase {
|
|||
return array_merge( $coreLibraryPaths, $extraLibraryPaths );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text for the limit report, old style
|
||||
*
|
||||
* @deprecated
|
||||
* @return string
|
||||
*/
|
||||
public function getLimitReport() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add limit report data to a ParserOutput object
|
||||
*
|
||||
|
|
|
@ -270,22 +270,6 @@ class ScribuntoHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds report of number of evaluations by the single wikitext page.
|
||||
*
|
||||
* @deprecated
|
||||
* @param Parser $parser
|
||||
* @param string $report
|
||||
* @return bool
|
||||
*/
|
||||
public static function reportLimits( Parser $parser, &$report ) {
|
||||
if ( Scribunto::isParserEnginePresent( $parser ) ) {
|
||||
$engine = Scribunto::getParserEngine( $parser );
|
||||
$report .= $engine->getLimitReport();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds report of number of evaluations by the single wikitext page.
|
||||
*
|
||||
|
@ -294,10 +278,6 @@ class ScribuntoHooks {
|
|||
* @return bool
|
||||
*/
|
||||
public static function reportLimitData( Parser $parser, ParserOutput $output ) {
|
||||
// Unhook the deprecated hook, since the new one exists.
|
||||
global $wgHooks;
|
||||
unset( $wgHooks['ParserLimitReport']['scribunto'] );
|
||||
|
||||
if ( Scribunto::isParserEnginePresent( $parser ) ) {
|
||||
$engine = Scribunto::getParserEngine( $parser );
|
||||
$engine->reportLimitData( $output );
|
||||
|
|
|
@ -106,23 +106,6 @@ class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public function getLimitReport() {
|
||||
$data = $this->getLimitReportData();
|
||||
$lang = Language::factory( 'en' );
|
||||
|
||||
$t = $this->interpreter->getCPUUsage();
|
||||
$s = 'Lua time usage: ' . sprintf( "%.3f", $data['scribunto-limitreport-timeusage'] ) . "s\n" .
|
||||
'Lua memory usage: ' . $lang->formatSize( $data['scribunto-limitreport-memusage'] ) . "\n";
|
||||
if ( isset( $data['scribunto-limitreport-profile'] ) ) {
|
||||
$s .= "Lua Profile:\n";
|
||||
$format = " %-59s %8.0f ms %8.1f%%\n";
|
||||
foreach ( $data['scribunto-limitreport-profile'] as $line ) {
|
||||
$s .= sprintf( $format, $line[0], $line[1], $line[2] );
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
public function reportLimitData( ParserOutput $output ) {
|
||||
$data = $this->getLimitReportData();
|
||||
foreach ( $data as $k => $v ) {
|
||||
|
|
|
@ -20,29 +20,6 @@ class Scribunto_LuaStandaloneEngine extends Scribunto_LuaEngine {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getLimitReport() {
|
||||
try {
|
||||
$this->load();
|
||||
} catch ( Exception $e ) {
|
||||
return '';
|
||||
}
|
||||
if ( !$this->initialStatus ) {
|
||||
return '';
|
||||
}
|
||||
$status = $this->interpreter->getStatus();
|
||||
$lang = Language::factory( 'en' );
|
||||
return
|
||||
'Lua time usage: ' . sprintf( "%.3f", $status['time'] / $this->getClockTick() ) . "s\n" .
|
||||
'Lua virtual size: ' .
|
||||
$lang->formatSize( $status['vsize'] ) . ' / ' .
|
||||
$lang->formatSize( $this->options['memoryLimit'] ) . "\n" .
|
||||
'Lua estimated memory usage: ' .
|
||||
$lang->formatSize( $status['vsize'] - $this->initialStatus['vsize'] ) . "\n";
|
||||
}
|
||||
|
||||
function reportLimitData( ParserOutput $output ) {
|
||||
try {
|
||||
$this->load();
|
||||
|
|
Loading…
Reference in a new issue