Skip to content

Commit

Permalink
oops: Fix upgrade crash
Browse files Browse the repository at this point in the history
Also,
* use current year when no company name exists (yet)
* log a `created` timestamp for new files
* drop table %group during the upgrade
  • Loading branch information
Jared Hancock committed Jul 22, 2015
1 parent 33f18c5 commit 07c1d79
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/class.file.php
Expand Up @@ -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']))
Expand Down
2 changes: 1 addition & 1 deletion include/staff/login.tpl.php
Expand Up @@ -47,7 +47,7 @@

<div id="company">
<div class="content">
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company); ?>
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company) ?: date('Y'); ?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion include/staff/pwreset.login.php
Expand Up @@ -29,7 +29,7 @@

<div id="company">
<div class="content">
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company); ?>
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company) ?: date('Y'); ?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion include/staff/pwreset.php
Expand Up @@ -27,7 +27,7 @@

<div id="company">
<div class="content">
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company); ?>
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company) ?: date('Y'); ?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion include/staff/pwreset.sent.php
Expand Up @@ -25,7 +25,7 @@

<div id="company">
<div class="content">
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company); ?>
<?php echo __('Copyright'); ?> &copy; <?php echo Format::htmlchars($ost->company) ?: date('Y'); ?>
</div>
</div>
</div>
Expand Down
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/upgrader/streams/core/15b30765-dd0022fb.task.php
Expand Up @@ -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']))),
));
}
}
Expand Down
1 change: 1 addition & 0 deletions include/upgrader/streams/core/1ee831c8-36f6b328.patch.sql
Expand Up @@ -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`;

Expand Down
2 changes: 1 addition & 1 deletion include/upgrader/streams/core/1ee831c8-36f6b328.task.php
@@ -1,5 +1,5 @@
<?php
define('GROUP_TABLE', TABLE_PREFIX.'groups');
define('GROUP_TABLE', TABLE_PREFIX.'group');
define('GROUP_DEPT_TABLE', TABLE_PREFIX.'group_dept_access');
class Group extends VerySimpleModel {
static $meta = array(
Expand Down

0 comments on commit 07c1d79

Please sign in to comment.