11<?php
22
3- /* * *************************************************************
3+ /** *************************************************************
44 * Copyright notice
55 *
66 * (c) 2012 Georg Ringer <[email protected] > 2121 * GNU General Public License for more details.
2222 *
2323 * This copyright notice MUST APPEAR in all copies of the script!
24- * ************************************************************* */
24+ ***************************************************************/
2525
2626/**
2727 * Extension API Command Controller
@@ -54,12 +54,12 @@ public function infoCommand($key) {
5454
5555 $ outputInformation = array ();
5656 $ outputInformation ['is installed ' ] = ($ data ['is_installed ' ] ? 'yes ' : 'no ' );
57- foreach ($ data ['em_conf ' ] as $ emConfKey => $ emConfValue ) {
58- // Skip empty properties
57+ foreach ($ data ['em_conf ' ] as $ emConfKey => $ emConfValue ) {
58+ // Skip empty properties
5959 if (empty ($ emConfValue )) {
6060 continue ;
6161 }
62- // Skip properties which are already handled
62+ // Skip properties which are already handled
6363 if ($ emConfKey === 'title ' || $ emConfKey === 'version ' || $ emConfKey === 'state ' ) {
6464 continue ;
6565 }
@@ -72,7 +72,7 @@ public function infoCommand($key) {
7272 foreach ($ outputValue as $ additionalKey => $ additionalValue ) {
7373 if (is_array ($ additionalValue )) {
7474
75- if (empty ($ additionalValue )) {
75+ if (empty ($ additionalValue )) {
7676 continue ;
7777 }
7878 $ description .= LF . str_repeat (' ' , 28 ) . $ additionalKey ;
@@ -81,7 +81,7 @@ public function infoCommand($key) {
8181 $ description .= str_repeat (' ' , 30 ) . $ ak . ': ' . $ av . LF ;
8282 }
8383 } else {
84- $ description .= LF . str_repeat (' ' , 28 ) . $ additionalKey . ': ' . $ additionalValue ;
84+ $ description .= LF . str_repeat (' ' , 28 ) . $ additionalKey . ': ' . $ additionalValue ;
8585 }
8686 }
8787 } else {
@@ -130,194 +130,142 @@ public function updateListCommand() {
130130
131131 $ this ->outputLine ('Extension list has been updated. ' );
132132 }
133-
134-
133+
135134 /**
136135 * Install(activate) an extension
137136 *
138137 * @param string $key extension key
139138 * @return void
140139 */
141140 public function installCommand ($ key ) {
142-
143141 try {
144-
145142 /** @var $service Tx_Coreapi_Service_ExtensionApiService */
146143 $ service = $ this ->objectManager ->get ('Tx_Coreapi_Service_ExtensionApiService ' );
147144 $ data = $ service ->installExtension ($ key );
148-
149145 } catch (Exception $ e ) {
150-
151146 $ this ->outputLine ($ e ->getMessage ());
152147 $ this ->quit ();
153-
154148 }
155-
156149 $ this ->outputLine (sprintf ('Extension "%s" is now installed! ' , $ key ));
157-
158150 }
159151
160-
161152 /**
162153 * UnInstall(deactivate) an extension
163154 *
164155 * @param string $key extension key
165156 * @return void
166157 */
167- public function unInstallCommand ($ key ) {
168-
158+ public function uninstallCommand ($ key ) {
169159 try {
170-
171160 /** @var $service Tx_Coreapi_Service_ExtensionApiService */
172161 $ service = $ this ->objectManager ->get ('Tx_Coreapi_Service_ExtensionApiService ' );
173- $ data = $ service ->unInstallExtension ($ key );
174-
162+ $ data = $ service ->uninstallExtension ($ key );
175163 } catch (Exception $ e ) {
176-
177164 $ this ->outputLine ($ e ->getMessage ());
178165 $ this ->quit ();
179-
180166 }
181-
182167 $ this ->outputLine (sprintf ('Extension "%s" is now uninstalled! ' , $ key ));
183-
184168 }
185169
186-
187-
188170 /**
189171 * Configure an extension
190- *
172+ *
191173 * This command enables you to configure an extension.
192- *
174+ *
193175 * examples:
194- *
176+ *
195177 * [1] Using a standard formatted ini-file
196178 * ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --configfile=C:\rteconf.txt
197- *
179+ *
198180 * [2] Adding configuration settings directly on the command line
199181 * ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --settings="enableImages=1;allowStyleAttribute=0"
200182 *
201183 * [3] A combination of [1] and [2]
202184 * ./cli_dispatch.phpsh extbase extensionapi:configure rtehtmlarea --configfile=C:\rteconf.txt --settings="enableImages=1;allowStyleAttribute=0"
203- *
204- *
205- *
185+ *
206186 * @param string $key extension key
207187 * @param string $configfile path to file containing configuration settings. Must be formatted as a standard ini-file
208188 * @param string $settings string containing configuration settings separated on the form "k1=v1;k2=v2;"
209189 * @return void
210190 */
211- public function configureCommand ($ key , $ configfile ='' ,$ settings ='' ) {
212-
191+ public function configureCommand ($ key , $ configfile = '' , $ settings = '' ) {
213192 global $ TYPO3_CONF_VARS ;
214-
215193 try {
216-
217194 /** @var $service Tx_Coreapi_Service_ExtensionApiService */
218195 $ service = $ this ->objectManager ->get ('Tx_Coreapi_Service_ExtensionApiService ' );
219-
220196 $ conf = array ();
221-
222- if (is_file ($ configfile )){
223-
197+ if (is_file ($ configfile )) {
224198 $ conf = parse_ini_file ($ configfile );
225-
226199 }
227-
228- if (strlen ($ settings )){
229- $ arr = explode ('; ' ,$ settings );
230- foreach ($ arr as $ v ){
231- if (strpos ($ v ,'= ' ) === FALSE ){
232-
200+
201+ if (strlen ($ settings )) {
202+ $ arr = explode ('; ' , $ settings );
203+ foreach ($ arr as $ v ) {
204+ if (strpos ($ v , '= ' ) === FALSE ) {
233205 throw new InvalidArgumentException (sprintf ('Ill-formed setting "%s"! ' , $ v ));
234-
235206 }
236- $ parts = t3lib_div::trimExplode ('= ' , $ v ,FALSE ,2 );
237-
238- if (!empty ($ parts [0 ])){
207+ $ parts = t3lib_div::trimExplode ('= ' , $ v , FALSE , 2 );
208+ if (!empty ($ parts [0 ])) {
239209 $ conf [$ parts [0 ]] = $ parts [1 ];
240210 }
241211 }
242212 }
243-
244- if (empty ($ conf )){
245-
213+
214+ if (empty ($ conf )) {
246215 throw new InvalidArgumentException (sprintf ('No configuration settings! ' , $ key ));
247-
248216 }
249-
250- $ data = $ service ->configureExtension ($ key ,$ conf );
251-
217+ $ data = $ service ->configureExtension ($ key , $ conf );
218+
252219 } catch (Exception $ e ) {
253-
254220 $ this ->outputLine ($ e ->getMessage ());
255221 $ this ->quit ();
256-
257222 }
258-
259223 $ this ->outputLine (sprintf ('Extension "%s" has been configured! ' , $ key ));
260-
261224 }
262225
263226 /**
264227 * Fetch an extension from TER
265- *
228+ *
266229 * @param string $key extension key
267230 * @param string $version the exact version of the extension, otherwise the latest will be picked
268231 * @param string $location where to put the extension. S = typo3/sysext, G = typo3/ext, L = typo3conf/ext
269- * @param string $overwrite overwrite the extension if it already exists
232+ * @param bool $overwrite overwrite the extension if it already exists
270233 * @param string $mirror mirror to fetch the extension from, otherwise a random mirror will be selected
271234 * @return void
272235 */
273-
274- public function fetchCommand ($ key , $ version ='' , $ location ='L ' , $ overwrite = FALSE , $ mirror = '' ){
275-
236+ public function fetchCommand ($ key , $ version = '' , $ location = 'L ' , $ overwrite = FALSE , $ mirror = '' ) {
276237 try {
277-
278238 /** @var $service Tx_Coreapi_Service_ExtensionApiService */
279239 $ service = $ this ->objectManager ->get ('Tx_Coreapi_Service_ExtensionApiService ' );
280- $ data = $ service ->fetchExtension ($ key , $ version , $ location , $ overwrite ,$ mirror );
281- $ this ->outputLine (sprintf ('Extension "%s" version %s has been fetched from repository! ' , $ data ['extKey ' ],$ data ['version ' ]));
282-
240+ $ data = $ service ->fetchExtension ($ key , $ version , $ location , $ overwrite , $ mirror );
241+ $ this ->outputLine (sprintf ('Extension "%s" version %s has been fetched from repository! ' , $ data ['extKey ' ], $ data ['version ' ]));
283242 } catch (Exception $ e ) {
284-
285243 $ this ->outputLine ($ e ->getMessage ());
286244 $ this ->quit ();
287-
288245 }
289-
290246 }
291247
292-
293248 /**
294249 * Import extension from file
295- *
250+ *
296251 * @param string $file path to t3x file
297252 * @param string $location where to import the extension. S = typo3/sysext, G = typo3/ext, L = typo3conf/ext
298253 * @param boolean $overwrite overwrite the extension if it already exists
299254 * @return void
300255 */
301-
302- public function importCommand ($ file , $ location ='L ' , $ overwrite = FALSE ){
303-
256+ public function importCommand ($ file , $ location = 'L ' , $ overwrite = FALSE ) {
304257 try {
305-
306258 /** @var $service Tx_Coreapi_Service_ExtensionApiService */
307259 $ service = $ this ->objectManager ->get ('Tx_Coreapi_Service_ExtensionApiService ' );
308- $ data = $ service ->importExtension ($ file ,$ location ,$ overwrite );
260+ $ data = $ service ->importExtension ($ file , $ location , $ overwrite );
309261 $ this ->outputLine (sprintf ('Extension "%s" has been imported! ' , $ data ['extKey ' ]));
310-
262+
311263 } catch (Exception $ e ) {
312-
313264 $ this ->outputLine ($ e ->getMessage ());
314265 $ this ->quit ();
315-
316266 }
317-
318267 }
319268
320-
321269 /**
322270 * createUploadFoldersCommand
323271 *
@@ -336,7 +284,6 @@ public function createUploadFoldersCommand() {
336284 $ this ->outputLine ('no uploadFolder created ' );
337285 }
338286 }
339-
340287}
341288
342289?>
0 commit comments