Index: trunk/extensions/InterwikiIntegration/InterwikiIntegration.php |
— | — | @@ -17,7 +17,6 @@ |
18 | 18 | |
19 | 19 | /* Alert the user that this is not a valid entry point to MediaWiki if they try to access the |
20 | 20 | special pages file directly.*/ |
21 | | - |
22 | 21 | if ( !defined( 'MEDIAWIKI' ) ) { |
23 | 22 | echo <<<EOT |
24 | 23 | To install the InterwikiIntegration extension, put the following line in LocalSettings.php: |
— | — | @@ -25,19 +24,21 @@ |
26 | 25 | EOT; |
27 | 26 | exit( 1 ); |
28 | 27 | } |
29 | | - |
30 | 28 | $wgExtensionCredits['other'][] = array( |
31 | 29 | 'path' => __FILE__, |
32 | 30 | 'name' => 'Interwiki Integration', |
33 | 31 | 'author' => 'Tisane', |
34 | 32 | 'url' => 'http://www.mediawiki.org/wiki/Extension:InterwikiIntegration', |
35 | 33 | 'descriptionmsg' => 'interwikiintegration-desc', |
36 | | - 'version' => '1.0.3', |
| 34 | + 'version' => '1.0.4', |
37 | 35 | ); |
38 | | - |
39 | 36 | $dir = dirname( __FILE__ ) . '/'; |
40 | 37 | $wgAutoloadClasses['InterwikiIntegrationHooks'] = $dir . 'InterwikiIntegration.hooks.php'; |
41 | 38 | $wgAutoloadClasses['PopulateInterwikiIntegrationTable'] = "$dir/SpecialInterwikiIntegration.php"; |
| 39 | +$wgAutoloadClasses['PopulateInterwikiWatchlistTable'] = "$dir/SpecialInterwikiIntegration.php"; |
| 40 | +$wgAutoloadClasses['PopulateInterwikiRecentChangesTable'] = "$dir/SpecialInterwikiIntegration.php"; |
| 41 | +#$wgAutoloadClasses['InterwikiWatchlist'] = "$dir/SpecialInterwikiWatchlist.php"; |
| 42 | +#$wgAutoloadClasses['InterwikiRecentChanges'] = "$dir/SpecialInterwikiRecentChanges.php"; |
42 | 43 | $wgExtensionMessagesFiles['InterwikiIntegration'] = $dir . 'InterwikiIntegration.i18n.php'; |
43 | 44 | $wgExtensionAliasesFiles['InterwikiIntegration'] = $dir . 'InterwikiIntegration.alias.php'; |
44 | 45 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationCreateTable'; |
— | — | @@ -49,12 +50,22 @@ |
50 | 51 | $wgHooks['TitleMoveComplete'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationTitleMoveComplete'; |
51 | 52 | $wgHooks['PureWikiDeletionArticleBlankComplete'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationArticleBlankComplete'; |
52 | 53 | $wgHooks['PureWikiDeletionArticleUnblankComplete'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationArticleUnblankComplete'; |
53 | | - |
54 | | -$wgSpecialPages['PopulateInterwikiIntegrationTable'] = 'PopulateInterwikiIntegrationTable'; |
| 54 | +$wgHooks['ArticleEditUpdatesDeleteFromRecentchanges'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationArticleEditUpdatesDeleteFromRecentchanges'; |
| 55 | +$wgHooks['RecentChange_save'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationRecentChange_save'; |
| 56 | +$wgHooks['WatchArticleComplete'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationWatchArticleComplete'; |
| 57 | +$wgHooks['UnwatchArticleComplete'][] = 'InterwikiIntegrationHooks::InterwikiIntegrationUnwatchArticleComplete'; |
| 58 | +$wgSpecialPages['PopulateInterwikiIntegrationTable'] = 'PopulateInterwikiIntegrationTable'; |
| 59 | +$wgSpecialPages['PopulateInterwikiWatchlistTable'] = 'PopulateInterwikiWatchlistTable'; |
| 60 | +$wgSpecialPages['PopulateInterwikiRecentChangesTable'] = 'PopulateInterwikiRecentChangesTable'; |
| 61 | +#$wgSpecialPages['InterwikiWatchlist'] = 'InterwikiWatchlist'; |
| 62 | +#$wgSpecialPages['InterwikiRecentChanges'] = 'InterwikiRecentChanges'; |
| 63 | +$wgSpecialPageGroups['InterwikiWatchlist'] = 'changes'; |
| 64 | +$wgSpecialPageGroups['InterwikiRecentChanges'] = 'changes'; |
55 | 65 | $wgSharedTables[] = 'integration_prefix'; |
56 | 66 | $wgSharedTables[] = 'integration_namespace'; |
57 | 67 | $wgSharedTables[] = 'integration_iwlinks'; |
| 68 | +$wgSharedTables[] = 'integration_watchlist'; |
| 69 | +$wgSharedTables[] = 'integration_recentchanges'; |
58 | 70 | $wgInterwikiIntegrationBrokenLinkStyle = "color: red"; |
59 | | - |
60 | 71 | $wgAvailableRights[] = 'integration'; |
61 | 72 | $wgGroupPermissions['bureaucrat']['integration'] = true; |
\ No newline at end of file |
Index: trunk/extensions/InterwikiIntegration/SpecialInterwikiIntegration.php |
— | — | @@ -1,7 +1,11 @@ |
2 | 2 | <?php |
| 3 | +/* |
| 4 | + * A special page that populates the Integration tables, specifically |
| 5 | + * integration_prefix and integration_namespace |
| 6 | + */ |
3 | 7 | class PopulateInterwikiIntegrationTable extends SpecialPage { |
4 | 8 | function __construct() { |
5 | | - parent::__construct( 'PopulateInterwikiIntegrationTable','integration' ); |
| 9 | + parent::__construct( 'PopulateInterwikiIntegrationTable', 'integration' ); |
6 | 10 | wfLoadExtensionMessages( 'InterwikiIntegration' ); |
7 | 11 | } |
8 | 12 | |
— | — | @@ -17,12 +21,9 @@ |
18 | 22 | } |
19 | 23 | $dbr = wfGetDB( DB_SLAVE ); |
20 | 24 | $dbw = wfGetDB( DB_MASTER ); |
21 | | - |
22 | 25 | $localDBname = $dbr -> getProperty ( 'mDBname' ); |
23 | | - |
24 | 26 | $dbw->delete ( 'integration_prefix', '*' ); |
25 | 27 | if ( isset ( $wgInterwikiIntegrationPrefix ) ) { |
26 | | - |
27 | 28 | foreach ( $wgInterwikiIntegrationPrefix as $thisPrefix => $thisDatabase ) { |
28 | 29 | $thisPWD = 0; |
29 | 30 | if ( isset ( $wgInterwikiIntegrationPWD[$thisDatabase]) |
— | — | @@ -34,12 +35,10 @@ |
35 | 36 | 'integration_prefix' => $thisPrefix, |
36 | 37 | 'integration_pwd' => $thisPWD |
37 | 38 | ); |
38 | | - $dbw->insert ( 'integration_prefix', $newDatabaseRow ); |
39 | | - |
| 39 | + $dbw->insert ( 'integration_prefix', $newDatabaseRow ); |
40 | 40 | foreach ( $wgLocalDatabases as $thisDB ) { |
41 | 41 | $foreignDbr = wfGetDB ( DB_SLAVE, array(), $thisDB ); |
42 | 42 | $foreignDbw = wfGetDB ( DB_MASTER, array(), $thisDB ); |
43 | | - |
44 | 43 | if ( $thisDB != $localDBname && $thisDatabase == $localDBname ) { |
45 | 44 | $foreignResult = $foreignDbr->selectRow( |
46 | 45 | 'interwiki', |
— | — | @@ -62,14 +61,11 @@ |
63 | 62 | } |
64 | 63 | } |
65 | 64 | } |
66 | | - |
67 | 65 | $myCache = new LocalisationCache ( $wgLocalisationCacheConf ); |
68 | | - |
69 | 66 | $namespaceNames = $myCache->getItem ( $wgLanguageCode,'namespaceNames' ); |
70 | 67 | $namespaceNames[NS_PROJECT] = $wgMetaNamespace; |
71 | 68 | $namespaceNames[NS_PROJECT_TALK] = $wgMetaNamespace."_talk"; |
72 | 69 | $dbw->delete ( 'integration_namespace', array( 'integration_dbname' => $localDBname ) ); |
73 | | - |
74 | 70 | foreach ( $namespaceNames as $key => $thisName ) { |
75 | 71 | $newNamespaceRow = array ( 'integration_dbname' => $localDBname, |
76 | 72 | 'integration_namespace_index' => $key, |
— | — | @@ -104,3 +100,79 @@ |
105 | 101 | return; |
106 | 102 | } |
107 | 103 | } |
| 104 | + |
| 105 | +/** |
| 106 | + * A special page that populates the Interwiki watchlist table. |
| 107 | + */ |
| 108 | +class PopulateInterwikiWatchlistTable extends SpecialPage { |
| 109 | + function __construct() { |
| 110 | + parent::__construct( 'PopulateInterwikiWatchlistTable', 'integration' ); |
| 111 | + wfLoadExtensionMessages( 'InterwikiIntegration' ); |
| 112 | + } |
| 113 | + |
| 114 | + function execute( $par ) { |
| 115 | + global $wgInterwikiIntegrationPrefix, $wgOut; |
| 116 | + $dbr = wfGetDB( DB_SLAVE ); |
| 117 | + $dbw = wfGetDB( DB_MASTER ); |
| 118 | + $dbw->delete ( 'integration_watchlist', '*' ); |
| 119 | + $dbList = array_unique ( $wgInterwikiIntegrationPrefix ); |
| 120 | + foreach ( $dbList as $thisDb ) { |
| 121 | + $thisDbr = wfGetDB( DB_SLAVE, array(), $thisDb ); |
| 122 | + $watchlistRes = $thisDbr->select( |
| 123 | + 'watchlist', |
| 124 | + '*' |
| 125 | + ); |
| 126 | + if( $watchlistRes->numRows() > 0 ) { |
| 127 | + while( $row = $watchlistRes->fetchObject() ) { |
| 128 | + foreach ( $row as $key => $value ) { |
| 129 | + $newKey = "integration_" . $key; |
| 130 | + $iWatchlist[$newKey] = $value; |
| 131 | + } |
| 132 | + $iWatchlist['integration_wl_db'] = $thisDb; |
| 133 | + $dbw->insert( 'integration_watchlist', $iWatchlist ); |
| 134 | + } |
| 135 | + } |
| 136 | + } |
| 137 | + $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
| 138 | + $wgOut->addWikiMsg( 'interwikiwatchlist-setuptext' ); |
| 139 | + return; |
| 140 | + } |
| 141 | +} |
| 142 | + |
| 143 | +/** |
| 144 | + * A special page that populates the interwiki recent changes table. |
| 145 | + */ |
| 146 | +class PopulateInterwikiRecentChangesTable extends SpecialPage { |
| 147 | + function __construct() { |
| 148 | + parent::__construct( 'PopulateInterwikiRecentChangesTable', 'integration' ); |
| 149 | + wfLoadExtensionMessages( 'InterwikiIntegration' ); |
| 150 | + } |
| 151 | + |
| 152 | + function execute( $par ) { |
| 153 | + global $wgInterwikiIntegrationPrefix, $wgOut; |
| 154 | + $dbr = wfGetDB( DB_SLAVE ); |
| 155 | + $dbw = wfGetDB( DB_MASTER ); |
| 156 | + $dbw->delete ( 'integration_recentchanges', '*' ); |
| 157 | + $dbList = array_unique ( $wgInterwikiIntegrationPrefix ); |
| 158 | + foreach ( $dbList as $thisDb ) { |
| 159 | + $thisDbr = wfGetDB( DB_SLAVE, array(), $thisDb ); |
| 160 | + $recentchangesRes = $thisDbr->select( |
| 161 | + 'recentchanges', |
| 162 | + '*' |
| 163 | + ); |
| 164 | + if( $recentchangesRes->numRows() > 0 ) { |
| 165 | + while( $row = $recentchangesRes->fetchObject() ) { |
| 166 | + foreach ( $row as $key => $value ) { |
| 167 | + $newKey = "integration_" . $key; |
| 168 | + $iRecentChange[$newKey] = $value; |
| 169 | + } |
| 170 | + $iRecentChange['integration_rc_db'] = $thisDb; |
| 171 | + $dbw->insert( 'integration_recentchanges', $iRecentChange ); |
| 172 | + } |
| 173 | + } |
| 174 | + } |
| 175 | + $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
| 176 | + $wgOut->addWikiMsg( 'interwikirecentchanges-setuptext' ); |
| 177 | + return; |
| 178 | + } |
| 179 | +} |
\ No newline at end of file |
Index: trunk/extensions/InterwikiIntegration/InterwikiIntegration.hooks.php |
— | — | @@ -1,8 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class InterwikiIntegrationHooks { |
5 | | - |
6 | | - /* |
| 5 | + /** |
7 | 6 | * Creates necessary tables |
8 | 7 | */ |
9 | 8 | public static function InterwikiIntegrationCreateTable() { |
— | — | @@ -19,10 +18,18 @@ |
20 | 19 | 'integration_iwlinks', |
21 | 20 | dirname( __FILE__ ) . '/interwikiintegration-iwlinks.sql' |
22 | 21 | ); |
| 22 | + $wgExtNewTables[] = array( |
| 23 | + 'integration_watchlist', |
| 24 | + dirname( __FILE__ ) . '/interwikiintegration-watchlist.sql' |
| 25 | + ); |
| 26 | + $wgExtNewTables[] = array( |
| 27 | + 'integration_recentchanges', |
| 28 | + dirname( __FILE__ ) . '/interwikiintegration-recentchanges.sql' |
| 29 | + ); |
23 | 30 | return true; |
24 | 31 | } |
25 | 32 | |
26 | | - /* |
| 33 | + /** |
27 | 34 | * Update the integration_iwlinks table when interwiki links are added or |
28 | 35 | * removed from articles. |
29 | 36 | */ |
— | — | @@ -111,7 +118,7 @@ |
112 | 119 | return true; |
113 | 120 | } |
114 | 121 | |
115 | | - /* |
| 122 | + /** |
116 | 123 | * When a page is created, purge caches of pages that link to it interwiki |
117 | 124 | */ |
118 | 125 | public static function InterwikiIntegrationArticleInsertComplete ( &$article, &$user, $text, $summary, $minoredit, |
— | — | @@ -120,7 +127,7 @@ |
121 | 128 | return true; |
122 | 129 | } |
123 | 130 | |
124 | | - /* |
| 131 | + /** |
125 | 132 | * When a page is deleted, purge caches of pages that link to it interwiki |
126 | 133 | */ |
127 | 134 | public static function InterwikiIntegrationArticleDeleteComplete( &$article, &$user, $reason, $id ) { |
— | — | @@ -133,7 +140,7 @@ |
134 | 141 | return true; |
135 | 142 | } |
136 | 143 | |
137 | | - /* |
| 144 | + /** |
138 | 145 | * When a page is undeleted, purge caches of pages that link to it interwiki |
139 | 146 | */ |
140 | 147 | public static function InterwikiIntegrationArticleUndelete ( $title, $create ) { |
— | — | @@ -143,7 +150,7 @@ |
144 | 151 | return true; |
145 | 152 | } |
146 | 153 | |
147 | | - /* |
| 154 | + /** |
148 | 155 | * When a page is moved, purge caches of pages that link to the new page interwiki |
149 | 156 | */ |
150 | 157 | public static function InterwikiIntegrationTitleMoveComplete ( &$title, &$newtitle, &$user, $oldid, $newid ) { |
— | — | @@ -151,7 +158,7 @@ |
152 | 159 | return true; |
153 | 160 | } |
154 | 161 | |
155 | | - /* |
| 162 | + /** |
156 | 163 | * When a page is blanked, purge caches of pages that link to the new page interwiki. |
157 | 164 | * This is called by a PureWikiDeletion hook. |
158 | 165 | */ |
— | — | @@ -160,7 +167,7 @@ |
161 | 168 | return true; |
162 | 169 | } |
163 | 170 | |
164 | | - /* |
| 171 | + /** |
165 | 172 | * When a page is unblanked, purge caches of pages that link to the new page interwiki. |
166 | 173 | * This is called by a PureWikiDeletion hook. |
167 | 174 | */ |
— | — | @@ -169,6 +176,10 @@ |
170 | 177 | return true; |
171 | 178 | } |
172 | 179 | |
| 180 | + /** |
| 181 | + * Purges squids and invalidates caches of pages that link to $title |
| 182 | + * interwiki. |
| 183 | + */ |
173 | 184 | public static function PurgeReferringPages ( $title ) { |
174 | 185 | global $wgDBname, $wgInterwikiIntegrationPrefix; |
175 | 186 | |
— | — | @@ -190,8 +201,7 @@ |
191 | 202 | array ( |
192 | 203 | 'integration_iwl_prefix' => $thisPrefix, |
193 | 204 | 'integration_iwl_title' => $titleName |
194 | | - ), |
195 | | - __METHOD__ |
| 205 | + ) |
196 | 206 | ); |
197 | 207 | if ( $result ) { |
198 | 208 | $referringPage = $result->integration_iwl_from; |
— | — | @@ -213,7 +223,7 @@ |
214 | 224 | return true; |
215 | 225 | } |
216 | 226 | |
217 | | - /* |
| 227 | + /** |
218 | 228 | * Determines whether an interwiki link to a wiki on the same wiki |
219 | 229 | * farm is broken or not; if so, it will be colored red and link to the |
220 | 230 | * edit page on the target wiki |
— | — | @@ -221,10 +231,8 @@ |
222 | 232 | public static function InterwikiIntegrationLink( $skin, $target, &$text, |
223 | 233 | &$customAttribs, &$query, &$options, &$ret ) { |
224 | 234 | global $wgInterwikiIntegrationBrokenLinkStyle, $wgPureWikiDeletionInEffect; |
225 | | - |
226 | 235 | if ( $target->isExternal() ) { |
227 | 236 | $dbr = wfGetDB( DB_SLAVE ); |
228 | | - |
229 | 237 | $interwikiPrefix = $target->getInterwiki (); |
230 | 238 | $interwikiPrefix{0} = strtolower($interwikiPrefix{0}); |
231 | 239 | $result = $dbr->selectRow( |
— | — | @@ -232,15 +240,11 @@ |
233 | 241 | 'integration_dbname', |
234 | 242 | array( "integration_prefix" => $interwikiPrefix ) |
235 | 243 | ); |
236 | | - |
237 | 244 | if ( !$result ) { |
238 | 245 | return true; |
239 | 246 | } |
240 | | - |
241 | 247 | $targetDb = $result->integration_dbname; |
242 | | - |
243 | 248 | $dbrTarget = wfGetDB( DB_SLAVE, array(), $targetDb ); |
244 | | - |
245 | 249 | $title = $target->getDBkey (); |
246 | 250 | $colonPos = strpos ( $title, ':' ); |
247 | 251 | $namespaceIndex = ''; |
— | — | @@ -310,5 +314,95 @@ |
311 | 315 | } |
312 | 316 | return true; |
313 | 317 | } |
314 | | -} |
315 | | - |
| 318 | + |
| 319 | + /** |
| 320 | + * Flush old entries from the `integration_recentchanges` table; we do this on |
| 321 | + * random requests so as to avoid an increase in writes for no good reason |
| 322 | + */ |
| 323 | + public static function InterwikiIntegrationArticleEditUpdatesDeleteFromRecentchanges( &$article ) { |
| 324 | + if ( 0 == mt_rand( 0, 99 ) ) { |
| 325 | + global $wgRCMaxAge; |
| 326 | + $dbw = wfGetDB( DB_MASTER ); |
| 327 | + $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); |
| 328 | + $recentchanges = $dbw->tableName( 'integration_recentchanges' ); |
| 329 | + $sql = "DELETE FROM $recentchanges WHERE integration_rc_timestamp < '{$cutoff}'"; |
| 330 | + $dbw->query( $sql ); |
| 331 | + } |
| 332 | + return true; |
| 333 | + } |
| 334 | + |
| 335 | + /** |
| 336 | + * Save recent changes to integration_recentchanges |
| 337 | + */ |
| 338 | + public static function InterwikiIntegrationRecentChange_save( $recentChange ) { |
| 339 | + $dbw = wfGetDB( DB_MASTER ); |
| 340 | + global $wgDBname; |
| 341 | + foreach ( $recentChange->mAttribs as $key => $value ) { |
| 342 | + $newKey = "integration_" . $key; |
| 343 | + $iRecentChange[$newKey] = $value; |
| 344 | + } |
| 345 | + $iRecentChange['integration_rc_db'] = $wgDBname; |
| 346 | + $dbw->insert( 'integration_recentchanges', $iRecentChange ); |
| 347 | + return true; |
| 348 | + } |
| 349 | + |
| 350 | + /** |
| 351 | + * Add newly watched articles to integration_watchlist |
| 352 | + */ |
| 353 | + public static function InterwikiIntegrationWatchArticleComplete( &$user, &$article ) { |
| 354 | + $title = $article->getTitle(); |
| 355 | + if ( $title->isTalkPage () ) { |
| 356 | + $subjectNamespace = $title->getSubjectPage()->getNamespace(); |
| 357 | + $talkNamespace = $title->getNamespace(); |
| 358 | + } else { |
| 359 | + $subjectNamespace = $title->getNamespace(); |
| 360 | + $talkNamespace = $title->getTalkPage()->getNamespace(); |
| 361 | + } |
| 362 | + $DBkey = $title->getDBkey(); |
| 363 | + $dbw = wfGetDB( DB_MASTER ); |
| 364 | + $dbw->insert( 'integration_watchlist', |
| 365 | + array( |
| 366 | + 'integration_wl_user' => $user->id, |
| 367 | + 'integration_wl_namespace' => $subjectNamespace, |
| 368 | + 'integration_wl_title' => $DBkey, |
| 369 | + 'integration_wl_notificationtimestamp' => null |
| 370 | + ) ); |
| 371 | + $dbw->insert( 'integration_watchlist', |
| 372 | + array( |
| 373 | + 'integration_wl_user' => $this->id, |
| 374 | + 'integration_wl_namespace' => $talkNamespace, |
| 375 | + 'integration_wl_title' => $DBkey, |
| 376 | + 'integration_wl_notificationtimestamp' => null |
| 377 | + ) ); |
| 378 | + return true; |
| 379 | + } |
| 380 | + |
| 381 | + /** |
| 382 | + * Remove newly unwatched articles from integration_watchlist |
| 383 | + */ |
| 384 | + public static function InterwikiIntegrationUnwatchArticleComplete ( &$user, &$article ) { |
| 385 | + $title = $article->getTitle(); |
| 386 | + if ( $title->isTalkPage () ) { |
| 387 | + $subjectNamespace = $title->getSubjectPage()->getNamespace(); |
| 388 | + $talkNamespace = $title->getNamespace(); |
| 389 | + } else { |
| 390 | + $subjectNamespace = $title->getNamespace(); |
| 391 | + $talkNamespace = $title->getTalkPage()->getNamespace(); |
| 392 | + } |
| 393 | + $DBkey = $title->getDBkey(); |
| 394 | + $dbw = wfGetDB( DB_MASTER ); |
| 395 | + $dbw->delete( 'integration_watchlist', |
| 396 | + array( |
| 397 | + 'integration_wl_user' => $user->id, |
| 398 | + 'integration_wl_namespace' => $subjectNamespace, |
| 399 | + 'integration_wl_title' => $DBkey |
| 400 | + ) ); |
| 401 | + $dbw->insert( 'integration_watchlist', |
| 402 | + array( |
| 403 | + 'integration_wl_user' => $this->id, |
| 404 | + 'integration_wl_namespace' => $talkNamespace, |
| 405 | + 'integration_wl_title' => $DBkey |
| 406 | + ) ); |
| 407 | + return true; |
| 408 | + } |
| 409 | +} |
\ No newline at end of file |
Index: trunk/extensions/InterwikiIntegration/interwikiintegration-watchlist.sql |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +CREATE TABLE integration_watchlist ( |
| 5 | + -- Key to user.user_id |
| 6 | + integration_wl_user int unsigned NOT NULL, |
| 7 | + -- Database name of the wiki |
| 8 | + integration_wl_db varchar(256) binary NOT NULL, |
| 9 | + -- Key to page_namespace |
| 10 | + integration_wl_namespace int NOT NULL default 0, |
| 11 | + -- Key to page_title |
| 12 | + integration_wl_title varchar(255) binary NOT NULL default '', |
| 13 | + -- Timestamp when user was last sent a notification e-mail; |
| 14 | + -- cleared when the user visits the page. |
| 15 | + integration_wl_notificationtimestamp varbinary(14) |
| 16 | +); |
| 17 | + |
| 18 | +CREATE UNIQUE INDEX integration_wl_user ON integration_watchlist (integration_wl_user, integration_wl_namespace, integration_wl_title); |
| 19 | +CREATE INDEX integration_namespace_title ON integration_watchlist (integration_wl_namespace, integration_wl_title); |
| 20 | + |
| 21 | +COMMIT; |
Index: trunk/extensions/InterwikiIntegration/interwikiintegration-recentchanges.sql |
— | — | @@ -0,0 +1,91 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +-- |
| 5 | +-- Primarily a summary table for Special:Recentchanges, |
| 6 | +-- this table contains some additional info on edits from |
| 7 | +-- the last few days, see Article::editUpdates() |
| 8 | +-- |
| 9 | +CREATE TABLE /*_*/integration_recentchanges ( |
| 10 | + integration_rc_global_id int NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 11 | + |
| 12 | + -- Local rc_id |
| 13 | + integration_rc_id int NOT NULL, |
| 14 | + |
| 15 | + -- Database name of the wiki |
| 16 | + integration_rc_db varchar(256) binary NOT NULL, |
| 17 | + |
| 18 | + integration_rc_timestamp varbinary(14) NOT NULL default '', |
| 19 | + integration_rc_cur_time varbinary(14) NOT NULL default '', |
| 20 | + |
| 21 | + -- As in revision |
| 22 | + integration_rc_user int unsigned NOT NULL default 0, |
| 23 | + integration_rc_user_text varchar(255) binary NOT NULL, |
| 24 | + |
| 25 | + -- When pages are renamed, their RC entries do _not_ change. |
| 26 | + integration_rc_namespace int NOT NULL default 0, |
| 27 | + integration_rc_title varchar(255) binary NOT NULL default '', |
| 28 | + |
| 29 | + -- as in revision... |
| 30 | + integration_rc_comment varchar(255) binary NOT NULL default '', |
| 31 | + integration_rc_minor tinyint unsigned NOT NULL default 0, |
| 32 | + |
| 33 | + -- Edits by user accounts with the 'bot' rights key are |
| 34 | + -- marked with a 1 here, and will be hidden from the |
| 35 | + -- default view. |
| 36 | + integration_rc_bot tinyint unsigned NOT NULL default 0, |
| 37 | + |
| 38 | + integration_rc_new tinyint unsigned NOT NULL default 0, |
| 39 | + |
| 40 | + -- Key to page_id (was cur_id prior to 1.5). |
| 41 | + -- This will keep links working after moves while |
| 42 | + -- retaining the at-the-time name in the changes list. |
| 43 | + integration_rc_cur_id int unsigned NOT NULL default 0, |
| 44 | + |
| 45 | + -- rev_id of the given revision |
| 46 | + integration_rc_this_oldid int unsigned NOT NULL default 0, |
| 47 | + |
| 48 | + -- rev_id of the prior revision, for generating diff links. |
| 49 | + integration_rc_last_oldid int unsigned NOT NULL default 0, |
| 50 | + |
| 51 | + -- These may no longer be used, with the new move log. |
| 52 | + integration_rc_type tinyint unsigned NOT NULL default 0, |
| 53 | + integration_rc_moved_to_ns tinyint unsigned NOT NULL default 0, |
| 54 | + integration_rc_moved_to_title varchar(255) binary NOT NULL default '', |
| 55 | + |
| 56 | + -- If the Recent Changes Patrol option is enabled, |
| 57 | + -- users may mark edits as having been reviewed to |
| 58 | + -- remove a warning flag on the RC list. |
| 59 | + -- A value of 1 indicates the page has been reviewed. |
| 60 | + integration_rc_patrolled tinyint unsigned NOT NULL default 0, |
| 61 | + |
| 62 | + -- Recorded IP address the edit was made from, if the |
| 63 | + -- $wgPutIPinRC option is enabled. |
| 64 | + integration_rc_ip varbinary(40) NOT NULL default '', |
| 65 | + |
| 66 | + -- Text length in characters before |
| 67 | + -- and after the edit |
| 68 | + integration_rc_old_len int, |
| 69 | + integration_rc_new_len int, |
| 70 | + |
| 71 | + -- Visibility of recent changes items, bitfield |
| 72 | + integration_rc_deleted tinyint unsigned NOT NULL default 0, |
| 73 | + |
| 74 | + -- Value corresonding to log_id, specific log entries |
| 75 | + integration_rc_logid int unsigned NOT NULL default 0, |
| 76 | + -- Store log type info here, or null |
| 77 | + integration_rc_log_type varbinary(255) NULL default NULL, |
| 78 | + -- Store log action or null |
| 79 | + integration_rc_log_action varbinary(255) NULL default NULL, |
| 80 | + -- Log params |
| 81 | + integration_rc_params blob NULL |
| 82 | +) /*$wgDBTableOptions*/; |
| 83 | + |
| 84 | +CREATE INDEX /*i*/integration_rc_timestamp ON integration_recentchanges (integration_rc_timestamp); |
| 85 | +CREATE INDEX /*i*/integration_rc_namespace_title ON integration_recentchanges (integration_rc_namespace, integration_rc_title); |
| 86 | +CREATE INDEX /*i*/integration_rc_cur_id ON integration_recentchanges (integration_rc_cur_id); |
| 87 | +CREATE INDEX /*i*/integration_new_name_timestamp ON integration_recentchanges (integration_rc_new,integration_rc_namespace,integration_rc_timestamp); |
| 88 | +CREATE INDEX /*i*/integration_rc_ip ON integration_recentchanges (integration_rc_ip); |
| 89 | +CREATE INDEX /*i*/integration_rc_ns_usertext ON integration_recentchanges (integration_rc_namespace, integration_rc_user_text); |
| 90 | +CREATE INDEX /*i*/integration_rc_user_text ON integration_recentchanges (integration_rc_user_text, integration_rc_timestamp); |
| 91 | + |
| 92 | +COMMIT; |
\ No newline at end of file |