Fix bug 406579 - Update story for timezone database. r=mschroeder,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Tue, 15 Nov 2011 11:39:19 +0100
changeset 9356 45c318d270eadd5eb1af0205a5286e4895fe722a
parent 9355 aa1fe834aea32a0ccd2e937c5709f471996dc5b2
child 9357 d540d17392878f3c62391f84ef0026d041e5c371
push idunknown
push userunknown
push dateunknown
reviewersmschroeder, philipp
bugs406579
Fix bug 406579 - Update story for timezone database. r=mschroeder,a=philipp
calendar/locales/filter.py
calendar/providers/storage/calStorageUpgrade.jsm
--- a/calendar/locales/filter.py
+++ b/calendar/locales/filter.py
@@ -2,14 +2,18 @@
 def test(mod, path, entity = None):
   import re
 
   # ignore anyhting but calendar stuff
   if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                  "calendar", "other-licenses/branding/sunbird"):
     return False
 
+  # Timezone properties don't have to be translated
+  if path == "chrome/calendar/timezones.properties":
+    return False
+
   # Noun class entries do not have to be translated
   if path == "chrome/calendar/calendar-event-dialog.properties":
     return not re.match(r".*Nounclass[1-9]", entity)
 
   # Everything else should be taken into account
   return True
--- a/calendar/providers/storage/calStorageUpgrade.jsm
+++ b/calendar/providers/storage/calStorageUpgrade.jsm
@@ -389,36 +389,33 @@ function reportErrorAndRollback(db, e) {
 /**
  * Make sure the timezones of the events in the database are up to date.
  *
  * @param db        The database to bring up to date
  */
 function ensureUpdatedTimezones(db) {
     // check if timezone version has changed:
     let selectTzVersion = createStatement(db, "SELECT version FROM cal_tz_version LIMIT 1");
+    let tzServiceVersion = cal.getTimezoneService().version;
     let version;
     try {
         version = (selectTzVersion.step() ? selectTzVersion.row.version : null);
     } finally {
         selectTzVersion.reset();
     }
 
     let versionComp = 1;
     if (version) {
         versionComp = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
                                 .getService(Components.interfaces.nsIVersionComparator)
-                                .compare(cal.getTimezoneService().version, version);
+                                .compare(tzServiceVersion, version);
     }
 
-    if (versionComp < 0) {
-        // A timezones downgrade has happened!
-        throw new Components.Exception("Attempt to downgrade timezones",
-                                       Components.interfaces.calIErrors.STORAGE_UNKNOWN_TIMEZONES_ERROR);
-    } else if (versionComp > 0) {
-        cal.LOG("Timezones have been updated, updating calendar data.");
+    if (versionComp != 0) {
+        cal.LOG("[calStorageCalendar] Timezones have been changed from " + version + " to " + tzServiceVersion + ", updating calendar data.");
 
         let zonesToUpdate = [];
         let getZones = createStatement(db,
             "SELECT DISTINCT(zone) FROM ("+
             "SELECT recurrence_id_tz AS zone FROM cal_attendees    WHERE recurrence_id_tz IS NOT NULL UNION " +
             "SELECT recurrence_id_tz AS zone FROM cal_events       WHERE recurrence_id_tz IS NOT NULL UNION " +
             "SELECT event_start_tz   AS zone FROM cal_events       WHERE event_start_tz   IS NOT NULL UNION " +
             "SELECT event_end_tz     AS zone FROM cal_events       WHERE event_end_tz     IS NOT NULL UNION " +