diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-11 17:47:54 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-11 17:47:54 +0200 |
commit | 254f9dad6377311b8115221c252b20726acad0c5 (patch) | |
tree | 3361c671d301586cc8d07f459194808e0dd39fc3 /sinksh/syntax_modules/sink_upgrade.cpp | |
parent | 1291ccf13a0b8a1eddb6aaed24b45ceb31a2e01e (diff) | |
download | sink-254f9dad6377311b8115221c252b20726acad0c5.tar.gz sink-254f9dad6377311b8115221c252b20726acad0c5.zip |
Upgrade job that we can eventually use to upgrade the storage
Diffstat (limited to 'sinksh/syntax_modules/sink_upgrade.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_upgrade.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sinksh/syntax_modules/sink_upgrade.cpp b/sinksh/syntax_modules/sink_upgrade.cpp new file mode 100644 index 0000000..c399048 --- /dev/null +++ b/sinksh/syntax_modules/sink_upgrade.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Christian Mollekopf <mollekopf@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #include <QDebug> | ||
21 | #include <QObject> // tr() | ||
22 | #include <QTimer> | ||
23 | |||
24 | #include "common/store.h" | ||
25 | |||
26 | #include "state.h" | ||
27 | #include "syntaxtree.h" | ||
28 | |||
29 | namespace SinkUpgrade | ||
30 | { | ||
31 | |||
32 | bool upgrade(const QStringList &args, State &state) | ||
33 | { | ||
34 | state.print(QObject::tr("Upgrading...")); | ||
35 | Sink::Store::upgrade().exec().waitForFinished(); | ||
36 | state.printLine(QObject::tr("done")); | ||
37 | return true; | ||
38 | } | ||
39 | |||
40 | Syntax::List syntax() | ||
41 | { | ||
42 | return Syntax::List() << Syntax{"upgrade", QObject::tr("Upgrades your storage to the latest version (be careful!)"), &SinkUpgrade::upgrade, Syntax::NotInteractive}; | ||
43 | } | ||
44 | |||
45 | REGISTER_SYNTAX(SinkUpgrade) | ||
46 | |||
47 | } | ||