示例#1
0
 public function install()
 {
     global $tablelist, $tables, $indexes, $records, $table_ids;
     if (!$this->pre_install()) {
         return false;
     }
     foreach ($tables as $table => $columns) {
         if (isset($tablelist[$table])) {
             $db->sql_query('DROP TABLE ' . $tablelist[$table]);
         }
         db_check::create_table($table, $columns, $indexes[$table]);
     }
     if (is_array($records) && !empty($records)) {
         foreach ($records as $table => $content) {
             db_check::table_data($table, $content);
         }
     }
     if (!empty($this->config)) {
         global $installer;
         $mod = strtolower(get_class($this));
         foreach ($this->config as $key => $var) {
             $installer->add_query('INSERT', 'config_custom', '"' . $mod . '", "' . $key . '", "' . $var . '"');
         }
     }
     return $this->post_install();
 }
示例#2
0
 function install()
 {
     global $tablelist, $tables, $indexes, $records, $db;
     foreach ($tables as $table => $columns) {
         if (isset($tablelist[$table])) {
             $db->query('DROP TABLE ' . $tablelist[$table]);
         }
         db_check::create_table($table, $columns, $indexes[$table]);
     }
     if (is_array($records) && !empty($records)) {
         foreach ($records as $table => $content) {
             db_check::table_data($table, $content);
         }
     }
     return true;
 }