sbMigrate11pre1cTo11pre1d.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
28 Components.utils.import("resource://app/jsmodules/ArrayConverter.jsm");
29 Components.utils.import("resource://app/jsmodules/sbLocalDatabaseMigrationUtils.jsm");
30 Components.utils.import("resource://app/jsmodules/SBJobUtils.jsm");
31 
32 const Cc = Components.classes;
33 const Ci = Components.interfaces;
34 const Cr = Components.results;
35 
36 function LOG(s) {
37  dump("----++++----++++sbLibraryMigration " +
38  sbLibraryMigration.versionString + ": " +
39  s +
40  "\n----++++----++++\n");
41 }
42 
44 {
45  SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
46 
47  this.fromVersion = 15;
48  this.toVersion = 16;
49  this.versionString = this.fromVersion + " to " +
50  this.toVersion;
51 }
52 
53 //-----------------------------------------------------------------------------
54 // sbLocalDatabaseMigration Implementation
55 //-----------------------------------------------------------------------------
56 
57 sbLibraryMigration.prototype = {
58  __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
59  classDescription: 'Songbird Migration Handler, version 15 to 16',
60  classID: Components.ID("{bcc617e0-1dd1-11b2-b34d-d3db6eea6e70}"),
61  contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID + ' 15 to 16',
62 
63  _databaseLocation: null,
64  _databaseGUID: null,
65 
66  migrate: function sbLibraryMigration_migrate(aLibrary) {
67  try{
68 
69  this._databaseGUID = aLibrary.databaseGuid;
70  this._databaseLocation = aLibrary.databaseLocation;
71 
72  var query = this._createQuery();
73 
74  // Update the schema version to the destination version.
75  query.addQuery("update library_metadata set value = '"
76  + this.toVersion + "' where name = 'version'");
77  query.addQuery("commit");
78 
79  // Try to reduce db size
80  query.addQuery("VACUUM");
81 
82  var retval;
83  query.setAsyncQuery(true);
84  query.execute(retval);
85 
86  // Raise a flag indicating that this library will need the indices
87  // dependent on the 'library_collate' collation sequence to be reindexed
88  var prefs = Cc["@mozilla.org/preferences-service;1"]
89  .getService(Ci.nsIPrefBranch);
90  prefs.setBoolPref("songbird.databaseengine." +
91  this._databaseGUID + ".invalidCollationIndex", true);
92  prefs.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
93  }
94  catch (e) {
95  dump("Exception occured: " + e);
96  throw e;
97  }
98  },
99 
100  _createQuery: function sbLibraryMigration_createQuery() {
101  var query = Cc["@songbirdnest.com/Songbird/DatabaseQuery;1"]
102  .createInstance(Ci.sbIDatabaseQuery);
103  query.databaseLocation = this._databaseLocation;
104  query.setDatabaseGUID(this._databaseGUID);
105 
106  return query;
107  }
108 
109 };
110 
111 //-----------------------------------------------------------------------------
112 // Module
113 //-----------------------------------------------------------------------------
114 function NSGetModule(compMgr, fileSpec) {
115  return XPCOMUtils.generateModule([
117  ]);
118 }
119 
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLibraryMigration()
return null
Definition: FeedWriter.js:1143
function NSGetModule(compMgr, fileSpec)
var prefs
Definition: FeedWriter.js:1169
sbDeviceFirmwareAutoCheckForUpdate prototype classID
function LOG(s)