From 07c1d79f7c84a3c68d4a46614cde9929d5ef58e7 Mon Sep 17 00:00:00 2001 From: Jared Hancock Date: Wed, 22 Jul 2015 15:34:54 -0500 Subject: [PATCH] oops: Fix upgrade crash Also, * use current year when no company name exists (yet) * log a `created` timestamp for new files * drop table %group during the upgrade --- include/class.file.php | 1 + include/staff/login.tpl.php | 2 +- include/staff/pwreset.login.php | 2 +- include/staff/pwreset.php | 2 +- include/staff/pwreset.sent.php | 2 +- include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql | 1 + include/upgrader/streams/core/15b30765-dd0022fb.task.php | 1 + include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql | 1 + include/upgrader/streams/core/1ee831c8-36f6b328.task.php | 2 +- 9 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/class.file.php b/include/class.file.php index c0b844bfcf..d921d22dd9 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -386,6 +386,7 @@ static function create(&$file, $ft='T', $deduplicate=true) { 'key' => $file['key'], 'ft' => $ft ?: 'T', 'signature' => $file['signature'], + 'created' => SqlFunction::NOW(), )); if (isset($file['size'])) diff --git a/include/staff/login.tpl.php b/include/staff/login.tpl.php index 3bb7a8fc22..6319d289b6 100644 --- a/include/staff/login.tpl.php +++ b/include/staff/login.tpl.php @@ -47,7 +47,7 @@
- © company); ?> + © company) ?: date('Y'); ?>
diff --git a/include/staff/pwreset.login.php b/include/staff/pwreset.login.php index 6eeb21b343..cc5d0ae89e 100644 --- a/include/staff/pwreset.login.php +++ b/include/staff/pwreset.login.php @@ -29,7 +29,7 @@
- © company); ?> + © company) ?: date('Y'); ?>
diff --git a/include/staff/pwreset.php b/include/staff/pwreset.php index 5a82af0094..eddd22a0c7 100644 --- a/include/staff/pwreset.php +++ b/include/staff/pwreset.php @@ -27,7 +27,7 @@
- © company); ?> + © company) ?: date('Y'); ?>
diff --git a/include/staff/pwreset.sent.php b/include/staff/pwreset.sent.php index bb74b7b8b7..0609f34165 100644 --- a/include/staff/pwreset.sent.php +++ b/include/staff/pwreset.sent.php @@ -25,7 +25,7 @@
- © company); ?> + © company) ?: date('Y'); ?>
diff --git a/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql b/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql index 362a940052..292d605286 100644 --- a/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql +++ b/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql @@ -6,6 +6,7 @@ */ DROP TABLE IF EXISTS `%TABLE_PREFIX%group_dept_access`; +DROP TABLE IF EXISTS `%TABLE_PREFIX%group`; -- Drop `updated` if it exists (it stayed in the install script after it was -- removed from the update path diff --git a/include/upgrader/streams/core/15b30765-dd0022fb.task.php b/include/upgrader/streams/core/15b30765-dd0022fb.task.php index 755c57fe7b..970136b1bc 100644 --- a/include/upgrader/streams/core/15b30765-dd0022fb.task.php +++ b/include/upgrader/streams/core/15b30765-dd0022fb.task.php @@ -245,6 +245,7 @@ function saveAttachment($file) { 'hash' => $file['hash'], 'bk' => '6', 'attrs' => $file['path'], + 'created' => date('Y-m-d H:i:s', Misc::dbtime(filemtime($file['path']))), )); } } diff --git a/include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql b/include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql index 850441a57d..a60fae20cf 100644 --- a/include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql +++ b/include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql @@ -26,6 +26,7 @@ ALTER TABLE `%TABLE_PREFIX%staff` ADD `role_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `dept_id`; ALTER TABLE `%TABLE_PREFIX%groups` + RENAME TO `%TABLE_PREFIX%group`, CHANGE `group_id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD `role_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id`; diff --git a/include/upgrader/streams/core/1ee831c8-36f6b328.task.php b/include/upgrader/streams/core/1ee831c8-36f6b328.task.php index f70c4e2bfd..982f690e70 100644 --- a/include/upgrader/streams/core/1ee831c8-36f6b328.task.php +++ b/include/upgrader/streams/core/1ee831c8-36f6b328.task.php @@ -1,5 +1,5 @@