Index: branches/wmf-deployment/extensions/GlobalUsage/GlobalUsageHooks.php |
— | — | @@ -49,14 +49,22 @@ |
50 | 50 | /** |
51 | 51 | * Hook to ArticleDeleteComplete |
52 | 52 | * Deletes entries from usage table. |
53 | | - * In case of an image, copies the local link table to the global. |
54 | 53 | */ |
55 | 54 | public static function onArticleDeleteComplete( $article, $user, $reason, $id ) { |
56 | 55 | $title = $article->getTitle(); |
57 | 56 | $gu = self::getGlobalUsage(); |
58 | 57 | $gu->deleteLinksFromPage( $id ); |
59 | | - if ( $title->getNamespace() == NS_FILE ) { |
60 | | - $gu->copyLocalImagelinks( $title ); |
| 58 | + |
| 59 | + return true; |
| 60 | + } |
| 61 | + /** |
| 62 | + * Hook to FileDeleteComplete |
| 63 | + * Copies the local link table to the global. |
| 64 | + */ |
| 65 | + public static function onFileDeleteComplete( $file, $oldimage, $article, $wgUser, $reason ) { |
| 66 | + if ( !$oldimage ) { |
| 67 | + $gu = self::getGlobalUsage(); |
| 68 | + $gu->copyLocalImagelinks( $file->getTitle() ); |
61 | 69 | } |
62 | 70 | return true; |
63 | 71 | } |
Index: branches/wmf-deployment/extensions/GlobalUsage/GlobalUsage.php |
— | — | @@ -65,6 +65,7 @@ |
66 | 66 | */ |
67 | 67 | $wgHooks['LinksUpdateComplete'][] = 'GlobalUsageHooks::onLinksUpdateComplete'; |
68 | 68 | $wgHooks['ArticleDeleteComplete'][] = 'GlobalUsageHooks::onArticleDeleteComplete'; |
| 69 | +$wgHooks['FileDeleteComplete'][] = 'GlobalUsageHooks::onFileDeleteComplete'; |
69 | 70 | $wgHooks['FileUndeleteComplete'][] = 'GlobalUsageHooks::onFileUndeleteComplete'; |
70 | 71 | $wgHooks['UploadComplete'][] = 'GlobalUsageHooks::onUploadComplete'; |
71 | 72 | $wgHooks['TitleMoveComplete'][] = 'GlobalUsageHooks::onTitleMoveComplete'; |
Property changes on: branches/wmf-deployment/extensions/GlobalUsage |
___________________________________________________________________ |
Name: svn:mergeinfo |
72 | 73 | - /branches/REL1_15/phase3/extensions/GlobalUsage:51646 |
/trunk/extensions/GlobalUsage:56207,56209,56296,56333,56355,58660-60688 |
/trunk/phase3/extensions/GlobalUsage:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816 |
73 | 74 | + /branches/REL1_15/phase3/extensions/GlobalUsage:51646 |
/trunk/extensions/GlobalUsage:56207,56209,56296,56333,56355,58660-60688,61395 |
/trunk/phase3/extensions/GlobalUsage:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816 |