Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 # coding: utf-8 | |
2 | |
3 # This file is part of the Adblock Plus web scripts, | |
4 # Copyright (C) 2006-2015 Eyeo GmbH | |
5 # | |
6 # Adblock Plus is free software: you can redistribute it and/or modify | |
7 # it under the terms of the GNU General Public License version 3 as | |
8 # published by the Free Software Foundation. | |
9 # | |
10 # Adblock Plus is distributed in the hope that it will be useful, | |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 # GNU General Public License for more details. | |
14 # | |
15 # You should have received a copy of the GNU General Public License | |
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 import shutil | |
19 | |
20 from sitescripts.utils import get_config | |
21 | |
22 config = get_config() | |
23 live_config = { | |
24 "database": config.get("filterhitstats", "database"), | |
25 "log_dir": config.get("filterhitstats", "log_dir") | |
26 } | |
27 test_config = { | |
28 "database": config.get("filterhitstats", "test_database"), | |
29 "log_dir": config.get("filterhitstats", "test_log_dir") | |
Wladimir Palant
2015/03/30 18:35:53
Why configure that directory? setup_config() can c
kzar
2015/03/30 19:01:35
Done.
| |
30 } | |
31 | |
32 def setup_config(): | |
33 config.set("filterhitstats", "database", test_config["database"]) | |
34 config.set("filterhitstats", "log_dir", test_config["log_dir"]) | |
35 return config | |
36 | |
37 def restore_config(): | |
38 config.set("filterhitstats", "database", live_config["database"]) | |
39 config.set("filterhitstats", "log_dir", live_config["log_dir"]) | |
40 shutil.rmtree(test_config["log_dir"], ignore_errors=True) | |
OLD | NEW |