mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-01 02:46:46 +00:00
Merge "(bug 43701) - LinkedPage was linked by 127.0.0.1 from page"
This commit is contained in:
commit
120dfc980c
11
Hooks.php
11
Hooks.php
|
@ -363,19 +363,26 @@ class EchoHooks {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ) {
|
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
|
// Handle only inserts to pagelinks table for content namespace pages
|
||||||
if ( $table !== 'pagelinks' || !MWNamespace::isContent( $linksUpdate->mTitle->getNamespace() ) ) {
|
if ( $table !== 'pagelinks' || !MWNamespace::isContent( $linksUpdate->mTitle->getNamespace() ) ) {
|
||||||
return true;
|
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 ) {
|
foreach ( $insertions as $key => $page ) {
|
||||||
if ( !MWNamespace::isContent( $page['pl_namespace'] ) ) {
|
if ( !MWNamespace::isContent( $page['pl_namespace'] ) ) {
|
||||||
unset( $insertions[$key] );
|
unset( $insertions[$key] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// exits if there is no new link
|
// Exits if there is no new link
|
||||||
if ( !$insertions ) {
|
if ( !$insertions ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue