Commit | Line | Data |
---|---|---|
763cf83f | 1 | # GNU MediaGoblin -- federated, autonomous media hosting |
cf29e8a8 | 2 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. |
763cf83f WKG |
3 | # |
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 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 Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | import sys | |
18 | import pymongo | |
19 | import sys | |
20 | import os | |
21 | import shutil | |
22 | ||
23 | ||
24 | def wipe_parser_setup(subparser): | |
25 | pass | |
26 | ||
27 | ||
28 | def wipe(args): | |
29 | print "*** WARNING! ***" | |
30 | print "" | |
31 | print "Running this will destroy your mediagoblin database," | |
32 | print "remove all your media files in user_dev/, etc." | |
4a4035c8 CAW |
33 | print "" |
34 | print "ALSO: This command is currently a hack and will only remove" | |
35 | print " things properly on the default setup! If you've customized" | |
36 | print " your mediagoblin configs, it won't work (for now)." | |
763cf83f WKG |
37 | |
38 | drop_it = raw_input( | |
39 | 'Are you **SURE** you want to destroy your environment? ' | |
40 | '(if so, type "yes")> ') | |
41 | ||
42 | if not drop_it == 'yes': | |
43 | return | |
44 | ||
45 | print "nixing data in mongodb...." | |
46 | conn = pymongo.Connection() | |
47 | conn.drop_database('mediagoblin') | |
48 | ||
49 | for directory in [os.path.join(os.getcwd(), "user_dev", "media"), | |
50 | os.path.join(os.getcwd(), "user_dev", "beaker")]: | |
51 | if os.path.exists(directory): | |
52 | print "nixing %s...." % directory | |
53 | shutil.rmtree(directory) | |
54 | ||
c57b42a1 | 55 | print "removed all your stuff!" |