public function initDatabaseTables()
 {
     $db =& wfGetDB(DB_MASTER);
     $verbose = true;
     DBHelper::reportProgress("Setting up qury results cache ...\n", $verbose);
     DBHelper::reportProgress("   ... Creating query results cache table \n", $verbose);
     $qrcTable = $db->tableName('smw_qrc_cache');
     DBHelper::setupTable($qrcTable, array('query_id' => 'VARCHAR(36) NOT NULL PRIMARY KEY', 'query_result' => 'LONGTEXT', 'last_update' => 'int(20) NOT NULL', 'access_frequency' => 'INT(8) NOT NULL', 'invalidation_frequency' => 'INT(8) NOT NULL', 'dirty' => 'BOOLEAN NOT NULL', 'priority' => 'INT(20) NOT NULL'), $db, $verbose);
     DBHelper::reportProgress("   ... done!\n", $verbose);
 }
 /**
  * Setups database for Materialization
  *
  * @param boolean $verbose
  */
 public function setup($verbose)
 {
     if ($verbose) {
         print "Creating tables for Materialization...\n";
     }
     DBHelper::setupTable($this->smw_ws_materialization_hashes, array('page_id' => 'INT(8) UNSIGNED NOT NULL', 'call_hash' => 'VARCHAR(33) NOT NULL', 'materialization_hash' => 'VARCHAR(33) NOT NULL'), $this->db, $verbose);
     if ($verbose) {
         print "..done\n";
     }
 }
 /**
  * Initializes the logging component
  */
 protected function setupLogging($verbose)
 {
     DBHelper::reportProgress("   ... Creating logging database \n", $verbose);
     global $wgDBname;
     $db =& wfGetDB(DB_MASTER);
     // create gardening table
     $smw_logging = $db->tableName('smw_logging');
     $fname = 'SMW::setupLogging';
     // create relation table
     DBHelper::setupTable($smw_logging, array('id' => 'INT(10) UNSIGNED NOT NULL auto_increment PRIMARY KEY', 'timestamp' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP', 'user' => 'VARCHAR(255)', 'location' => 'VARCHAR(255)', 'type' => 'VARCHAR(255)', 'function' => 'VARCHAR(255)', 'remotetimestamp' => 'VARCHAR(255)', 'text' => 'LONGTEXT'), $db, $verbose);
     DBHelper::reportProgress("   ... done!\n", $verbose);
 }
 /**
  * Initializes the database tables of the web service extensions. These are:
  * - Wiki Web Service Definition: smw_ws_wwsd
  * - Cache for values: smw_ws_cache
  * - actual parameters: smw_ws_parameters
  * - articles with web services: smw_ws_articles
  *
  */
 public function initDatabaseTables()
 {
     $db =& wfGetDB(DB_MASTER);
     $verbose = true;
     DBHelper::reportProgress("Setting up web services ...\n", $verbose);
     DBHelper::reportProgress("   ... Creating WWSD table \n", $verbose);
     $wwsdTable = $db->tableName('smw_ws_wwsd');
     DBHelper::setupTable($wwsdTable, array('web_service_id' => 'INT(8) UNSIGNED NOT NULL PRIMARY KEY', 'uri' => 'VARCHAR(1024) NOT NULL', 'protocol' => 'VARCHAR(20) NOT NULL', 'method' => 'VARCHAR(64) NOT NULL', 'parameters' => 'MEDIUMTEXT NOT NULL', 'result' => 'MEDIUMTEXT NOT NULL', 'display_policy' => 'INT(8) UNSIGNED NOT NULL', 'query_policy' => 'INT(8) UNSIGNED NOT NULL', 'update_delay' => 'INT(8) UNSIGNED NOT NULL', 'span_of_life' => 'INT(8) UNSIGNED NOT NULL', 'expires_after_update' => 'ENUM(\'true\', \'false\') DEFAULT \'false\' NOT NULL', 'confirmed' => 'ENUM(\'true\', \'false\', \'once\') DEFAULT \'false\' NOT NULL', 'authentication_type' => 'VARCHAR(10) NOT NULL', 'authentication_login' => 'VARCHAR(50) NOT NULL', 'authentication_password' => 'VARCHAR(50) NOT NULL'), $db, $verbose);
     $query = "ALTER TABLE " . $wwsdTable . " ENGINE=MyISAM; ";
     $db->query($query);
     $query = "ALTER TABLE " . $wwsdTable . " MODIFY COLUMN protocol VARCHAR(20) NOT NULL; ";
     $db->query($query);
     $query = "ALTER TABLE " . $wwsdTable . " MODIFY COLUMN authentication_login VARCHAR(50) NOT NULL; ";
     $db->query($query);
     $query = "ALTER TABLE " . $wwsdTable . " MODIFY COLUMN authentication_password VARCHAR(60) NOT NULL; ";
     $db->query($query);
     DBHelper::reportProgress("   ... done!\n", $verbose);
     // create ws value cache table
     DBHelper::reportProgress("   ... Creating web service cache table \n", $verbose);
     $cacheTable = $db->tableName('smw_ws_cache');
     DBHelper::setupTable($cacheTable, array('web_service_id' => 'INT(8) UNSIGNED NOT NULL', 'param_set_id' => 'INT(8) UNSIGNED NOT NULL', 'result' => 'LONGTEXT NOT NULL', 'last_update' => 'VARCHAR(14) NOT NULL', 'last_access' => 'VARCHAR(14) NOT NULL'), $db, $verbose, 'web_service_id,param_set_id');
     $query = "ALTER TABLE " . $cacheTable . " ENGINE=MyISAM; ";
     $db->query($query);
     $query = "ALTER TABLE " . $cacheTable . " MODIFY result LONGTEXT NOT NULL";
     $db->query($query);
     $query = "ALTER TABLE " . $cacheTable . " MODIFY param_set_id VARCHAR(32) NOT NULL";
     $db->query($query);
     DBHelper::reportProgress("   ... done!\n", $verbose);
     // create parameter table
     DBHelper::reportProgress("   ... Creating parameter table \n", $verbose);
     $paramTable = $db->tableName('smw_ws_parameters');
     DBHelper::setupTable($paramTable, array('name' => 'VARCHAR(255) NOT NULL', 'param_set_id' => 'INT(8) UNSIGNED NOT NULL', 'value' => 'LONGTEXT NOT NULL'), $db, $verbose);
     $query = "ALTER TABLE " . $paramTable . " MODIFY value LONGTEXT NOT NULL";
     $db->query($query);
     $query = "ALTER TABLE " . $paramTable . " ENGINE=MyISAM; ";
     $db->query($query);
     $query = "ALTER TABLE " . $paramTable . " MODIFY param_set_id VARCHAR(32) NOT NULL";
     $db->query($query);
     DBHelper::reportProgress("   ... done!\n", $verbose);
     // create articles table
     DBHelper::reportProgress("   ... Creating article table \n", $verbose);
     $articlesTable = $db->tableName('smw_ws_articles');
     DBHelper::setupTable($articlesTable, array('web_service_id' => 'INT(8) UNSIGNED NOT NULL', 'param_set_id' => 'INT(8) UNSIGNED NOT NULL', 'page_id' => 'INT(8) UNSIGNED NOT NULL'), $db, $verbose, 'web_service_id,param_set_id,page_id');
     $query = "ALTER TABLE " . $articlesTable . " ENGINE=MyISAM; ";
     $db->query($query);
     $query = "ALTER TABLE " . $articlesTable . " MODIFY param_set_id VARCHAR(32) NOT NULL";
     $db->query($query);
     DBHelper::reportProgress("   ... done!\n", $verbose);
 }