mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-18 08:08:46 +00:00
Moved core.conf config upgrade to core instead of pref's manager.
This commit is contained in:
parent
74618d5a65
commit
81ca9952e9
2 changed files with 8 additions and 6 deletions
|
@ -113,6 +113,8 @@ class Core(component.Component):
|
||||||
|
|
||||||
# Get the core config
|
# Get the core config
|
||||||
self.config = deluge.configmanager.ConfigManager("core.conf")
|
self.config = deluge.configmanager.ConfigManager("core.conf")
|
||||||
|
self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2)
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
# If there was an interface value from the command line, use it, but
|
# If there was an interface value from the command line, use it, but
|
||||||
# store the one in the config so we can restore it on shutdown
|
# store the one in the config so we can restore it on shutdown
|
||||||
|
@ -159,6 +161,12 @@ class Core(component.Component):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.warning("Failed to load lt state: %s", e)
|
log.warning("Failed to load lt state: %s", e)
|
||||||
|
|
||||||
|
|
||||||
|
def __migrate_config_1_to_2(self, config):
|
||||||
|
if 'sequential_download' not in config:
|
||||||
|
config['sequential_download'] = False
|
||||||
|
return config
|
||||||
|
|
||||||
def save_dht_state(self):
|
def save_dht_state(self):
|
||||||
"""Saves the dht state to a file"""
|
"""Saves the dht state to a file"""
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -154,7 +154,6 @@ class PreferencesManager(component.Component):
|
||||||
"attribute to shared.")
|
"attribute to shared.")
|
||||||
self.config["shared"] = self.config["public"]
|
self.config["shared"] = self.config["public"]
|
||||||
del self.config["public"]
|
del self.config["public"]
|
||||||
self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2)
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.core = component.get("Core")
|
self.core = component.get("Core")
|
||||||
|
@ -474,8 +473,3 @@ class PreferencesManager(component.Component):
|
||||||
def _on_set_cache_expiry(self, key, value):
|
def _on_set_cache_expiry(self, key, value):
|
||||||
log.debug("%s: %s", key, value)
|
log.debug("%s: %s", key, value)
|
||||||
self.session_set_setting("cache_expiry", value)
|
self.session_set_setting("cache_expiry", value)
|
||||||
|
|
||||||
def __migrate_config_1_to_2(self, config):
|
|
||||||
if 'sequential_download' not in config:
|
|
||||||
config['sequential_download'] = DEFAULT_PREFS['sequential_download']
|
|
||||||
return config
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue