Fix hooks

This commit is contained in:
Luqgreg 2018-08-06 14:27:25 +02:00
parent 1f4ba3e0be
commit 3e560943f4
3 changed files with 8 additions and 8 deletions

View file

@ -46,7 +46,8 @@ class PortableInfoboxHooks {
}
public static function onAllInfoboxesQueryRecached() {
F::app()->wg->Memc->delete( wfMemcKey( ApiQueryAllinfoboxes::MCACHE_KEY ) );
$cache = ObjectCache::getMainWANInstance();
$cache->delete( $cache->makeKey( __CLASS__, ApiQueryAllinfoboxes::MCACHE_KEY ) );
return true;
}
@ -66,7 +67,7 @@ class PortableInfoboxHooks {
*
* @return bool
*/
public static function onArticleSave( Page $article, User $user, &$text, &$summary, $minor, $watchthis, $sectionanchor, &$flags, Status &$status ): bool {
public static function onPageContentSave( Page $article, User $user, &$text, &$summary, $minor, $watchthis, $sectionanchor, &$flags, Status &$status ): bool {
PortableInfoboxDataService::newFromTitle( $article->getTitle() )->delete();
return true;
@ -115,8 +116,8 @@ class PortableInfoboxHooks {
* @param Revision $revision The newly inserted revision object
* @return boolean
*/
public static function onArticleInsertComplete( Page $page, User $user, $text, $summary, $minoredit,
$watchThis, $sectionAnchor, &$flags, Revision $revision ) {
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 );

View file

@ -6,11 +6,10 @@ class ApiQueryAllinfoboxes extends ApiQueryBase {
const MCACHE_KEY = 'allinfoboxes-list';
public function execute() {
$db = $this->getDB();
$res = $this->getResult();
$cache = ObjectCache::getMainWANInstance();
$cachekey = $cache->makeKey( __CLASS__, self::MCACHE_KEY );
$cachekey = $cache->makeKey( self::MCACHE_KEY );
$data = $cache->getWithSetCallback( $cachekey, self::CACHE_TTL, function () use ( $db ) {
global $wgPortableInfoboxApiCanTriggerRecache;

View file

@ -97,9 +97,9 @@
"wgQueryPages": "PortableInfoboxHooks::onWgQueryPages",
"AllInfoboxesQueryRecached": "PortableInfoboxHooks::onAllInfoboxesQueryRecached",
"ArticlePurge": "PortableInfoboxHooks::onArticlePurge",
"ArticleSave": "PortableInfoboxHooks::onArticleSave",
"BacklinksPurge": "PortableInfoboxHooks::onBacklinksPurge",
"ArticleInsertComplete": "PortableInfoboxHooks::onArticleInsertComplete"
"PageContentInsertComplete": "PortableInfoboxHooks::onPageContentInsertComplete",
"PageContentSave": "PortableInfoboxHooks::onPageContentSave"
},
"SpecialPages": {
"AllInfoboxes": "AllinfoboxesQueryPage"