(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:
bsitu 2013-01-08 15:57:28 -08:00
parent bc45a664d2
commit 39416e503d

View file

@ -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;
}