-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUpdateAllShell.php
More file actions
91 lines (83 loc) · 2.11 KB
/
UpdateAllShell.php
File metadata and controls
91 lines (83 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Installシェル
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('AppShell', 'Console/Command');
/**
* 一括アップデートシェル
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Install\Console\Command
*/
class UpdateAllShell extends AppShell {
/**
* Contains tasks to load and instantiate
*
* @var array
*/
public $tasks = array(
'PluginManager.UpdateAll',
'PluginManager.CopyAllWebrootFiles',
);
/**
* Override startup
*
* @return void
*/
public function startup() {
$this->hr();
$this->out(__d('plugin_manager', 'Update of all plugins'));
$this->hr();
}
/**
* Override main
*
* @return void
*/
public function main() {
$this->out(__d('plugin_manager', '[S]tart'));
$this->out(__d('plugin_manager', '[Q]uit'));
$this->out(__d('net_commons', '[H]elp'));
$choice = strtolower(
$this->in(__d('net_commons', 'What would you like to do?'), ['S', 'Q', 'H'], 'Q')
);
switch ($choice) {
case 's':
$this->UpdateAll->execute();
return $this->_stop();
case 'q':
return $this->_stop();
case 'h':
$this->out($this->getOptionParser()->help());
break;
default:
$this->out(
__d('net_commons', 'You have made an invalid selection. Please choose a command to execute by entering %s.', '[S, H, Q]')
);
}
$this->hr();
}
/**
* Get the option parser.
*
* @return ConsoleOptionParser
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description(__d('install', 'NetCommons Install'))
->addSubcommand('update_all', array(
'help' => __d('plugin_manager', 'Update of all plugins'),
'parser' => $this->UpdateAll->getOptionParser(),
))
->addSubcommand('copy_all_webroot_files', array(
'help' => __d('plugin_manager', 'Webroot files copy of all plugins'),
'parser' => $this->UpdateAll->getOptionParser(),
));
}
}