Index: trunk/extensions/DSMW/DSMW.hooks.php |
— | — | @@ -17,6 +17,27 @@ |
18 | 18 | /** |
19 | 19 | * @since 1.1 |
20 | 20 | * |
| 21 | + * @return true |
| 22 | + */ |
| 23 | + public function onExtensionSchemaUpdates() { |
| 24 | + global $wgExtNewTables; |
| 25 | + |
| 26 | + $wgExtNewTables[] = array( |
| 27 | + 'model', |
| 28 | + dirname( __FILE__ ) . '/DSMW.sql' |
| 29 | + ); |
| 30 | + |
| 31 | + $wgExtNewTables[] = array( |
| 32 | + 'p2p_params', |
| 33 | + dirname( __FILE__ ) . '/DSMW.sql' |
| 34 | + ); |
| 35 | + |
| 36 | + return true; |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * @since 1.1 |
| 41 | + * |
21 | 42 | * @param EditPage $editor |
22 | 43 | * @param OutputPage &$out |
23 | 44 | * |
— | — | @@ -701,5 +722,4 @@ |
702 | 723 | return true; |
703 | 724 | } |
704 | 725 | |
705 | | - |
706 | | -} |
\ No newline at end of file |
| 726 | +} |
Index: trunk/extensions/DSMW/logootModel/manager.php |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | * Used to seperated the data access layer |
6 | 6 | * |
7 | 7 | * @copyright INRIA-LORIA-ECOO project |
| 8 | + * |
8 | 9 | * @author CUCUTEANU |
9 | 10 | */ |
10 | 11 | class manager { |
— | — | @@ -23,6 +24,7 @@ |
24 | 25 | return new boModel(); |
25 | 26 | } |
26 | 27 | } catch ( Exception $e ) { |
| 28 | + die($e->getMessage()); |
27 | 29 | throw new MWException( __METHOD__ . ' db access problems, |
28 | 30 | if this page existed before the DSMW installation, |
29 | 31 | maybe it has not been processed by DSMW' ); |
— | — | @@ -47,4 +49,5 @@ |
48 | 50 | throw new MWException( __METHOD__ . ' db access problems' ); |
49 | 51 | } |
50 | 52 | } |
| 53 | + |
51 | 54 | } |
Index: trunk/extensions/DSMW/db/DSMWDBHelpers.php |
— | — | @@ -1,63 +0,0 @@ |
2 | | -<?php |
3 | | -/* |
4 | | - * To change this template, choose Tools | Templates |
5 | | - * and open the template in the editor. |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * Description of DSMWDBHelpers |
10 | | - * |
11 | | - * @copyright INRIA-LORIA-SCORE Team |
12 | | - * @author jean-Philippe Muller |
13 | | - */ |
14 | | -class DSMWDBHelpers { |
15 | | - |
16 | | - public static function setup( $db ) { |
17 | | - extract( $db->tableNames( 'model', 'p2p_params' ) ); |
18 | | - DSMWDBHelpers::reportProgress( "Setting up database configuration for DSMW ...\n\n" ); |
19 | | - DSMWDBHelpers::setupTable( $model, $db ); |
20 | | - DSMWDBHelpers::setupTable( $p2p_params, $db ); |
21 | | - DSMWDBHelpers::reportProgress( "Database initialised successfully.\n\n" ); |
22 | | - return true; |
23 | | - } |
24 | | - |
25 | | - public static function setupTable( $table, $db ) { |
26 | | - global $wgDBname, $wgDBprefix; |
27 | | - $fname = 'DSMWDBHelpers::setupTable'; |
28 | | - DSMWDBHelpers::reportProgress( "Setting up table $table ...\n" ); |
29 | | - if ( $db->tableExists( $table ) === false ) { |
30 | | - // creation |
31 | | - if ( $table == "`{$wgDBprefix}model`" ) { |
32 | | - $sql = 'CREATE TABLE ' . "`$wgDBname`." . $table . ' ( |
33 | | -`rev_id` INT( 10 ) NOT NULL , |
34 | | -`session_id` VARCHAR( 50 ) NOT NULL , |
35 | | -`blob_info` LONGBLOB NULL , |
36 | | -`causal_barrier` BLOB NULL , |
37 | | -PRIMARY KEY ( `rev_id` , `session_id` ) |
38 | | -) ENGINE = InnoDB CHARACTER SET binary;'; |
39 | | - $db->query( $sql, $fname ); |
40 | | - } elseif ( $table == "`{$wgDBprefix}p2p_params`" ) { |
41 | | - $sql = 'CREATE TABLE ' . "`$wgDBname`." . $table . ' ( |
42 | | -`value` BIGINT( 18 ) NOT NULL DEFAULT \'0\', |
43 | | - `server_id` VARCHAR( 40 ) NOT NULL DEFAULT \'0\' |
44 | | -) ENGINE = InnoDB DEFAULT CHARSET = latin1;'; |
45 | | -$sql1 = 'INSERT INTO ' . "`$wgDBname`." . $table . ' (`value`, `server_id`) VALUES (\'0\', \'0\');'; |
46 | | - $db->query( $sql, $fname ); |
47 | | - $db->query( $sql1, $fname ); |
48 | | - } |
49 | | - |
50 | | - DSMWDBHelpers::reportProgress( " ... new table created\n" ); |
51 | | - } else { |
52 | | - DSMWDBHelpers::reportProgress( " ... table exists already\n" ); |
53 | | - } |
54 | | - } |
55 | | - |
56 | | - public static function reportProgress( $msg ) { |
57 | | - if ( ob_get_level() == 0 ) { |
58 | | - ob_start(); |
59 | | - } |
60 | | - print $msg; |
61 | | - ob_flush(); |
62 | | - flush(); |
63 | | - } |
64 | | -} |
Index: trunk/extensions/DSMW/db/addedTables.sql |
— | — | @@ -1,18 +0,0 @@ |
2 | | - |
3 | | -DROP TABLE IF EXISTS `wikidb`./*$wgDBprefix*/model; |
4 | | -DROP TABLE IF EXISTS `wikidb`./*$wgDBprefix*/p2p_params; |
5 | | - |
6 | | -CREATE TABLE `wikidb`./*$wgDBprefix*/model ( |
7 | | -`rev_id` INT( 10 ) NOT NULL , |
8 | | -`session_id` VARCHAR( 50 ) NOT NULL , |
9 | | -`blob_info` LONGBLOB NULL , |
10 | | -`causal_barrier` BLOB NULL , |
11 | | -PRIMARY KEY ( `rev_id` , `session_id` ) |
12 | | -) ENGINE = InnoDB CHARACTER SET binary; |
13 | | - |
14 | | - CREATE TABLE `wikidb`./*$wgDBprefix*/p2p_params ( |
15 | | -`value` BIGINT( 18 ) NOT NULL DEFAULT '0', |
16 | | - `server_id` VARCHAR( 40 ) NOT NULL DEFAULT '0' |
17 | | -) ENGINE = InnoDB DEFAULT CHARSET = latin1; |
18 | | - |
19 | | -INSERT INTO `wikidb`./*$wgDBprefix*/p2p_params (`value`, `server_id`) VALUES ('0', '0'); |
\ No newline at end of file |
Index: trunk/extensions/DSMW/jobs/DSMWPropertyTypeJob.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Job that assigns a type to some properties used in the DSMW ontology |
| 4 | + * Job that assigns a type to some properties used in the DSMW ontology. |
5 | 5 | * |
6 | 6 | * @copyright 2009 INRIA-LORIA-Score Team |
7 | 7 | * |
Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -99,6 +99,7 @@ |
100 | 100 | |
101 | 101 | $wgExtensionFunctions[] = 'dsmwgSetupFunction'; |
102 | 102 | |
| 103 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'DSMWHooks::onExtensionSchemaUpdates'; |
103 | 104 | $wgHooks['UnknownAction'][] = 'DSMWHooks::onUnknownAction'; |
104 | 105 | $wgHooks['EditPage::attemptSave'][] = 'DSMWHooks::onAttemptSave'; |
105 | 106 | $wgHooks['EditPageBeforeConflictDiff'][] = 'DSMWHooks::onEditConflict'; |
Index: trunk/extensions/DSMW/includes/DSMWExhibits.php |
— | — | @@ -10,7 +10,8 @@ |
11 | 11 | * |
12 | 12 | */ |
13 | 13 | class DSMWExhibits { |
14 | | -// Constructor |
| 14 | + |
| 15 | + // Constructor |
15 | 16 | public function DSMWExhibits() { |
16 | 17 | global $wgHooks; |
17 | 18 | |
— | — | @@ -80,8 +81,6 @@ |
81 | 82 | |
82 | 83 | $wgOut->addWikiText( $text ); |
83 | 84 | |
84 | | - |
85 | | - |
86 | 85 | return false; |
87 | 86 | } |
88 | 87 | else { |
— | — | @@ -109,5 +108,4 @@ |
110 | 109 | return true; |
111 | 110 | } |
112 | 111 | |
113 | | - |
114 | 112 | } |
Index: trunk/extensions/DSMW/includes/DSMWSiteId.php |
— | — | @@ -47,24 +47,25 @@ |
48 | 48 | return strtoupper( $serverId ); |
49 | 49 | } |
50 | 50 | |
51 | | -/** |
52 | | - * loads the siteId from the DB |
53 | | - * @return <string> siteId |
54 | | - */ |
| 51 | + /** |
| 52 | + * loads the siteId from the DB |
| 53 | + * @return <string> siteId |
| 54 | + */ |
55 | 55 | private function loadServerId() { |
56 | 56 | $db = wfGetDB( DB_SLAVE ); |
57 | 57 | $res = $db->selectField( 'p2p_params', 'server_id' ); |
58 | 58 | return $res; |
59 | 59 | } |
60 | 60 | |
61 | | -/** |
62 | | - * stores the siteId to the DB |
63 | | - * @param <type> $ServerId |
64 | | - */ |
| 61 | + /** |
| 62 | + * stores the siteId to the DB |
| 63 | + * @param <type> $ServerId |
| 64 | + */ |
65 | 65 | private function store( $ServerId ) { |
66 | 66 | $dbw = wfGetDB( DB_MASTER ); |
67 | 67 | $dbw->update( 'p2p_params', array( |
68 | 68 | 'server_id' => $ServerId, |
69 | 69 | ), '*', __METHOD__ ); |
70 | 70 | } |
| 71 | + |
71 | 72 | } |
Index: trunk/extensions/DSMW/includes/Ajax/include.php |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
4 | 5 | * JavaScript extension - Includes all *.js files in the directory containing this script |
5 | 6 | * |
— | — | @@ -34,4 +35,3 @@ |
35 | 36 | } |
36 | 37 | return true; |
37 | 38 | } |
38 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/DSMW/DSMW.sql |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +-- MySQL version of the database schema for the DSMW extension. |
| 3 | + |
| 4 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/model ( |
| 5 | + rev_id INT( 10 ) NOT NULL, |
| 6 | + session_id VARCHAR( 50 ) NOT NULL, |
| 7 | + blob_info LONGBLOB NULL, |
| 8 | + causal_barrier BLOB NULL, |
| 9 | + PRIMARY KEY ( `rev_id` , `session_id` ) |
| 10 | +) ENGINE = InnoDB CHARACTER SET binary; |
| 11 | + |
| 12 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/p2p_params ( |
| 13 | + value BIGINT( 18 ) NOT NULL DEFAULT '0', |
| 14 | + server_id VARCHAR( 40 ) NOT NULL DEFAULT '0' |
| 15 | +) ENGINE = InnoDB DEFAULT CHARSET = latin1; |
| 16 | + |
| 17 | +INSERT INTO /*$wgDBprefix*/p2p_params (value, server_id) VALUES ('0', '0'); |
\ No newline at end of file |
Property changes on: trunk/extensions/DSMW/DSMW.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 18 | + native |
Index: trunk/extensions/DSMW/specialPage/DSMWAdmin.php |
— | — | @@ -4,11 +4,10 @@ |
5 | 5 | * DSMW Special page |
6 | 6 | * |
7 | 7 | * @copyright INRIA-LORIA-ECOO project |
| 8 | + * |
8 | 9 | * @author jean-Philippe Muller |
9 | 10 | */ |
10 | 11 | |
11 | | -require_once "$IP/includes/SpecialPage.php"; |
12 | | - |
13 | 12 | class DSMWAdmin extends SpecialPage { |
14 | 13 | |
15 | 14 | public function __construct() { |
— | — | @@ -35,10 +34,9 @@ |
36 | 35 | * @return <bool> |
37 | 36 | */ |
38 | 37 | public function execute() { |
39 | | - global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath; /*, $wgSitename, $wgCachePages, $wgUser, $wgTitle, $wgDenyAccessMessage, $wgAllowAnonUsers, $wgRequest, $wgMessageCache, $wgWatchingMessages, $wgDBtype, $namespace_titles;*/ |
| 38 | + global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath; |
40 | 39 | $urlServer = 'http://' . $wgServerName . $wgScriptPath; |
41 | 40 | |
42 | | - |
43 | 41 | /**** Get status of refresh job, if any ****/ |
44 | 42 | $dbr =& wfGetDB( DB_SLAVE ); |
45 | 43 | $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'DSMWUpdateJob' ), __METHOD__ ); |
— | — | @@ -104,17 +102,10 @@ |
105 | 103 | |
106 | 104 | } |
107 | 105 | |
108 | | - |
109 | 106 | $wgOut->setPagetitle( "DSMW Settings" ); |
110 | 107 | |
111 | 108 | $output = '<p>This page helps you during installation of Distributed Semantic MediaWiki.</p>'; |
112 | 109 | |
113 | | - // creating tables |
114 | | - $output .= '<form name="buildtables" action="" method="POST">' . |
115 | | - '<input type="hidden" name="action" value="updatetables">'; |
116 | | - $output .= '<br /><h2>Database: DSMW tables installation</h2>' . |
117 | | - '<p>Distributed Semantic MediaWiki requires some tables to be created in the database.</p>'; |
118 | | - $output .= '<input type="submit" value="Initialise tables"/></form>'; |
119 | 110 | // creating properties |
120 | 111 | $output .= '<form name="properties" action="" method="POST">' . |
121 | 112 | '<input type="hidden" name="action" value="addProperties">'; |