mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 11:59:56 +00:00
Remove adding new pages to S:AI cache
This commit is contained in:
parent
3744074ebb
commit
ec915c6fc4
|
@ -92,7 +92,6 @@
|
|||
"wgQueryPages": "PortableInfoboxHooks::onWgQueryPages",
|
||||
"AllInfoboxesQueryRecached": "PortableInfoboxHooks::onAllInfoboxesQueryRecached",
|
||||
"ArticlePurge": "PortableInfoboxHooks::onArticlePurge",
|
||||
"PageContentInsertComplete": "PortableInfoboxHooks::onPageContentInsertComplete",
|
||||
"PageContentSave": "PortableInfoboxHooks::onPageContentSave"
|
||||
},
|
||||
"SpecialPages": {
|
||||
|
|
|
@ -72,29 +72,4 @@ class PortableInfoboxHooks {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a newly created infobox into querycache, and purge the list of
|
||||
* infoboxes.
|
||||
*
|
||||
* @param Page $page The created page object
|
||||
* @param User $user The user who created the page
|
||||
* @param string $text Text of the new article
|
||||
* @param string $summary Edit summary
|
||||
* @param int $minoredit Minor edit flag
|
||||
* @param boolean $watchThis Whether or not the user should watch the page
|
||||
* @param null $sectionAnchor Not used, set to null
|
||||
* @param int $flags Flags for this page
|
||||
* @param Revision $revision The newly inserted revision object
|
||||
* @return boolean
|
||||
*/
|
||||
public static function onPageContentInsertComplete( Page $page, User $user, $text, $summary, $minoredit,
|
||||
$watchThis, $sectionAnchor, &$flags, Revision $revision ) {
|
||||
$title = $page->getTitle();
|
||||
if ( $title->inNamespace( NS_TEMPLATE ) ) {
|
||||
( new AllinfoboxesQueryPage() )->addTitleToCache( $title );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,26 +104,6 @@ class AllinfoboxesQueryPage extends PageQueryPage {
|
|||
return new FakeResultWrapper( $out );
|
||||
}
|
||||
|
||||
public function addTitleToCache( Title $title ) {
|
||||
if ( !$this->hasInfobox( $title ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dbw = wfGetDB( DB_MASTER );
|
||||
$dbw->doAtomicSection(
|
||||
__METHOD__,
|
||||
function ( IDatabase $dbw, $fname ) use ( $title ) {
|
||||
$dbw->insert( 'querycache', [
|
||||
'qc_type' => $this->getName(),
|
||||
'qc_namespace' => $title->getNamespace(),
|
||||
'qc_title' => $title->getDBkey()
|
||||
], $fname );
|
||||
}
|
||||
);
|
||||
|
||||
Hooks::run( 'AllInfoboxesQueryRecached' );
|
||||
}
|
||||
|
||||
private function hasInfobox( Title $title ) {
|
||||
// omit subages from blacklist
|
||||
return !(
|
||||
|
|
Loading…
Reference in a new issue