sbMigrate18to19pre0.discSortTrackSort.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 
28 const Cc = Components.classes;
29 const Ci = Components.interfaces;
30 const Cr = Components.results;
31 
32 const FROM_VERSION = 25;
33 const TO_VERSION = 26;
34 
35 function LOG(s) {
36  dump("----++++----++++sbLibraryMigration " +
37  FROM_VERSION + " to " + TO_VERSION + ": " +
38  s +
39  "\n----++++----++++\n");
40 }
41 
43 {
44  SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
45  this._errors = [];
46 }
47 
48 //-----------------------------------------------------------------------------
49 // sbLocalDatabaseMigration Implementation
50 //-----------------------------------------------------------------------------
51 
52 sbLibraryMigration.prototype = {
53  __proto__: SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype,
54  classDescription: 'Songbird Migration Handler, version ' +
55  FROM_VERSION + ' to ' + TO_VERSION,
56  classID: Components.ID("{0f5c7861-873d-419e-9de7-8a1d157050b0}"),
57  contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID +
58  FROM_VERSION + 'to' + TO_VERSION,
59 
60  fromVersion: FROM_VERSION,
61  toVersion: TO_VERSION,
62 
63  migrate: function sbLibraryMigration_migrate(aLibrary) {
64  try {
65  this._databaseGUID = aLibrary.databaseGuid;
66  this._databaseLocation = aLibrary.databaseLocation;
67 
68  // Run a query that will mark the library as migrated
69  var query = this.createMigrationQuery(aLibrary);
70  query.addQuery("commit");
71  var retval;
72  query.setAsyncQuery(false);
73  query.execute(retval);
74 
75  //
76  // Raise a flag indicating that this library will need all
77  // sort info to be recomputed.
78  //
79  // Normally we'd call propertyCache.invalidateSortData(), but
80  // at this point in startup the property cache does not exist yet.
81  //
82  var prefs = Cc["@mozilla.org/preferences-service;1"]
83  .getService(Ci.nsIPrefBranch);
84  prefs.setBoolPref("songbird.propertycache." +
85  this._databaseGUID + ".invalidSortData", true);
86  prefs.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
87  }
88  catch (e) {
89  dump("Exception occured: " + e);
90  throw e;
91  }
92  }
93 };
94 
95 //-----------------------------------------------------------------------------
96 // Module
97 //-----------------------------------------------------------------------------
98 function NSGetModule(compMgr, fileSpec) {
99  return XPCOMUtils.generateModule([
101  ]);
102 }
103 
function sbLibraryMigration()
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
return null
Definition: FeedWriter.js:1143
var prefs
Definition: FeedWriter.js:1169
sbDeviceFirmwareAutoCheckForUpdate prototype classID