1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Command\InputOptionKeys |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Command; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Utils\InputOptionKeysInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Utility class containing the available visibility keys. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
31
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
32
|
|
|
* @link http://www.techdivision.com |
33
|
|
|
*/ |
34
|
|
|
class InputOptionKeys extends \ArrayObject implements InputOptionKeysInterface |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Input key for the --serial option. |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
const SERIAL = 'serial'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The input option key for the system name to use. |
46
|
|
|
* |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
const SYSTEM_NAME = 'system-name'; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* The input option key for the path to the configuration file to use. |
53
|
|
|
* |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
const CONFIGURATION = 'configuration'; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* The input option key for the Magento installation directory. |
60
|
|
|
* |
61
|
|
|
* @var string |
62
|
|
|
*/ |
63
|
|
|
const INSTALLATION_DIR = 'installation-dir'; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* The input option key for the directory containing the files to be imported. |
67
|
|
|
* |
68
|
|
|
* @var string |
69
|
|
|
*/ |
70
|
|
|
const SOURCE_DIR = 'source-dir'; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* The input option key for the directory containing the imported files. |
74
|
|
|
* |
75
|
|
|
* @var string |
76
|
|
|
*/ |
77
|
|
|
const TARGET_DIR = 'target-dir'; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* The input option key for the directory containing the archived imported files. |
81
|
|
|
* |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
const ARCHIVE_DIR = 'archive-dir'; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The input option key for the directory containing the flag to archive the imported files. |
88
|
|
|
* |
89
|
|
|
* @var string |
90
|
|
|
*/ |
91
|
|
|
const ARCHIVE_ARTEFACTS = 'archive-artefacts'; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* The input option key for the Magento edition, EE or CE. |
95
|
|
|
* |
96
|
|
|
* @var string |
97
|
|
|
*/ |
98
|
|
|
const MAGENTO_EDITION = 'magento-edition'; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* The input option key for the Magento version, e. g. 2.1.0. |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
*/ |
105
|
|
|
const MAGENTO_VERSION = 'magento-version'; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* The input option key for the database ID to use. |
109
|
|
|
* |
110
|
|
|
* @var string |
111
|
|
|
*/ |
112
|
|
|
const USE_DB_ID = 'use-db-id'; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* The input option key for the PDO DSN to use. |
116
|
|
|
* |
117
|
|
|
* @var string |
118
|
|
|
*/ |
119
|
|
|
const DB_PDO_DSN = 'db-pdo-dsn'; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* The input option key for the DB username to use. |
123
|
|
|
* |
124
|
|
|
* @var string |
125
|
|
|
*/ |
126
|
|
|
const DB_USERNAME = 'db-username'; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* The input option key for the DB password to use. |
130
|
|
|
* |
131
|
|
|
* @var string |
132
|
|
|
*/ |
133
|
|
|
const DB_PASSWORD = 'db-password'; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* The input option key for the DB table prefix to use. |
137
|
|
|
* |
138
|
|
|
* @var string |
139
|
|
|
*/ |
140
|
|
|
const DB_TABLE_PREFIX = 'db-table-prefix'; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* The input option key for the debug mode. |
144
|
|
|
* |
145
|
|
|
* @var string |
146
|
|
|
*/ |
147
|
|
|
const DEBUG_MODE = 'debug-mode'; |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* The input option key for the log level to use. |
151
|
|
|
* |
152
|
|
|
* @var string |
153
|
|
|
*/ |
154
|
|
|
const LOG_LEVEL = 'log-level'; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* The input option key for the PID filename to use. |
158
|
|
|
* |
159
|
|
|
* @var string |
160
|
|
|
*/ |
161
|
|
|
const PID_FILENAME = 'pid-filename'; |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* The input option key for the destination pathname to use. |
165
|
|
|
* |
166
|
|
|
* @var string |
167
|
|
|
*/ |
168
|
|
|
const DEST = 'dest'; |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* The input option key for the single transaction flag. |
172
|
|
|
* |
173
|
|
|
* @var string |
174
|
|
|
*/ |
175
|
|
|
const SINGLE_TRANSACTION = 'single-transaction'; |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* The input option key for additional params that has to be merged into the application configuration. |
179
|
|
|
* |
180
|
|
|
* @var string |
181
|
|
|
*/ |
182
|
|
|
const PARAMS = 'params'; |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* The input option key for the path to additional params as file that has to be merged into the application configuration. |
186
|
|
|
* |
187
|
|
|
* @var string |
188
|
|
|
*/ |
189
|
|
|
const PARAMS_FILE = 'params-file'; |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* The input option key for the flag to enable the cache functionality or not. |
193
|
|
|
* |
194
|
|
|
* @var string |
195
|
|
|
*/ |
196
|
|
|
const CACHE_ENABLED = 'cache-enabled'; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* The input option key for the move files prefix. |
200
|
|
|
* |
201
|
|
|
* @var string |
202
|
|
|
*/ |
203
|
|
|
const MOVE_FILES_PREFIX = 'move-files-prefix'; |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* The input option key for the custom configuration directory. |
207
|
|
|
* |
208
|
|
|
* @var string |
209
|
|
|
*/ |
210
|
|
|
const CUSTOM_CONFIGURATION_DIR = 'custom-configuration-dir'; |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Construct a new input option instance. |
214
|
|
|
* |
215
|
|
|
* @param array $inputOptionKeys The array with the additional input option names |
216
|
|
|
* @link http://www.php.net/manual/en/arrayobject.construct.php |
217
|
|
|
*/ |
218
|
|
|
public function __construct(array $inputOptionKeys = array()) |
219
|
|
|
{ |
220
|
|
|
|
221
|
|
|
// merge the edition names with the passed ones |
222
|
|
|
$mergedInputOptionKeys = array_merge( |
223
|
|
|
array( |
224
|
|
|
InputOptionKeys::SERIAL, |
225
|
|
|
InputOptionKeys::SYSTEM_NAME, |
226
|
|
|
InputOptionKeys::CONFIGURATION, |
227
|
|
|
InputOptionKeys::INSTALLATION_DIR, |
228
|
|
|
InputOptionKeys::SOURCE_DIR, |
229
|
|
|
InputOptionKeys::TARGET_DIR, |
230
|
|
|
InputOptionKeys::ARCHIVE_DIR, |
231
|
|
|
InputOptionKeys::ARCHIVE_ARTEFACTS, |
232
|
|
|
InputOptionKeys::MAGENTO_EDITION, |
233
|
|
|
InputOptionKeys::MAGENTO_VERSION, |
234
|
|
|
InputOptionKeys::USE_DB_ID, |
235
|
|
|
InputOptionKeys::DB_PDO_DSN, |
236
|
|
|
InputOptionKeys::DB_USERNAME, |
237
|
|
|
InputOptionKeys::DB_PASSWORD, |
238
|
|
|
InputOptionKeys::DB_TABLE_PREFIX, |
239
|
|
|
InputOptionKeys::DEBUG_MODE, |
240
|
|
|
InputOptionKeys::LOG_LEVEL, |
241
|
|
|
InputOptionKeys::PID_FILENAME, |
242
|
|
|
InputOptionKeys::DEST, |
243
|
|
|
InputOptionKeys::SINGLE_TRANSACTION, |
244
|
|
|
InputOptionKeys::PARAMS, |
245
|
|
|
InputOptionKeys::PARAMS_FILE, |
246
|
|
|
InputOptionKeys::CACHE_ENABLED, |
247
|
|
|
InputOptionKeys::MOVE_FILES_PREFIX, |
248
|
|
|
InputOptionKeys::CUSTOM_CONFIGURATION_DIR, |
249
|
|
|
), |
250
|
|
|
$inputOptionKeys |
251
|
|
|
); |
252
|
|
|
|
253
|
|
|
// initialize the parent class with the merged edition names |
254
|
|
|
parent::__construct($mergedInputOptionKeys); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Query whether or not the passed input option is valid. |
259
|
|
|
* |
260
|
|
|
* @param string $inputOption The input option to query for |
261
|
|
|
* |
262
|
|
|
* @return boolean TRUE if the input option is valid, else FALSE |
263
|
|
|
*/ |
264
|
|
|
public function isInputOption($inputOption) |
265
|
|
|
{ |
266
|
|
|
return in_array($inputOption, (array) $this); |
267
|
|
|
} |
268
|
|
|
} |
269
|
|
|
|