Index: trunk/extensions/GlobalUsage/GlobalUsageHooks.php |
— | — | @@ -18,21 +18,21 @@ |
19 | 19 | $gu = self::getGlobalUsage(); |
20 | 20 | if ( $wgUseDumbLinkUpdate ) { |
21 | 21 | // Delete all entries to the page |
22 | | - $gu->deleteFrom( $title->getArticleId( GAID_FOR_UPDATE ) ); |
| 22 | + $gu->deleteLinksFromPage( $title->getArticleId( GAID_FOR_UPDATE ) ); |
23 | 23 | // Re-insert new usage for the page |
24 | | - $gu->setUsage( $title, $missingFiles ); |
| 24 | + $gu->insertLinks( $title, $missingFiles ); |
25 | 25 | } else { |
26 | 26 | $articleId = $title->getArticleId( GAID_FOR_UPDATE ); |
27 | | - $existing = $gu->getAllFrom( $articleId ); |
| 27 | + $existing = $gu->getLinksFromPage( $articleId ); |
28 | 28 | |
29 | 29 | // Calculate changes |
30 | 30 | $added = array_diff( $missingFiles, $existing ); |
31 | 31 | $removed = array_diff( $existing, $missingFiles ); |
32 | 32 | |
33 | 33 | // Add new usages and delete removed |
34 | | - $gu->setUsage( $title, $added ); |
| 34 | + $gu->insertLinks( $title, $added ); |
35 | 35 | if ( $removed ) |
36 | | - $gu->deleteFrom( $articleId, $removed ); |
| 36 | + $gu->deleteLinksFromPage( $articleId, $removed ); |
37 | 37 | } |
38 | 38 | |
39 | 39 | return true; |
— | — | @@ -54,9 +54,9 @@ |
55 | 55 | public static function onArticleDeleteComplete( $article, $user, $reason, $id ) { |
56 | 56 | $title = $article->getTitle(); |
57 | 57 | $gu = self::getGlobalUsage(); |
58 | | - $gu->deleteFrom( $id ); |
| 58 | + $gu->deleteLinksFromPage( $id ); |
59 | 59 | if ( $title->getNamespace() == NS_FILE ) { |
60 | | - $gu->copyFromLocal( $title ); |
| 60 | + $gu->copyLocalImagelinks( $title ); |
61 | 61 | } |
62 | 62 | return true; |
63 | 63 | } |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | */ |
69 | 69 | public static function onFileUndeleteComplete( $title, $versions, $user, $reason ) { |
70 | 70 | $gu = self::getGlobalUsage(); |
71 | | - $gu->deleteTo( $title ); |
| 71 | + $gu->deleteLinksToFile( $title ); |
72 | 72 | return true; |
73 | 73 | } |
74 | 74 | /** |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | */ |
78 | 78 | public static function onUploadComplete( $upload ) { |
79 | 79 | $gu = self::getGlobalUsage(); |
80 | | - $gu->deleteTo( $upload->getTitle() ); |
| 80 | + $gu->deleteLinksToFile( $upload->getTitle() ); |
81 | 81 | return true; |
82 | 82 | } |
83 | 83 | |
Index: trunk/extensions/GlobalUsage/GlobalUsage_body.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | * @param $title Title Title of the page |
23 | 23 | * @param $images array Array of db keys of images used |
24 | 24 | */ |
25 | | - public function setUsage( $title, $images, $pageIdFlags = GAID_FOR_UPDATE ) { |
| 25 | + public function insertLinks( $title, $images, $pageIdFlags = GAID_FOR_UPDATE ) { |
26 | 26 | $insert = array(); |
27 | 27 | foreach ( $images as $name ) { |
28 | 28 | $insert[] = array( |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | /** |
39 | 39 | * Get all global images from a certain page |
40 | 40 | */ |
41 | | - public function getAllFrom( $id ) { |
| 41 | + public function getLinksFromPage( $id ) { |
42 | 42 | $res = $this->db->select( |
43 | 43 | 'globalimagelinks', |
44 | 44 | 'gil_to', |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | * @param $id int Page id of the page |
61 | 61 | * @param $to mixed File name(s) |
62 | 62 | */ |
63 | | - public function deleteFrom( $id, $to = null ) { |
| 63 | + public function deleteLinksFromPage( $id, $to = null ) { |
64 | 64 | $where = array( |
65 | 65 | 'gil_wiki' => $this->interwiki, |
66 | 66 | 'gil_page' => $id |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | * |
76 | 76 | * @param $title Title Title of the file |
77 | 77 | */ |
78 | | - public function deleteTo( $title ) { |
| 78 | + public function deleteLinksToFile( $title ) { |
79 | 79 | $this->db->delete( |
80 | 80 | 'globalimagelinks', |
81 | 81 | array( |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | * |
92 | 92 | * @param $title Title Title of the file to copy entries from. |
93 | 93 | */ |
94 | | - public function copyFromLocal( $title ) { |
| 94 | + public function copyLocalImagelinks( $title ) { |
95 | 95 | global $wgContLang; |
96 | 96 | |
97 | 97 | $dbr = wfGetDB( DB_SLAVE ); |
Index: trunk/extensions/GlobalUsage/refreshGlobalimagelinks.php |
— | — | @@ -74,13 +74,13 @@ |
75 | 75 | # Delete all original links if this page is not a continuation |
76 | 76 | # of last iteration. |
77 | 77 | if ( $pageId != $lastPageId ) |
78 | | - $gu->deleteFrom( $pageId ); |
| 78 | + $gu->deleteLinksFromPage( $pageId ); |
79 | 79 | if ( $rows ) { |
80 | 80 | $title = Title::newFromRow( reset( $rows ) ); |
81 | 81 | $images = array_keys( $rows ); |
82 | 82 | # Since we have a pretty accurate page_id, don't specify |
83 | 83 | # GAID_FOR_UPDATE |
84 | | - $gu->setUsage( $title, $images, /* $flags */ 0 ); |
| 84 | + $gu->insertLinks( $title, $images, /* $flags */ 0 ); |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |