Skip to content

Commit

Permalink
Don't let missing prefs take down the down migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Apr 10, 2016
1 parent 3472b95 commit 4aee953
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions kronolith/migration/21_kronolith_upgrade_exceptionutc.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,20 @@ public function down()
$utc = new DateTimeZone('UTC');
foreach ($rows as $row) {
if ($row['event_creator_id'] != $creator) {
$prefs = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Prefs')
->create('horde', array(
'cache' => false,
'user' => $row['event_creator_id'])
);
$tz = $prefs->getValue('timezone');
if (empty($tz)) {
$tz = date_default_timezone_get();
}
$tz = new DateTimeZone($tz);
$creator = $row['event_creator_id'];
try {
$prefs = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Prefs')
->create('horde', array(
'cache' => false,
'user' => $row['event_creator_id'])
);
$tz = $prefs->getValue('timezone');
if (empty($tz)) {
$tz = date_default_timezone_get();
}
$tz = new DateTimeZone($tz);
$creator = $row['event_creator_id'];
} catch (Exception $e) {}

This comment has been minimized.

Copy link
@yunosh

yunosh Apr 11, 2016

Member

This would leave us with $tz undefined.

}

$eod = new DateTime($row['event_exceptionoriginaldate'], $utc);
Expand Down

0 comments on commit 4aee953

Please sign in to comment.