/**
* Set this to an array of special page names to prevent
* maintenance/updateSpecialPages.php from updating those pages.
+ * Mapping each special page name to an run mode like 'periodical' if a cronjob is set up.
*/
$wgDisableQueryPageUpdate = false;
return $qp;
}
+ /**
+ * Get a list of query pages disabled and with it's run mode
+ * @param Config $config
+ * @return string[]
+ */
+ public static function getDisabledQueryPages( Config $config ) {
+ $disableQueryPageUpdate = $config->get( 'DisableQueryPageUpdate' );
+
+ if ( !is_array( $disableQueryPageUpdate ) ) {
+ return [];
+ }
+
+ $pages = [];
+ foreach ( $disableQueryPageUpdate as $name => $runMode ) {
+ if ( is_int( $name ) ) {
+ // The run mode may be omitted
+ $pages[$runMode] = 'disabled';
+ } else {
+ $pages[$name] = $runMode;
+ }
+ }
+ return $pages;
+ }
+
/**
* A mutator for $this->listoutput;
*
# If updates on this page have been disabled, let the user know
# that the data set won't be refreshed for now
- if ( is_array( $this->getConfig()->get( 'DisableQueryPageUpdate' ) )
- && in_array( $this->getName(), $this->getConfig()->get( 'DisableQueryPageUpdate' ) )
- ) {
- $out->wrapWikiMsg(
- "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
- 'querypage-no-updates'
- );
+ $disabledQueryPages = self::getDisabledQueryPages( $this->getConfig() );
+ if ( isset( $disabledQueryPages[$this->getName()] ) ) {
+ $runMode = $disabledQueryPages[$this->getName()];
+ if ( $runMode === 'disabled' ) {
+ $out->wrapWikiMsg(
+ "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
+ 'querypage-no-updates'
+ );
+ } else {
+ // Messages used here: querypage-updates-periodical
+ $out->wrapWikiMsg(
+ "<div class=\"mw-querypage-updates-" . $runMode . "\">\n$1\n</div>",
+ 'querypage-updates-' . $runMode
+ );
+ }
}
}
}
"perfcached": "The following data is cached and may not be up to date. A maximum of {{PLURAL:$1|one result is|$1 results are}} available in the cache.",
"perfcachedts": "The following data is cached, and was last updated $1. A maximum of {{PLURAL:$4|one result is|$4 results are}} available in the cache.",
"querypage-no-updates": "Updates for this page are currently disabled.\nData here will not presently be refreshed.",
+ "querypage-updates-periodical": "Updates for this page are run periodically.",
"viewsource": "View source",
"viewsource-title": "View source for $1",
"actionthrottled": "Action throttled",
"perfcached": "Like {{msg-mw|perfcachedts}} but used when we do not know how long ago page was cached (unlikely to happen).\n\nParameters:\n* $1 - the max result cut off ($wgQueryCacheLimit)",
"perfcachedts": "Used on pages that list page lists for which the displayed data is cached. Parameters:\n* $1 - a time stamp (date and time combined)\n* $2 - a date (optional)\n* $3 - a time (optional)\n* $4 - the cut off limit for cached results ($wgQueryCacheLimit). If there are more then this many results for the query, only the first $4 of those will be listed on the page. Usually $4 is about 1000.",
"querypage-no-updates": "Text on some special pages, e.g. [[Special:FewestRevisions]].",
+ "querypage-updates-periodical": "Text on some special pages which are configurated with a periodical run of a maintenance script.\n\nSee also {{msg-mw|querypage-no-updates}}.",
"viewsource": "The text displayed in place of the {{msg-mw|Edit}} tab when the user has no permission to edit the page.\n\nSee also:\n* {{msg-mw|Viewsource}}\n* {{msg-mw|Accesskey-ca-viewsource}}\n* {{msg-mw|Tooltip-ca-viewsource}}\n{{Identical|View source}}",
"viewsource-title": "Page title shown when trying to edit a protected page. Parameters:\n* $1 - the name of the page",
"actionthrottled": "This is the title of an error page. Read it in combination with {{msg-mw|actionthrottledtext}}.",
}
public function execute() {
- global $wgQueryCacheLimit, $wgDisableQueryPageUpdate;
+ global $wgQueryCacheLimit;
$dbw = $this->getDB( DB_MASTER );
$this->doSpecialPageCacheUpdates( $dbw );
+ $disabledQueryPages = QueryPage::getDisabledQueryPages( $this->getConfig() );
foreach ( QueryPage::getPages() as $page ) {
list( , $special ) = $page;
$limit = $page[2] ?? null;
}
if ( !$this->hasOption( 'override' )
- && $wgDisableQueryPageUpdate && in_array( $special, $wgDisableQueryPageUpdate )
+ && isset( $disabledQueryPages[$special] )
) {
$this->output( sprintf( "%-30s [QueryPage] disabled\n", $special ) );
continue;