home *** CD-ROM | disk | FTP | other *** search
/ Freelog 112 / FreelogNo112-NovembreDecembre2012.iso / Multimedia / Songbird / Songbird_2.0.0-2311_windows-i686-msvc8.exe / components / sbMigrate11pre1eTo11pre1f.js < prev    next >
Text File  |  2012-06-08  |  3KB  |  103 lines

  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.  
  43. function sbLibraryMigration()
  44. {
  45.   SBLocalDatabaseMigrationUtils.BaseMigrationHandler.call(this);
  46.   
  47.   this.fromVersion = 17;
  48.   this.toVersion   = 18;
  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 17 to 18',
  60.   classID: Components.ID("{2cba8c55-029a-4313-b7a3-492f6fc765b2}"),
  61.   contractID: SBLocalDatabaseMigrationUtils.baseHandlerContractID + ' 17 to 18',
  62.  
  63.   migrate: function sbLibraryMigration_migrate(aLibrary) {
  64.     try{
  65.  
  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("commit");
  72.       var retval;
  73.       query.setAsyncQuery(false);
  74.       query.execute(retval);
  75.  
  76.         // Raise a flag indicating that this library will need all 
  77.       // sort info to be recomputed.
  78.       // Normally we'd call propertyCache.invalidateSortData(), but 
  79.       // at this point in startup the property cache does not exist yet.
  80.       var prefs = Cc["@mozilla.org/preferences-service;1"]
  81.                     .getService(Ci.nsIPrefBranch);
  82.       prefs.setBoolPref("songbird.propertycache." + 
  83.             this._databaseGUID + ".invalidSortData", true);
  84.       prefs.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
  85.     }
  86.     catch (e) {
  87.       dump("Exception occured: " + e);
  88.       throw e;
  89.     }
  90.   },
  91.  
  92. };
  93.  
  94. //-----------------------------------------------------------------------------
  95. // Module
  96. //-----------------------------------------------------------------------------
  97. function NSGetModule(compMgr, fileSpec) {
  98.   return XPCOMUtils.generateModule([
  99.     sbLibraryMigration
  100.   ]);
  101. }
  102.  
  103.