Skip to content

Commit

Permalink
Apply (modified) patch by Mwmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Jun 25, 2014
1 parent 01ecbe1 commit 3ef8f0d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Maps.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,20 @@ public static function onCanonicalNamespaces( array &$list ) {
*
* @since 3.0
*
* @global type $wgDBtype
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
global $wgDBtype;

switch( $wgDBtype ) {
switch( $GLOBALS['wgDBtype'] ) {
case 'mysql':
case 'sqlite':
$sqlPath = dirname( __FILE__ ) . '/schema/MapsLayers.sql';
break;
/** @ToDo: Support for Postgree SQL and others **/
$updater->addExtensionTable( 'maps_layers', __DIR__ . '/schema/MapsLayers.sql' );
break;
case 'postgres':
$updater->addExtensionTable( 'maps_layers', __DIR__ . '/schema/MapsLayers-postgres.sql' );
break;
}
$updater->addExtensionTable( 'maps_layers', $sqlPath );

return true;
}
Expand Down
10 changes: 10 additions & 0 deletions schema/MapsLayers-postgres.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN;

CREATE TABLE maps_layers (
layer_page_id INTEGER NOT NULL REFERENCES page(page_id) ON DELETE CASCADE,
layer_name VARCHAR(64) DEFAULT NULL,
layer_type VARCHAR(32) NOT NULL,
layer_data TEXT NOT NULL
) /*$wgDBTableOptions*/;

COMMIT;

0 comments on commit 3ef8f0d

Please sign in to comment.