Setup can now handle add-on apps using the database tables created via arrays

This commit is contained in:
jengo 2001-02-10 23:08:52 +00:00
parent b4fa70ccd7
commit dc912cab81
7 changed files with 784 additions and 84 deletions

View File

@ -0,0 +1,270 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_baseline = array(
"config" => array(
"fd" => array(
"config_name" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"config_value" => array("type" => "varchar", "precision" => 100)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array("config_name")
),
"applications" => array(
"fd" => array(
"app_name" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"app_title" => array("type" => "varchar", "precision" => 50),
"app_enabled" => array("type" => "int", "precision" => 4),
"app_order" => array("type" => "int", "precision" => 4),
"app_tables" => array("type" => "varchar", "precision" => 255),
"app_version" => array("type" => "varchar", "precision" => 20, "nullable" => false, "default" => "0.0")
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array("app_name")
),
"accounts" => array(
"fd" => array(
"account_id" => array("type" => "auto", "nullable" => false),
"account_lid" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"account_pwd" => array("type" => "varchar", "precision" => 32, "nullable" => false),
"account_firstname" => array("type" => "varchar", "precision" => 50),
"account_lastname" => array("type" => "varchar", "precision" => 50),
"account_permissions" => array("type" => "text"),
"account_groups" => array("type" => "varchar", "precision" => 30),
"account_lastlogin" => array("type" => "int", "precision" => 4),
"account_lastloginfrom" => array("type" => "varchar", "precision" => 255),
"account_lastpwd_change" => array("type" => "int", "precision" => 4),
"account_status" => array("type" => "char", "precision" => 1, "nullable" => false, "default" => "A")
),
"pk" => array("account_id"),
"fk" => array(),
"ix" => array(),
"uc" => array("account_lid")
),
"groups" => array(
"fd" => array(
"group_id" => array("type" => "auto", "nullable" => false),
"group_name" => array("type" => "varchar", "precision" => 255),
"group_apps" => array("type" => "varchar", "precision" => 255)
),
"pk" => array("group_id"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"preferences" => array(
"fd" => array(
"preference_owner" => array("type" => "varchar", "precision" => 20, "nullable" => false),
"preference_name" => array("type" => "varchar", "precision" => 50, "nullable" => false),
"preference_value" => array("type" => "varchar", "precision" => 50),
"preference_appname" => array("type" => "varchar", "precision" => 50)
),
"pk" => array("preference_owner", "preference_name"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"sessions" => array(
"fd" => array(
"session_id" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"session_lid" => array("type" => "varchar", "precision" => 20),
"session_pwd" => array("type" => "varchar", "precision" => 255),
"session_ip" => array("type" => "varchar", "precision" => 255),
"session_logintime" => array("type" => "varchar", "precision" => 4),
"session_dla" => array("type" => "varchar", "precision" => 4)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array("session_id")
),
"app_sessions" => array(
"fd" => array(
"sessionid" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"loginid" => array("type" => "varchar", "precision" => 20),
"app" => array("type" => "varchar", "precision" => 20),
"content" => array("type" => "text")
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"access_log" => array(
"fd" => array(
"sessionid" => array("type" => "varchar", "precision" => 30),
"loginid" => array("type" => "varchar", "precision" => 30),
"ip" => array("type" => "varchar", "precision" => 30),
"li" => array("type" => "int", "precision" => 4),
"lo" => array("type" => "int", "precision" => 4)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"profiles" => array(
"fd" => array(
"con" => array("type" => "auto", "nullable" => false),
"owner" => array("type" => "varchar", "precision" => 20),
"title" => array("type" => "varchar", "precision" => 255),
"phone_number" => array("type" => "varchar", "precision" => 255),
"comments" => array("type" => "text"),
"picture_format" => array("type" => "varchar", "precision" => 255),
"picture" => array("type" => "blob")
),
"pk" => array("con"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"addressbook" => array(
"fd" => array(
"ab_id" => array("type" => "auto", "nullable" => false),
"ab_owner" => array("type" => "varchar", "precision" => 25),
"ab_access" => array("type" => "varchar", "precision" => 10),
"ab_firstname" => array("type" => "varchar", "precision" => 255),
"ab_lastname" => array("type" => "varchar", "precision" => 255),
"ab_email" => array("type" => "varchar", "precision" => 255),
"ab_hphone" => array("type" => "varchar", "precision" => 255),
"ab_wphone" => array("type" => "varchar", "precision" => 255),
"ab_fax" => array("type" => "varchar", "precision" => 255),
"ab_pager" => array("type" => "varchar", "precision" => 255),
"ab_mphone" => array("type" => "varchar", "precision" => 255),
"ab_ophone" => array("type" => "varchar", "precision" => 255),
"ab_street" => array("type" => "varchar", "precision" => 255),
"ab_city" => array("type" => "varchar", "precision" => 255),
"ab_state" => array("type" => "varchar", "precision" => 255),
"ab_zip" => array("type" => "varchar", "precision" => 255),
"ab_bday" => array("type" => "varchar", "precision" => 255),
"ab_notes" => array("type" => "text"),
"ab_company" => array("type" => "varchar", "precision" => 255),
),
"pk" => array("ab_id"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"todo" => array(
"fd" => array(
"todo_id" => array("type" => "auto", "nullable" => false),
"todo_owner" => array("type" => "varchar", "precision" => 25),
"todo_access" => array("type" => "varchar", "precision" => 10),
"todo_des" => array("type" => "text"),
"todo_pri" => array("type" => "int", "precision" => 4),
"todo_status" => array("type" => "int", "precision" => 4),
"todo_datecreated" => array("type" => "int", "precision" => 4),
"todo_datedue" => array("type" => "int", "precision" => 4)
),
"pk" => array("todo_id"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"webcal_entry" => array(
"fd" => array(
"cal_id" => array("type" => "auto", "nullable" => false),
"cal_group_id" => array("type" => "int", "precision" => 4),
"cal_create_by" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"cal_date" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_time" => array("type" => "int", "precision" => 4),
"cal_mod_date" => array("type" => "int", "precision" => 4),
"cal_mod_time" => array("type" => "int", "precision" => 4),
"cal_duration" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_priority" => array("type" => "int", "precision" => 4, "default" => "2"),
"cal_type" => array("type" => "varchar", "precision" => 10),
"cal_access" => array("type" => "char", "precision" => 10),
"cal_name" => array("type" => "varchar", "precision" => 80, "nullable" => false),
"cal_description" => array("type" => "text"),
),
"pk" => array("cal_id"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"webcal_entry_repeats" => array(
"fd" => array(
"cal_id" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_type" => array("type" => "varchar", "precision" => 20, "nullable" => false, "default" => "daily"),
"cal_end" => array("type" => "int", "precision" => 4),
"cal_frequency" => array("type" => "int", "precision" => 4, "default" => "1"),
"cal_days" => array("type" => "char", "precision" => 7)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"webcal_entry_user" => array(
"fd" => array(
"cal_id" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_login" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"cal_status" => array("type" => "char", "precision" => 1, "default" => "A")
),
"pk" => array("cal_id", "cal_login"),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"webcal_entry_groups" => array(
"fd" => array(
"cal_id" => array("type" => "int", "precision" => 4),
"groups" => array("type" => "varchar", "precision" => 255)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"newsgroups" => array(
"fd" => array(
"con" => array("type" => "auto", "nullable" => false),
"name" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"messagecount" => array("type" => "int", "precision" => 4, "nullable" => false),
"lastmessage" => array("type" => "int", "precision" => 4, "nullable" => false),
"active" => array("type" => "char", "precision" => 1, "nullable" => false, "default" => "N"),
"lastread" => array("type" => "int", "precision" => 4)
),
"pk" => array("con"),
"fk" => array(),
"ix" => array(),
"uc" => array("name")
),
"users_newsgroups" => array(
"fd" => array(
"owner" => array("type" => "int", "precision" => 4, "nullable" => false),
"newsgroup" => array("type" => "int", "precision" => 4, "nullable" => false)
),
"pk" => array(),
"fk" => array(),
"ix" => array(),
"uc" => array()
),
"lang" => array(
"fd" => array(
"message_id" => array("type" => "varchar", "precision" => 150, "nullable" => false, "default" => ""),
"app_name" => array("type" => "varchar", "precision" => 100, "nullable" => false, "default" => "common"),
"lang" => array("type" => "varchar", "precision" => 5, "nullable" => false, "default" => ""),
"content" => array("type" => "text")
),
"pk" => array("message_id", "app_name", "lang"),
"fk" => array(),
"ix" => array(),
"uc" => array()
)
);
?>

View File

@ -0,0 +1,371 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_tables = array(
"config" => array(
"fd" => array(
"config_name" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"config_value" => array("type" => "varchar", "precision" => 100)
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"applications" => array(
"fd" => array(
"app_name" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"app_title" => array("type" => "varchar", "precision" => 50),
"app_enabled" => array("type" => "int", "precision" => 4),
"app_order" => array("type" => "int", "precision" => 4),
"app_tables" => array("type" => "varchar", "precision" => 255),
"app_version" => array("type" => "varchar", "precision" => 20, "nullable" => false, "default" => "0.0")
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array("app_name")
),
"accounts" => array(
"fd" => array(
"account_id" => array("type" => "auto", "nullable" => false),
"account_lid" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"account_pwd" => array("type" => "varchar", "precision" => 32, "nullable" => false),
"account_firstname" => array("type" => "varchar", "precision" => 50),
"account_lastname" => array("type" => "varchar", "precision" => 50),
"account_permissions" => array("type" => "text"),
"account_groups" => array("type" => "varchar", "precision" => 30),
"account_lastlogin" => array("type" => "int", "precision" => 4),
"account_lastloginfrom" => array("type" => "varchar", "precision" => 255),
"account_lastpwd_change" => array("type" => "int", "precision" => 4),
"account_status" => array("type" => "char", "precision" => 1, "nullable" => false, "default" => "A")
),
"pk" => array("account_id"),
"ix" => array(),
"fk" => array(),
"uc" => array("account_lid")
),
"groups" => array(
"fd" => array(
"group_id" => array("type" => "auto", "nullable" => false),
"group_name" => array("type" => "varchar", "precision" => 255),
"group_apps" => array("type" => "varchar", "precision" => 255)
),
"pk" => array("group_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"preferences" => array(
"fd" => array(
"preference_owner" => array("type" => "int", "precision" => 4, "nullable" => false),
"preference_value" => array("type" => "text")
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"phpgw_sessions" => array(
"fd" => array(
"session_id" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"session_lid" => array("type" => "varchar", "precision" => 255),
"session_ip" => array("type" => "varchar", "precision" => 255),
"session_logintime" => array("type" => "int", "precision" => 4),
"session_dla" => array("type" => "int", "precision" => 4),
"session_info" => array("type" => "text")
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array("session_id")
),
"phpgw_acl" => array(
"fd" => array(
"acl_appname" => array("type" => "varchar", "precision" => 50),
"acl_location" => array("type" => "varchar", "precision" => 255),
"acl_account" => array("type" => "int", "precision" => 4),
"acl_account_type" => array("type" => "char", "precision" => 1),
"acl_rights" => array("type" => "int", "precision" => 4)
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"phpgw_app_sessions" => array(
"fd" => array(
"sessionid" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"loginid" => array("type" => "varchar", "precision" => 20),
"app" => array("type" => "varchar", "precision" => 20),
"content" => array("type" => "text")
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"phpgw_access_log" => array(
"fd" => array(
"sessionid" => array("type" => "varchar", "precision" => 255),
"loginid" => array("type" => "varchar", "precision" => 30),
"ip" => array("type" => "varchar", "precision" => 30),
"li" => array("type" => "int", "precision" => 4),
"lo" => array("type" => "varchar", "precision" => 255)
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"profiles" => array(
"fd" => array(
"con" => array("type" => "auto", "nullable" => false),
"owner" => array("type" => "varchar", "precision" => 20),
"title" => array("type" => "varchar", "precision" => 255),
"phone_number" => array("type" => "varchar", "precision" => 255),
"comments" => array("type" => "text"),
"picture_format" => array("type" => "varchar", "precision" => 255),
"picture" => array("type" => "blob")
),
"pk" => array("con"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"addressbook" => array(
"fd" => array(
"ab_id" => array("type" => "auto", "nullable" => false),
"ab_owner" => array("type" => "varchar", "precision" => 25),
"ab_access" => array("type" => "varchar", "precision" => 10),
"ab_firstname" => array("type" => "varchar", "precision" => 255),
"ab_lastname" => array("type" => "varchar", "precision" => 255),
"ab_email" => array("type" => "varchar", "precision" => 255),
"ab_hphone" => array("type" => "varchar", "precision" => 255),
"ab_wphone" => array("type" => "varchar", "precision" => 255),
"ab_fax" => array("type" => "varchar", "precision" => 255),
"ab_pager" => array("type" => "varchar", "precision" => 255),
"ab_mphone" => array("type" => "varchar", "precision" => 255),
"ab_ophone" => array("type" => "varchar", "precision" => 255),
"ab_street" => array("type" => "varchar", "precision" => 255),
"ab_city" => array("type" => "varchar", "precision" => 255),
"ab_state" => array("type" => "varchar", "precision" => 255),
"ab_zip" => array("type" => "varchar", "precision" => 255),
"ab_bday" => array("type" => "varchar", "precision" => 255),
"ab_notes" => array("type" => "text"),
"ab_company" => array("type" => "varchar", "precision" => 255),
"ab_company_id" => array("type" => "int", "precision" => 4),
"ab_title" => array("type" => "varchar", "precision" => 60),
"ab_address2" => array("type" => "varchar", "precision" => 60),
"ab_url" => array("type" => "varchar", "precision" => 255)
),
"pk" => array("ab_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"customers" => array(
"fd" => array(
"company_id" => array("type" => "auto", "nullable" => false),
"company_name" => array("type" => "varchar", "precision" => 255),
"website" => array("type" => "varchar", "precision" => 80),
"ftpsite" => array("type" => "varchar", "precision" => 80),
"industry_type" => array("type" => "varchar", "precision" => 50),
"status" => array("type" => "varchar", "precision" => 30),
"software" => array("type" => "varchar", "precision" => 40),
"lastjobnum" => array("type" => "int", "precision" => 4),
"lastjobfinished" => array("type" => "date"),
"busrelationship" => array("type" => "varchar", "precision" => 30),
"notes" => array("type" => "text")
),
"pk" => array("company_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"todo" => array(
"fd" => array(
"todo_id" => array("type" => "auto", "nullable" => false),
"todo_id_parent" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"todo_owner" => array("type" => "varchar", "precision" => 25),
"todo_access" => array("type" => "varchar", "precision" => 10),
"todo_des" => array("type" => "text"),
"todo_pri" => array("type" => "int", "precision" => 4),
"todo_status" => array("type" => "int", "precision" => 4),
"todo_datecreated" => array("type" => "int", "precision" => 4),
"todo_startdate" => array("type" => "int", "precision" => 4),
"todo_enddate" => array("type" => "int", "precision" => 4)
),
"pk" => array("todo_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"calendar_entry" => array(
"fd" => array(
"cal_id" => array("type" => "auto", "nullable" => false),
"cal_owner" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_group" => array("type" => "varchar", "precision" => 255),
"cal_datetime" => array("type" => "int", "precision" => 4),
"cal_mdatetime" => array("type" => "int", "precision" => 4),
"cal_edatetime" => array("type" => "int", "precision" => 4),
"cal_priority" => array("type" => "int", "precision" => 4, "default" => "2", "nullable" => false),
"cal_type" => array("type" => "varchar", "precision" => 10),
"cal_access" => array("type" => "varchar", "precision" => 10),
"cal_name" => array("type" => "varchar", "precision" => 80, "nullable" => false),
"cal_description" => array("type" => "text")
),
"pk" => array("cal_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"calendar_entry_repeats" => array(
"fd" => array(
"cal_id" => array("type" => "int", "precision" => 4, "default" => "0", "nullable" => false),
"cal_type" => array("type" => "varchar", "precision" => 20, "default" => "daily", "nullable" => false),
"cal_use_end" => array("type" => "int", "precision" => 4, "default" => "0"),
"cal_frequency" => array("type" => "int", "precision" => 4, "default" => "1"),
"cal_days" => array("type" => "char", "precision" => 7)
),
"pk" => array(),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"calendar_entry_user" => array(
"fd" => array(
"cal_id" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_login" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"cal_status" => array("type" => "char", "precision" => 1, "default" => "A")
),
"pk" => array("cal_id", "cal_login"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"newsgroups" => array(
"fd" => array(
"con" => array("type" => "auto", "nullable" => false),
"name" => array("type" => "varchar", "precision" => 255, "nullable" => false),
"messagecount" => array("type" => "int", "precision" => 4, "nullable" => false),
"lastmessage" => array("type" => "int", "precision" => 4, "nullable" => false),
"active" => array("type" => "char", "precision" => 1, "nullable" => false, "default" => "N"),
"lastread" => array("type" => "int", "precision" => 4)
),
"pk" => array("con"),
"ix" => array(),
"fk" => array(),
"uc" => array("name")
),
"news_msg" => array(
"fd" => array(
"con" => array("type" => "int", "precision" => 4, "nullable" => false),
"msg" => array("type" => "int", "precision" => 4, "nullable" => false),
"uid" => array("type" => "varchar", "precision" => 255, "default" => ""),
"udate" => array("type" => "int", "precision" => 4, "default" => "0"),
"path" => array("type" => "varchar", "precision" => 255, "default" => ""),
"fromadd" => array("type" => "varchar", "precision" => 255, "default" => ""),
"toadd" => array("type" => "varchar", "precision" => 255, "default" => ""),
"ccadd" => array("type" => "varchar", "precision" => 255, "default" => ""),
"bccadd" => array("type" => "varchar", "precision" => 255, "default" => ""),
"reply_to" => array("type" => "varchar", "precision" => 255, "default" => ""),
"sender" => array("type" => "varchar", "precision" => 255, "default" => ""),
"return_path" => array("type" => "varchar", "precision" => 255, "default" => ""),
"subject" => array("type" => "varchar", "precision" => 255, "default" => ""),
"message_id" => array("type" => "varchar", "precision" => 255, "default" => ""),
"reference" => array("type" => "varchar", "precision" => 255, "default" => ""),
"in_reply_to" => array("type" => "varchar", "precision" => 255, "default" => ""),
"follow_up_to" => array("type" => "varchar", "precision" => 255, "default" => ""),
"nntp_posting_host" => array("type" => "varchar", "precision" => 255, "default" => ""),
"nntp_posting_date" => array("type" => "varchar", "precision" => 255, "default" => ""),
"x_complaints_to" => array("type" => "varchar", "precision" => 255, "default" => ""),
"x_trace" => array("type" => "varchar", "precision" => 255, "default" => ""),
"x_abuse_info" => array("type" => "varchar", "precision" => 255, "default" => ""),
"x_mailer" => array("type" => "varchar", "precision" => 255, "default" => ""),
"organization" => array("type" => "varchar", "precision" => 255, "default" => ""),
"content_type" => array("type" => "varchar", "precision" => 255, "default" => ""),
"content_description" => array("type" => "varchar", "precision" => 255, "default" => ""),
"content_transfer_encoding" => array("type" => "varchar", "precision" => 255, "default" => ""),
"mime_version" => array("type" => "varchar", "precision" => 255, "default" => ""),
"msgsize" => array("type" => "int", "precision" => 4, "default" => "0"),
"msglines" => array("type" => "int", "precision" => 4, "default" => "0"),
"body" => array("type" => "text") // TODO: MySQL is longtext - any discrepancies?
),
"pk" => array("con", "msg"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"lang" => array(
"fd" => array(
"message_id" => array("type" => "varchar", "precision" => 150, "nullable" => false, "default" => ""),
"app_name" => array("type" => "varchar", "precision" => 100, "nullable" => false, "default" => "common"),
"lang" => array("type" => "varchar", "precision" => 5, "nullable" => false, "default" => ""),
"content" => array("type" => "text", "nullable" => false)
),
"pk" => array("message_id", "app_name", "lang"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"categories" => array(
"fd" => array(
"cat_id" => array("type" => "auto", "nullable" => false),
"account_id" => array("type" => "int", "precision" => 4, "nullable" => false, "default" => "0"),
"app_name" => array("type" => "varchar", "precision" => 25, "nullable" => false),
"cat_name" => array("type" => "varchar", "precision" => 150, "nullable" => false),
"cat_description" => array("type" => "text", "nullable" => false)
),
"pk" => array("cat_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"languages" => array(
"fd" => array(
"lang_id" => array("type" => "varchar", "precision" => 2, "nullable" => false),
"lang_name" => array("type" => "varchar", "precision" => 50, "nullable" => false),
"available" => array("type" => "char", "precision" => 3, "nullable" => false, "default" => "No")
),
"pk" => array("lang_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"notes" => array(
"fd" => array(
"note_id" => array("type" => "auto", "nullable" => false),
"note_owner" => array("type" => "int", "precision" => 4),
"note_date" => array("type" => "int", "precision" => 4),
"note_content" => array("type" => "text")
),
"pk" => array("note_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
),
"phpgw_hooks" => array(
"fd" => array(
"hook_id" => array("type" => "auto", "nullable" => false),
"hook_appname" => array("type" => "varchar", "precision" => 255),
"hook_location" => array("type" => "varchar", "precision" => 255),
"hook_filename" => array("type" => "varchar", "precision" => 255)
),
"pk" => array("hook_id"),
"ix" => array(),
"fk" => array(),
"uc" => array()
)
);
?>

View File

@ -14,17 +14,20 @@
class phpgw_schema_proc
{
var $m_oTranslator;
var $m_oDeltaProc;
var $m_odb;
var $m_aTables;
var $m_oDeltaOnly;
function phpgw_schema_proc($dbms)
{
include("./inc/phpgw_schema_proc_" . $dbms . ".inc.php");
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_proc_" . $dbms . ".inc.php");
eval("\$this->m_oTranslator = new phpgw_schema_proc_$dbms;");
global $phpgw_setup;
$this->m_odb = $phpgw_setup->db;
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_proc_array.inc.php");
$this->m_oDeltaProc = new phpgw_schema_proc_array;
$this->m_aTables = array();
$this->m_oDeltaOnly = True; // Either is an insane default!
}
function GenerateScripts($aTables, $bOutputHTML = false)
@ -66,18 +69,23 @@ class phpgw_schema_proc
if (!is_array($aTables) || !IsSet($this->m_odb))
return false;
reset($aTables);
$this->m_aTables = $aTables;
reset($this->m_aTables);
while (list($sTableName, $aTableDef) = each($this->m_aTables))
while (list($sTableName, $aTableDef) = each($aTables))
{
if ($this->CreateTable($sTableName, $aTableDef))
{
if ($bOutputHTML)
echo "<br>Create Table <b>$sTableSQL</b>";
echo "<br>Create Table <b>$sTableName</b>";
}
else
{
if ($bOutputHTML)
echo "<br>Create Table Failed For <b>$sTableName</b>";
return false;
}
}
return true;
@ -107,44 +115,71 @@ class phpgw_schema_proc
function DropTable($sTableName)
{
return $this->m_oTranslator->DropTable($this, $sTableName);
$retVal = $this->m_oDeltaProc->DropTable($this, $this->m_aTables, $sTableName);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->DropTable($this, $this->m_aTables, $sTableName);
}
function DropColumn($sTableName, $aTableDef, $sColumnName, $bCopyData = true)
{
return $this->m_oTranslator->DropColumn($this, $sTableName, $aTableDef, $sColumnName, $bCopyData);
$retVal = $this->m_oDeltaProc->DropColumn($this, $this->m_aTables, $sTableName, $aTableDef, $sColumnName, $bCopyData);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->DropColumn($this, $this->m_aTables, $sTableName, $aTableDef, $sColumnName, $bCopyData);
}
function RenameTable($sOldTableName, $sNewTableName)
{
return $this->m_oTranslator->RenameTable($this, $sOldTableName, $sNewTableName);
$retVal = $this->m_oDeltaProc->RenameTable($this, $this->m_aTables, $sOldTableName, $sNewTableName);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->RenameTable($this, $this->m_aTables, $sOldTableName, $sNewTableName);
}
function RenameColumn($sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
return $this->m_oTranslator->RenameColumn($this, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData);
$retVal = $this->m_oDeltaProc->RenameColumn($this, $this->m_aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->RenameColumn($this, $this->m_aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData);
}
function AlterColumn($sTableName, $sColumnName, $aColumnDef, $bCopyData = true)
{
return $this->m_oTranslator->AlterColumn($this, $sTableName, $sColumnName, $aColumnDef, $bCopyData);
$retVal = $this->m_oDeltaProc->AlterColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef, $bCopyData);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->AlterColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef, $bCopyData);
}
function AddColumn($sTableName, $sColumnName, $aColumnDef)
{
return $this->m_oTranslator->AddColumn($this, $sTableName, $sColumnName, $aColumnDef);
$retVal = $this->m_oDeltaProc->AddColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->AddColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef);
}
function CreateTable($sTableName, $aTableDef)
{
return $this->m_oTranslator->CreateTable($this, $sTableName, $aTableDef);
$retVal = $this->m_oDeltaProc->CreateTable($this, $this->m_aTables, $sTableName, $aTableDef);
if ($this->m_oDeltaOnly)
return $retVal;
return $retVal && $this->m_oTranslator->CreateTable($this, $this->m_aTables, $sTableName, $aTableDef);
}
function _GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL)
function query($sQuery, $line = "", $file = "")
{
return $this->m_odb->query($sQuery, $line, $file);
}
function _GetTableSQL($sTableName, $aTableDef, &$sTableSQL, &$sSequenceSQL)
{
echo "is_array";
if (!is_array($aTableDef))
return false;
echo "it is";
$sTableSQL = "";
reset($aTableDef["fd"]);
while (list($sFieldName, $aFieldAttr) = each($aTableDef["fd"]))
@ -167,7 +202,10 @@ class phpgw_schema_proc
}
}
else
{
echo "GetFieldSQL failed for $sFieldName";
return false;
}
}
$sUCSQL = "";
@ -203,7 +241,7 @@ class phpgw_schema_proc
}
// Get field DDL
function _GetFieldSQL($aField, $sFieldSQL)
function _GetFieldSQL($aField, &$sFieldSQL)
{
if (!is_array($aField))
return false;
@ -258,7 +296,7 @@ class phpgw_schema_proc
return false;
}
function _GetPK($aFields, $sPKSQL)
function _GetPK($aFields, &$sPKSQL)
{
$sPKSQL = "";
if (count($aFields) < 1)
@ -278,7 +316,7 @@ class phpgw_schema_proc
return true;
}
function _GetUC($aFields, $sUCSQL)
function _GetUC($aFields, &$sUCSQL)
{
$sUCSQL = "";
if (count($aFields) < 1)

View File

@ -21,7 +21,7 @@ class phpgw_schema_proc_array
}
// Return a type suitable for DDL abstracted array
function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated)
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = $sType;
return (strlen($sTranslated) > 0);
@ -42,10 +42,10 @@ class phpgw_schema_proc_array
return "";
}
function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "")
function _GetColumns($oProc, &$aTables, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
while (list($sName, $aJunk) = each($oProc->m_aTables[$sTableName]["fd"]))
while (list($sName, $aJunk) = each($aTables[$sTableName]["fd"]))
{
if ($sColumns != "")
$sColumns .= ",";
@ -55,29 +55,29 @@ class phpgw_schema_proc_array
return true;
}
function DropTable($oProc, $sTableName)
function DropTable($oProc, &$aTables, $sTableName)
{
if (IsSet($oProc->m_aTables[$sTableName]))
UnSet($oProc->m_aTables[$sTableName]);
if (IsSet($aTables[$sTableName]))
UnSet($aTables[$sTableName]);
return true;
}
function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
if (IsSet($oProc->m_aTables[$sTableName]))
if (IsSet($aTables[$sTableName]))
{
if (IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
UnSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]);
if (IsSet($aTables[$sTableName]["fd"][$sColumnName]))
UnSet($aTables[$sTableName]["fd"][$sColumnName]);
}
return true;
}
function RenameTable($oProc, $sOldTableName, $sNewTableName)
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
$aNewTables = array();
while (list($sTableName, $aTableDef) = each($oProc->m_aTables))
while (list($sTableName, $aTableDef) = each($aTables))
{
if ($sTableName == $sOldTableName)
$aNewTables[$sNewTableName] = $aTableDef;
@ -85,18 +85,18 @@ class phpgw_schema_proc_array
$aNewTables[$sTableName] = $aTableDef;
}
$oProc->m_aTables = $aNewTables;
$aTables = $aNewTables;
return true;
}
function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
if (IsSet($oProc->m_aTables[$sTableName]))
if (IsSet($aTables[$sTableName]))
{
$aNewTableDef = array();
reset($oProc->m_aTables[$sTableName]["fd"]);
while (list($sColumnName, $aColumnDef) = each($oProc->m_aTables[$sTableName]["fd"]))
reset($aTables[$sTableName]["fd"]);
while (list($sColumnName, $aColumnDef) = each($aTables[$sTableName]["fd"]))
{
if ($sColumnName == $sOldColumnName)
$aNewTableDef[$sNewColumnName] = $aColumnDef;
@ -104,52 +104,52 @@ class phpgw_schema_proc_array
$aNewTableDef[$sColumnName] = $aColumnDef;
}
$oProc->m_aTables[$sTableName]["fd"] = $aNewTableDef;
$aTables[$sTableName]["fd"] = $aNewTableDef;
reset($oProc->m_aTables[$sTableName]["pk"]);
while (list($key, $sColumnName) = each($oProc->m_aTables[$sTableName]["pk"]))
reset($aTables[$sTableName]["pk"]);
while (list($key, $sColumnName) = each($aTables[$sTableName]["pk"]))
{
if ($sColumnName == $sOldColumnName)
$oProc->m_aTables[$sTableName]["pk"][$key] = $sNewColumnName;
$aTables[$sTableName]["pk"][$key] = $sNewColumnName;
}
reset($oProc->m_aTables[$sTableName]["uc"]);
while (list($key, $sColumnName) = each($oProc->m_aTables[$sTableName]["uc"]))
reset($aTables[$sTableName]["uc"]);
while (list($key, $sColumnName) = each($aTables[$sTableName]["uc"]))
{
if ($sColumnName == $sOldColumnName)
$oProc->m_aTables[$sTableName]["uc"][$key] = $sNewColumnName;
$aTables[$sTableName]["uc"][$key] = $sNewColumnName;
}
}
return true;
}
function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true)
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
if (IsSet($oProc->m_aTables[$sTableName]))
if (IsSet($aTables[$sTableName]))
{
if (IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
$oProc->m_aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
if (IsSet($aTables[$sTableName]["fd"][$sColumnName]))
$aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
}
return true;
}
function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef)
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
if (IsSet($oProc->m_aTables[$sTableName]))
if (IsSet($aTables[$sTableName]))
{
if (!IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
$oProc->m_aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
if (!IsSet($aTables[$sTableName]["fd"][$sColumnName]))
$aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
}
return true;
}
function CreateTable($oProc, $sTableName, $aTableDef)
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
{
if (!IsSet($oProc->m_aTables[$sTableName]))
$oProc->m_aTables[$sTableName] = $aTableDef;
if (!IsSet($aTables[$sTableName]))
$aTables[$sTableName] = $aTableDef;
return true;
}

View File

@ -9,7 +9,7 @@ class phpgw_schema_proc_mysql
}
// Return a type suitable for DDL
function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated)
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = "";
switch($sType)
@ -101,7 +101,7 @@ class phpgw_schema_proc_mysql
}
function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "")
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
@ -116,40 +116,40 @@ class phpgw_schema_proc_mysql
return false;
}
function DropTable($oProc, $sTableName)
function DropTable($oProc, &$aTables, $sTableName)
{
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
}
function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName"));
}
function RenameTable($oProc, $sOldTableName, $sNewTableName)
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName"));
}
function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
// This really needs testing - it can affect primary keys, and other table-related objects
// like sequences and such
if ($oProc->_GetFieldSQL($oProc->m_aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
return !!($oProc->m_odb->query("ALTER TABLE $sTableName CHANGE $sOldColumnName $sNewColumnName " . $sNewColumnSQL));
return false;
}
function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true)
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
if ($oProc->_GetFieldSQL($oProc->m_aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
return !!($oProc->m_odb->query("ALTER TABLE $sTableName MODIFY $sColumnName " . $sNewColumnSQL));
return false;
}
function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef)
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
@ -157,13 +157,13 @@ class phpgw_schema_proc_mysql
return !!($oProc->m_odb->query($query));
}
function GetSequenceSQL($sTableName, $sFieldName, $sSequenceSQL)
function GetSequenceSQL($sTableName, $sFieldName, &$sSequenceSQL)
{
$sSequenceSQL = "";
return true;
}
function CreateTable($oProc, $sTableName, $aTableDef)
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
{
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{

View File

@ -21,7 +21,7 @@ class phpgw_schema_proc_pgsql
}
// Return a type suitable for DDL
function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated)
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
switch($sType)
{
@ -96,11 +96,11 @@ class phpgw_schema_proc_pgsql
return "UNIQUE($sFields)";
}
function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "")
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
$query = "SELECT a.attname FROM pg_attribute a,pg_class b WHERE ";
$query .= "a.oid=b.attrelid AND a.attnum>0 and b.relname='$sTableName'";
$query .= "b.oid=a.attrelid AND a.attnum>0 and b.relname='$sTableName'";
if ($sDropColumn != "")
$query .= " AND a.attname != '$sDropColumn'";
$query .= " ORDER BY a.attnum";
@ -116,12 +116,12 @@ class phpgw_schema_proc_pgsql
return false;
}
function DropTable($oProc, $sTableName)
function DropTable($oProc, &$aTables, $sTableName)
{
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
}
function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
if ($bCopyData)
$oProc->m_odb->query("ALTER TABLE $sTableName RENAME TO $sTableName" . "_tmp");
@ -136,15 +136,16 @@ class phpgw_schema_proc_pgsql
$oProc->m_odb->query($query);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns, $sColumnName);
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
return !!($oProc->m_odb->query($query));
$bRet = !!($oProc->m_odb->query($query));
return ($bRet && $this->DropTable($oProc, $sTableName . "_tmp"));
}
function RenameTable($oProc, $sOldTableName, $sNewTableName)
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName"));
}
function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
// This really needs testing - it can affect primary keys, and other table-related objects
// like sequences and such
@ -154,16 +155,17 @@ class phpgw_schema_proc_pgsql
$this->DropTable($oProc, $sTableName);
if (!$bCopyData)
return $this->CreateTable($oProc, $sTableName, $oProc->m_aTables[$sTableName]);
return $this->CreateTable($oProc, $aTables, $sTableName, $oProc->m_aTables[$sTableName], false);
$this->CreateTable($oProc, $sTableName, $oProc->m_aTables[$sTableName]);
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], false);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns);
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
return !!($oProc->m_odb->query($query));
$bRet = !!($oProc->m_odb->query($query));
return ($bRet && $this->DropTable($oProc, $sTableName . "_tmp"));
}
function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true)
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
if ($bCopyData)
$oProc->m_odb->query("ALTER TABLE $sTableName RENAME TO $sTableName" . "_tmp");
@ -171,16 +173,18 @@ class phpgw_schema_proc_pgsql
$this->DropTable($oProc, $sTableName);
if (!$bCopyData)
return $this->CreateTable($oProc, $sTableName, $oProc->m_aTables[$sTableName]);
return $this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], false);
$this->CreateTable($oProc, $sTableName, $oProc->m_aTables[$sTableName]);
echo $aTables[$sTableName];
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], false);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns);
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
return !!($oProc->m_odb->query($query));
$bRet = !!($oProc->m_odb->query($query));
return ($bRet && $this->DropTable($oProc, $sTableName . "_tmp"));
}
function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef)
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
@ -188,21 +192,22 @@ class phpgw_schema_proc_pgsql
return !!($oProc->m_odb->query($query));
}
function GetSequenceSQL($sTableName, $sFieldName, $sSequenceSQL)
function GetSequenceSQL($sTableName, $sFieldName, &$sSequenceSQL)
{
$sSequenceSQL = sprintf("CREATE SEQUENCE %s_%s_seq", $sTableName, $sFieldName);
return true;
}
function CreateTable($oProc, $sTableName, $aTableDef)
function CreateTable($oProc, $aTables, $sTableName, $aTableDef, $bCreateSequence = true)
{
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{
// create sequence first since it will be needed for default
if ($sSequenceSQL != "")
if ($bCreateSequence && $sSequenceSQL != "")
$oProc->m_odb->query($sSequenceSQL);
$query = "CREATE TABLE $sTableName ($sTableSQL)";
echo $query;
return !!($oProc->m_odb->query($query));
}

View File

@ -18,6 +18,10 @@
$dh = opendir(PHPGW_SERVER_ROOT);
while ($dir = readdir($dh)) {
if (! $reserved_directorys[$dir] && is_dir(PHPGW_SERVER_ROOT . SEP . $dir)) {
if (is_file(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'tables_new.inc.php')) {
$new_schema[] = $dir;
}
if (is_file(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php')) {
include(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php');
} else {
@ -32,4 +36,16 @@
. "',1," . $app[1]['app_order'] . ", '" . $app[1]['app_tables'] . "', '"
. $app[1]['version'] . "')");
}
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_current.inc.php");
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_proc.inc.php");
$o = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]);
$o->m_odb = $phpgw_setup->db;
while (list(,$app) = each($new_schema)) {
include(PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'tables_new.inc.php');
echo '<br><b>Creating tables for ' . $app . '</b>';
$o->ExecuteScripts($app_tables, True);
}
?>