From a2981812193ac0f071673b75191b2b99e6c70043 Mon Sep 17 00:00:00 2001 From: rylon Date: Thu, 16 Oct 2014 00:29:18 +0200 Subject: [PATCH] fixed merge problem, pg adjustments, pg schema --- dbd/sql/mysql/schema/system_todo.sql | 26 ++++++++++----- dbd/sql/pg/schema/system_cron.sql | 17 ++++++++++ dbd/sql/pg/schema/system_log.sql | 30 +++++++++++++++++ dbd/sql/pg/schema/system_sys_log.sql | 19 ----------- dbd/sql/pg/schema/system_todo.sql | 33 +++++++++++++------ .../saimod_sys_cron/qq/SYS_SAIMOD_CRON.php | 4 +-- sai/modules/saimod_sys_cron/tpl/tabs.tpl | 1 + .../saimod_sys_locale/saimod_sys_locale.php | 31 ++++++++++------- security/RIGHTS.php | 2 -- 9 files changed, 110 insertions(+), 53 deletions(-) create mode 100644 dbd/sql/pg/schema/system_cron.sql create mode 100644 dbd/sql/pg/schema/system_log.sql delete mode 100644 dbd/sql/pg/schema/system_sys_log.sql diff --git a/dbd/sql/mysql/schema/system_todo.sql b/dbd/sql/mysql/schema/system_todo.sql index 3f88815..8c0a1b9 100644 --- a/dbd/sql/mysql/schema/system_todo.sql +++ b/dbd/sql/mysql/schema/system_todo.sql @@ -1,14 +1,24 @@ CREATE TABLE `system_todo` ( `ID` INT(10) NOT NULL AUTO_INCREMENT, + `class` TEXT NOT NULL, + `message` TEXT NOT NULL, + `code` INT(10) UNSIGNED NOT NULL, + `file` TEXT NOT NULL, + `line` INT(11) NOT NULL, + `trace` TEXT NOT NULL, + `ip` TEXT NOT NULL, + `querytime` DOUBLE NOT NULL, `time` DATETIME NOT NULL, - `author` INT(11) NOT NULL, - `type` INT(11) NOT NULL, - `state` INT(11) NOT NULL, - `msg_1` TEXT NOT NULL, - `msg_2` TEXT NULL, - `msg_3` TEXT NULL, - `msg_4` TEXT NULL, - `msg_5` TEXT NULL, + `server_name` CHAR(255) NOT NULL, + `server_port` INT(10) UNSIGNED NOT NULL, + `request_uri` CHAR(255) NOT NULL, + `post` TEXT NOT NULL, + `http_referer` CHAR(255) NOT NULL, + `http_user_agent` TEXT NOT NULL, + `user` INT(10) UNSIGNED NOT NULL, + `thrown` BIT(1) NOT NULL, + `type` INT(11) NOT NULL DEFAULT '0', + `count` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`) ) COLLATE='utf8_general_ci' diff --git a/dbd/sql/pg/schema/system_cron.sql b/dbd/sql/pg/schema/system_cron.sql new file mode 100644 index 0000000..650af2a --- /dev/null +++ b/dbd/sql/pg/schema/system_cron.sql @@ -0,0 +1,17 @@ +CREATE TABLE system.cron +( + "class" character varying(255) NOT NULL, + "min" integer DEFAULT NULL, + "hour" integer DEFAULT NULL, + "day" integer DEFAULT NULL, + "day_week" integer DEFAULT NULL, + "month" integer DEFAULT NULL, + "last_run" timestamp with time zone DEFAULT NULL, + "status" integer NOT NULL DEFAULT 0, + PRIMARY KEY ("class") +) +WITH ( + OIDS=FALSE +); +ALTER TABLE system.log + OWNER TO dasense; \ No newline at end of file diff --git a/dbd/sql/pg/schema/system_log.sql b/dbd/sql/pg/schema/system_log.sql new file mode 100644 index 0000000..3693664 --- /dev/null +++ b/dbd/sql/pg/schema/system_log.sql @@ -0,0 +1,30 @@ +CREATE TABLE system.log +( + "ID" integer NOT NULL DEFAULT nextval('system."sys_log_ID_seq"'::regclass), + class text NOT NULL, + message text NOT NULL, + code integer NOT NULL, + file text NOT NULL, + line integer NOT NULL, + trace text NOT NULL, + ip text NOT NULL, + querytime double precision NOT NULL, + "time" timestamp with time zone NOT NULL DEFAULT now(), + server_name character varying(255), + server_port integer, + request_uri character varying(512), + post text, + http_referer character varying(255), + http_user_agent text, + "user" integer, + thrown integer, + CONSTRAINT system_log_pk_id PRIMARY KEY ("ID"), + CONSTRAINT system_log_fk_user FOREIGN KEY ("user") + REFERENCES system."user" (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITH ( + OIDS=FALSE +); +ALTER TABLE system.log + OWNER TO dasense; \ No newline at end of file diff --git a/dbd/sql/pg/schema/system_sys_log.sql b/dbd/sql/pg/schema/system_sys_log.sql deleted file mode 100644 index d76711b..0000000 --- a/dbd/sql/pg/schema/system_sys_log.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE system.sys_log -( - "ID" integer NOT NULL DEFAULT nextval('system."sys_log_ID_seq"'::regclass), - class text NOT NULL, - message text NOT NULL, - code integer NOT NULL, - file text NOT NULL, - line integer NOT NULL, - trace text NOT NULL, - ip text NOT NULL, - querytime double precision NOT NULL, - "time" timestamp with time zone NOT NULL DEFAULT now() -) -WITH ( - OIDS=FALSE -); -ALTER TABLE system.sys_log - OWNER TO username; - diff --git a/dbd/sql/pg/schema/system_todo.sql b/dbd/sql/pg/schema/system_todo.sql index b7f08cb..fc385af 100644 --- a/dbd/sql/pg/schema/system_todo.sql +++ b/dbd/sql/pg/schema/system_todo.sql @@ -1,19 +1,32 @@ CREATE TABLE system.todo ( "ID" integer NOT NULL, + "class" text NOT NULL, + "message" text NOT NULL, + "code" integer NOT NULL, + "file" text NOT NULL, + "line" integer NOT NULL, + "trace" text NOT NULL, + "ip" text NOT NULL, + "querytime" double precision NOT NULL, "time" timestamp with time zone NOT NULL, - author integer NOT NULL, - type integer NOT NULL, - state integer NOT NULL, - msg_1 text NOT NULL, - msg_2 text, - msg_3 text, - msg_4 text, - msg_5 text, - CONSTRAINT system_todo_pk_id PRIMARY KEY ("ID") + server_name character varying(255), + server_port integer, + request_uri character varying(512), + post text, + http_referer character varying(255), + http_user_agent text, + "user" integer, + thrown integer, + "type" integer NOT NULL DEFAULT 0, + "count" integer NOT NULL DEFAULT 0, + CONSTRAINT system_todo_pk_id PRIMARY KEY ("ID"), + CONSTRAINT system_todo_fk_user FOREIGN KEY ("user") + REFERENCES system."user" (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE system.todo - OWNER TO username; + OWNER TO dasense; \ No newline at end of file diff --git a/sai/modules/saimod_sys_cron/qq/SYS_SAIMOD_CRON.php b/sai/modules/saimod_sys_cron/qq/SYS_SAIMOD_CRON.php index 76943e1..5fa8721 100644 --- a/sai/modules/saimod_sys_cron/qq/SYS_SAIMOD_CRON.php +++ b/sai/modules/saimod_sys_cron/qq/SYS_SAIMOD_CRON.php @@ -5,7 +5,7 @@ class SYS_SAIMOD_CRON extends \SYSTEM\DB\QQ { protected static function query(){ return new \SYSTEM\DB\QQuery(get_class(), //pg -'', +'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_PG.' ORDER BY class;', //mys -'SELECT * FROM system_cron ORDER BY class;' +'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_MYS.' ORDER BY class;' );}} diff --git a/sai/modules/saimod_sys_cron/tpl/tabs.tpl b/sai/modules/saimod_sys_cron/tpl/tabs.tpl index 912ac79..0e2de9e 100644 --- a/sai/modules/saimod_sys_cron/tpl/tabs.tpl +++ b/sai/modules/saimod_sys_cron/tpl/tabs.tpl @@ -23,6 +23,7 @@ + diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php index 09162fc..86a0eee 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php @@ -4,8 +4,7 @@ namespace SYSTEM\SAI; class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { public static function getLanguages(){ - return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS); - } + return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);} public static function sai_mod__SYSTEM_SAI_saimod_sys_locale(){ $vars = array(); @@ -34,22 +33,30 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_load($lang, $group){ $con = new \SYSTEM\DB\Connection(); - $query = 'SELECT id, '.$lang.' FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE category='.$group.' ORDER BY category ASC;'; - $res = $con->query($query); - $entries = ''; - $temparr = array(); - while($r = $res->next()){ - $temparr['lang'] = $r[$lang]; - $temparr['id'] = $r['id']; - $entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/entry.tpl'), $temparr); - } + if(\SYSTEM\system::isSystemDbInfoPG()){ + $query = 'SELECT id, "'.$lang.'" FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE category='.$group.' ORDER BY category ASC;'; + } else { + $query = 'SELECT id, '.$lang.' FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE category='.$group.' ORDER BY category ASC;'; + } + $res = $con->query($query); + $entries = ''; + $temparr = array(); + while($r = $res->next()){ + $temparr['lang'] = $r[$lang]; + $temparr['id'] = $r['id']; + $entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/entry.tpl'), $temparr); + } return $entries; } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_singleload($id, $lang){ $con = new \SYSTEM\DB\Connection(); $result = ""; - $query = 'SELECT '.$lang.' FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;'; + if(\SYSTEM\system::isSystemDbInfoPG()){ + $query = 'SELECT "'.$lang.'" FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE id=\''.$id.'\' ORDER BY category ASC;'; + } else { + $query = 'SELECT '.$lang.' FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;'; + } $res = $con->query($query); $entries = ''; $temparr = array(); diff --git a/security/RIGHTS.php b/security/RIGHTS.php index 0c0c874..2e6d162 100644 --- a/security/RIGHTS.php +++ b/security/RIGHTS.php @@ -19,8 +19,6 @@ class RIGHTS { const SYS_SAI_CRON = 25; - const SYS_SAI_CRON = 25; - //Reserve first 1000 ids. const RESERVED_SYS_0_999 = 999; } \ No newline at end of file