From 3eea3d000c2415bb7b36ab759a049420ca53ae2e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 12 Mar 2018 18:33:01 +0000 Subject: [PATCH] Improved dbinstall.php to avoid potential corruption of rights. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 11 ++++++----- mysql.sql | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 27fdad16..c614ff73 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.17.40.4063 | Copyright © Anuko | +  Anuko Time Tracker 1.17.40.4064 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 6a37805f..d461dcb7 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -722,7 +722,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_log` ADD `paid` tinyint(4) NULL default '0' AFTER `billable`"); } - if ($_POST["convert11400to11735"]) { + if ($_POST["convert11400to11740"]) { setChange("ALTER TABLE `tt_teams` DROP `address`"); setChange("ALTER TABLE `tt_fav_reports` ADD `report_spec` text default NULL AFTER `user_id`"); setChange("ALTER TABLE `tt_fav_reports` ADD `paid_status` tinyint(4) default NULL AFTER `invoice`"); @@ -755,7 +755,8 @@ if ($_POST) { setChange("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.35') set rights = 'data_entry,view_own_reports,view_own_charts,view_own_invoices,manage_own_settings,view_users,on_behalf_data_entry,view_reports,view_charts,override_punch_mode,swap_roles,approve_timesheets,manage_users,manage_projects,manage_tasks,manage_custom_fields,manage_clients,manage_invoices,manage_features,manage_basic_settings,manage_advanced_settings,manage_roles,export_data,manage_subgroups' where team_id = 0 and rank = 512"); setChange("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.35') set rights = replace(rights, 'view_own_data', 'view_own_reports,view_own_charts') where team_id > 0"); setChange("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.35') set rights = replace(rights, 'view_data', 'view_reports,view_charts') where team_id > 0"); - setChange("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.35') set rights = replace(rights, 'view_own_charts', 'view_own_charts,view_own_invoices') where team_id > 0 and rank = 16"); + setChange("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.35') set rights = replace(rights, 'view_own_charts,manage_own_settings', 'view_own_charts,view_own_invoices,manage_own_settings') where team_id > 0 and rank = 16"); + setChange("UPDATE `tt_site_config` SET `param_value` = '1.17.40' where param_name = 'version_db'"); } if ($_POST["cleanup"]) { @@ -801,7 +802,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.17.35) + Create database structure (v1.17.40)
(applies only to new installations, do not execute when updating)
@@ -837,8 +838,8 @@ if ($_POST) {

Update database structure (v1.14 to v1.17.35)
Update database structure (v1.14 to v1.17.40)
diff --git a/mysql.sql b/mysql.sql index 4cacf9a0..ffba70f1 100644 --- a/mysql.sql +++ b/mysql.sql @@ -427,4 +427,4 @@ CREATE TABLE `tt_site_config` ( PRIMARY KEY (`param_name`) ); -INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.35', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.40', now()); # TODO: change when structure changes. -- 2.20.1