Index: trunk/extensions/AdvancedMeta/AdvancedMeta.php |
— | — | @@ -1,5 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die( 'This is an extension to the MediaWiki software and cannot be used standalone.' ); |
| 5 | + |
4 | 6 | /** |
5 | 7 | * MediaWiki Advanced Meta extension |
6 | 8 | * Add meta data to individual pages or entire namespaces |
— | — | @@ -21,6 +23,21 @@ |
22 | 24 | $wgExtensionMessagesFiles['MWAdvancedMeta'] = dirname( __FILE__ ) . '/MWAdvancedMeta.i18n.php'; |
23 | 25 | MWAdvancedMeta::setup(); |
24 | 26 | |
| 27 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'efAdvancedMetaSchemaUpdates'; |
| 28 | + |
| 29 | +/** |
| 30 | + * @param $updater DatabaseUpdater |
| 31 | + * @return bool |
| 32 | + */ |
| 33 | +function efAdvancedMetaSchemaUpdates( $updater ) { |
| 34 | + $base = dirname( __FILE__ ); |
| 35 | + switch ( $updater->getDB()->getType() ) { |
| 36 | + case 'mysql': |
| 37 | + $updater->addExtensionUpdate( array( 'addTable', 'ext_meta', |
| 38 | + "$base/AdvancedMeta.sql", true ) ); // Initial install tables |
| 39 | + } |
| 40 | +} |
| 41 | + |
25 | 42 | class MWAdvancedMeta { |
26 | 43 | |
27 | 44 | private static $instance = null; |
— | — | @@ -30,18 +47,11 @@ |
31 | 48 | * @return MWAdvancedMeta the plugin object, which you can use to set settings. |
32 | 49 | */ |
33 | 50 | public static function setup() { |
34 | | - |
35 | | - // check for wiki |
36 | | - if ( !defined( 'MEDIAWIKI' ) ) { |
37 | | - throw new Exception( 'This is an extension to the MediaWiki software and cannot be used standalone.' ); |
38 | | - } |
39 | | - |
40 | 51 | // create plugin |
41 | 52 | if ( self::$instance === null ) { |
42 | 53 | self::$instance = new self(); |
43 | 54 | } |
44 | 55 | return self::$instance; |
45 | | - |
46 | 56 | } |
47 | 57 | |
48 | 58 | private $indexedPages = array( NS_MAIN, NS_PROJECT ); |
Index: trunk/extensions/AdvancedMeta/AdvancedMeta.sql |
— | — | @@ -1,4 +1,4 @@ |
2 | | -CREATE TABLE /*_*/dbprefix_ext_meta ( |
| 2 | +CREATE TABLE /*_*/ext_meta ( |
3 | 3 | `pageid` INT(8) NOT NULL, |
4 | 4 | `rindex` tinyint(1) NOT NULL, |
5 | 5 | `rfollow` tinyint(1) NOT NULL, |