@@ -20,29 +20,29 @@ protected function didConstruct() {
20
20
));
21
21
}
22
22
23
- public function execute (PhutilArgumentParser $ args ) {
24
- $ is_dry = $ args ->getArg ('dryrun ' );
25
- $ is_force = $ args ->getArg ('force ' );
23
+ public function didExecute (PhutilArgumentParser $ args ) {
24
+ $ console = PhutilConsole::getConsole ();
26
25
27
- if (!$ is_dry && !$ is_force ) {
28
- echo phutil_console_wrap (
29
- pht (
30
- 'Are you completely sure you really want to permanently destroy all ' .
31
- 'storage for Phabricator data? This operation can not be undone and ' .
32
- 'your data will not be recoverable if you proceed. ' ));
26
+ if (!$ this ->isDryRun () && !$ this ->isForce ()) {
27
+ $ console ->writeOut (
28
+ phutil_console_wrap (
29
+ pht (
30
+ 'Are you completely sure you really want to permanently destroy ' .
31
+ 'all storage for Phabricator data? This operation can not be ' .
32
+ 'undone and your data will not be recoverable if you proceed. ' )));
33
33
34
34
if (!phutil_console_confirm (pht ('Permanently destroy all data? ' ))) {
35
- echo pht ('Cancelled. ' ). "\n" ;
35
+ $ console -> writeOut ( " %s \n" , pht ('Cancelled. ' )) ;
36
36
exit (1 );
37
37
}
38
38
39
39
if (!phutil_console_confirm (pht ('Really destroy all data forever? ' ))) {
40
- echo pht ('Cancelled. ' ). "\n" ;
40
+ $ console -> writeOut ( " %s \n" , pht ('Cancelled. ' )) ;
41
41
exit (1 );
42
42
}
43
43
}
44
44
45
- $ api = $ this ->getAPI ();
45
+ $ api = $ this ->getAPI ();
46
46
$ patches = $ this ->getPatches ();
47
47
48
48
if ($ args ->getArg ('unittest-fixtures ' )) {
@@ -55,27 +55,32 @@ public function execute(PhutilArgumentParser $args) {
55
55
PhabricatorTestCase::NAMESPACE_PREFIX );
56
56
$ databases = ipull ($ databases , 'db ' );
57
57
} else {
58
- $ databases = $ api ->getDatabaseList ($ patches );
58
+ $ databases = $ api ->getDatabaseList ($ patches );
59
59
$ databases [] = $ api ->getDatabaseName ('meta_data ' );
60
+
60
61
// These are legacy databases that were dropped long ago. See T2237.
61
62
$ databases [] = $ api ->getDatabaseName ('phid ' );
62
63
$ databases [] = $ api ->getDatabaseName ('directory ' );
63
64
}
64
65
65
66
foreach ($ databases as $ database ) {
66
- if ($ is_dry ) {
67
- echo pht ("DRYRUN: Would drop database '%s'. " , $ database )."\n" ;
67
+ if ($ this ->isDryRun ()) {
68
+ $ console ->writeOut (
69
+ "%s \n" ,
70
+ pht ("DRYRUN: Would drop database '%s'. " , $ database ));
68
71
} else {
69
- echo pht ("Dropping database '%s'... " , $ database )."\n" ;
72
+ $ console ->writeOut (
73
+ "%s \n" ,
74
+ pht ("Dropping database '%s'... " , $ database ));
70
75
queryfx (
71
76
$ api ->getConn (null ),
72
77
'DROP DATABASE IF EXISTS %T ' ,
73
78
$ database );
74
79
}
75
80
}
76
81
77
- if (!$ is_dry ) {
78
- echo pht ('Storage was destroyed. ' ). "\n" ;
82
+ if (!$ this -> isDryRun () ) {
83
+ $ console -> writeOut ( " %s \n" , pht ('Storage was destroyed. ' )) ;
79
84
}
80
85
81
86
return 0 ;
0 commit comments