mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
(bug 43701) - LinkedPage was linked by 127.0.0.1 from page
If multiple pages are transcluding a page, a link update on the page being transcluded would trigger notifications for all the transcluding pages, we only need to fire the notification for the page being transcluded. The solution in this patch seems to work but I have not fully investigated all possible scenarios. -2 for now Change-Id: I6932ffb2e5dba3da40db17bd37ce2cc6cb8aee17
This commit is contained in:
parent
bc45a664d2
commit
39416e503d
11
Hooks.php
11
Hooks.php
|
@ -363,19 +363,26 @@ class EchoHooks {
|
|||
* @return bool
|
||||
*/
|
||||
public static function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ) {
|
||||
// Confirm: if $linksUpdate->mRecursive is false, that means $linkUpdate->mTitle is
|
||||
// transcluding other page, and this link update is resulting from the other page
|
||||
// link update
|
||||
if ( !$linksUpdate->mRecursive ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle only inserts to pagelinks table for content namespace pages
|
||||
if ( $table !== 'pagelinks' || !MWNamespace::isContent( $linksUpdate->mTitle->getNamespace() ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// only create notifications for links to content namespace pages
|
||||
// Only create notifications for links to content namespace pages
|
||||
foreach ( $insertions as $key => $page ) {
|
||||
if ( !MWNamespace::isContent( $page['pl_namespace'] ) ) {
|
||||
unset( $insertions[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
// exits if there is no new link
|
||||
// Exits if there is no new link
|
||||
if ( !$insertions ) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue