mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
Purge formulae on action=purge
Previously, the 'action=purge' parameter could not be accessed by the math extension, since 'action=purge' caused a reload of the page, even before the math extension was called. However, before MediaWiki 1.29.+ additional GET request parameter were forwarded to the next page and could be evaluated by the math extension. Thus, an additional parameter 'mathpurge=true' was added to re-render formulae. However, it seems that this additional GET parameter is no longer being forwarded. This change reads the refer header to check if 'action=purge' was passed. This makes the mathpurge parameter obsolete. Bug: T74537 Change-Id: Ia09c039de3a7232a28bfdd5a97daf1029e5d7c40
This commit is contained in:
parent
81d0df0d5c
commit
46ccf11e8e
|
@ -522,17 +522,15 @@ abstract class MathRenderer {
|
|||
if ( $this->purge ) {
|
||||
return true;
|
||||
}
|
||||
$request = RequestContext::getMain()->getRequest();
|
||||
// TODO: Figure out if ?action=purge
|
||||
// $action = $request->getText('action'); //always returns ''
|
||||
// until this issue is resolved we use ?mathpurge=true instead
|
||||
$mathpurge = $request->getBool( 'mathpurge', false );
|
||||
if ( $mathpurge ) {
|
||||
LoggerFactory::getInstance( 'Math' )->debug( 'Re-Rendering on user request' );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
$refererHeader = RequestContext::getMain()->getRequest()->getHeader( 'REFERER' );
|
||||
if ( $refererHeader ) {
|
||||
parse_str( parse_url( $refererHeader, PHP_URL_QUERY ), $refererParam );
|
||||
if ( isset( $refererParam['action'] ) && $refererParam['action'] === 'purge' ) {
|
||||
LoggerFactory::getInstance( 'Math' )->debug( 'Re-Rendering on user request' );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue