mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
(bug 43625) - Strange notification
pages with 0 id should be filtered out Change-Id: Idfccc3e7c430e929f7ef312548ad92e7d9f40dfe
This commit is contained in:
parent
4a1cb54b17
commit
a5cc1c6836
11
Hooks.php
11
Hooks.php
|
@ -89,7 +89,11 @@ class EchoHooks {
|
|||
$count = 0;
|
||||
$agentId = $agent->getID();
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
$updated = false;
|
||||
|
||||
// @Todo: Title::newFromText() would trigger individual query for each title, this is not
|
||||
// efficient if there are a lot of new links, since we only need the page_id, this can be done
|
||||
// by one big query
|
||||
foreach( $extra['new-links'] as $page ) {
|
||||
$count++;
|
||||
// processing a lot of links on a normal web request is expensive, we should cap
|
||||
|
@ -98,7 +102,7 @@ class EchoHooks {
|
|||
break;
|
||||
}
|
||||
$title = Title::newFromText( $page['pl_title'], $page['pl_namespace'] );
|
||||
if ( !$title ) {
|
||||
if ( !$title || $title->getArticleID() <= 0 ) {
|
||||
continue;
|
||||
}
|
||||
$res = $dbr->selectRow(
|
||||
|
@ -123,10 +127,13 @@ class EchoHooks {
|
|||
if ( $user ) {
|
||||
$users[$user->getID()] = $user;
|
||||
$extra['notif-list'][$res->rev_user][] = $page;
|
||||
$updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$event->updateExtra( $extra );
|
||||
if ( $updated ) {
|
||||
$event->updateExtra( $extra );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ class MWEchoArticleLinkedFormatter extends EchoEditFormatter {
|
|||
case 'title-linked':
|
||||
// wikitext format of the title of the page that gets linked in other page
|
||||
case 'title-linked-wiki-format':
|
||||
$list = array();
|
||||
if ( isset( $extra['notif-list'][$user->getID()] ) ) {
|
||||
if ( isset( $extra['notif-list'][$user->getID()] ) && $extra['notif-list'][$user->getID()] ) {
|
||||
global $wgLang;
|
||||
$list = array();
|
||||
|
||||
foreach ( $extra['notif-list'][$user->getID()] as $page ) {
|
||||
$title = Title::makeTitle( $page['pl_namespace'], $page['pl_title'] );
|
||||
|
|
Loading…
Reference in a new issue