sbMigrate18to19pre0.index.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import("resource://app/jsmodules/sbLocalDatabaseMigrationUtils.jsm");
27 Components.utils.import("resource://app/jsmodules/SBJobUtils.jsm");
28 
29 const Cc = Components.classes;
30 const Ci = Components.interfaces;
31 const Cr = Components.results;
32 
33 const FROM_VERSION = 26;
34 const TO_VERSION = 27;
35 
36 function LOG(s) {
37  dump("----++++----++++sbLibraryMigration " +
38  FROM_VERSION + " to " + TO_VERSION + ": " +
39  s +
40  "\n----++++----++++\n");
41 }
42 
44 {
45  SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
46  this._errors = [];
47 }
48 
49 //-----------------------------------------------------------------------------
50 // sbLocalDatabaseMigration Implementation
51 //-----------------------------------------------------------------------------
52 
53 sbLibraryMigration.prototype = {
54  __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
55  classDescription: 'Songbird Migration Handler, version ' +
56  FROM_VERSION + ' to ' + TO_VERSION,
57  classID: Components.ID("{073f0b42-b3c1-465a-bcce-9f1f50fbd06d}"),
58  contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
59  FROM_VERSION + 'to' + TO_VERSION,
60 
61  fromVersion: FROM_VERSION,
62  toVersion: TO_VERSION,
63 
64  migrate: function sbLibraryMigration_migrate(aLibrary) {
65  try {
66  this._databaseGUID = aLibrary.databaseGuid;
67  this._databaseLocation = aLibrary.databaseLocation;
68 
69  // Run a query that will mark the library as migrated
70  var query = this.createMigrationQuery(aLibrary);
71  query.addQuery("create index idx_resource_properties_property_id_obj_sortable_media_item_id on resource_properties (property_id, obj_sortable, media_item_id)");
72  query.addQuery("reindex");
73  query.addQuery("analyze");
74  query.addQuery("commit");
75 
76  this.migrationQuery = query;
77 
78  var sip = Cc["@mozilla.org/supports-interface-pointer;1"]
79  .createInstance(Ci.nsISupportsInterfacePointer);
80  sip.data = this;
81 
82  this._titleText = "Library Migration Helper";
83  this._statusText = "Migrating 1.8 database to 1.9 database...";
84 
85  query.setAsyncQuery(true);
86  query.execute();
87 
88  this.startNotificationTimer();
89  SBJobUtils.showProgressDialog(sip.data, null, 0);
90  this.stopNotificationTimer();
91  }
92  catch (e) {
93  dump("Exception occured: " + e);
94  throw e;
95  }
96  }
97 };
98 
99 //-----------------------------------------------------------------------------
100 // Module
101 //-----------------------------------------------------------------------------
102 function NSGetModule(compMgr, fileSpec) {
103  return XPCOMUtils.generateModule([
105  ]);
106 }
107 
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
const FROM_VERSION
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLibraryMigration()
const TO_VERSION
function LOG(s)
return null
Definition: FeedWriter.js:1143
sbDeviceFirmwareAutoCheckForUpdate prototype classID