|
@@ -44,7 +44,7 @@ discard block |
|
|
block discarded – undo |
|
44
|
44
|
|
|
45
|
45
|
$this->userInteractionHandler = $userInteractionHandler; |
|
46
|
46
|
|
|
47
|
|
- $this->date_format = $this->modx->getOption('manager_date_format') .', '. $this->modx->getOption('manager_time_format'); |
|
|
47
|
+ $this->date_format = $this->modx->getOption('manager_date_format').', '.$this->modx->getOption('manager_time_format'); |
|
48
|
48
|
} |
|
49
|
49
|
|
|
50
|
50
|
// Code ideas for MODX packages from: core/model/modx/processors/workspace/packages/getlist.class.php and |
|
@@ -72,7 +72,7 @@ discard block |
|
|
block discarded – undo |
|
72
|
72
|
* @param string $search |
|
73
|
73
|
* @return array |
|
74
|
74
|
*/ |
|
75
|
|
- public function getList($limit=25, $start=0, $search='') { |
|
|
75
|
+ public function getList($limit = 25, $start = 0, $search = '') { |
|
76
|
76
|
$data = [ |
|
77
|
77
|
'limit' => $limit, |
|
78
|
78
|
'packages' => [], |
|
@@ -137,7 +137,7 @@ discard block |
|
|
block discarded – undo |
|
137
|
137
|
* @throws TransportException |
|
138
|
138
|
* @throws TransportNotFoundException |
|
139
|
139
|
*/ |
|
140
|
|
- public function requirePackage($signature, $latest_version=true, $provider_name='modx.com') |
|
|
140
|
+ public function requirePackage($signature, $latest_version = true, $provider_name = 'modx.com') |
|
141
|
141
|
{ |
|
142
|
142
|
// partial signature like fred sent, so is this package installed? |
|
143
|
143
|
$package_info = static::getVersionInfo($signature); |
|
@@ -208,7 +208,7 @@ discard block |
|
|
block discarded – undo |
|
208
|
208
|
* @return bool |
|
209
|
209
|
* @throws TransportException |
|
210
|
210
|
*/ |
|
211
|
|
- public function removePackage($signature, $force=true) |
|
|
211
|
+ public function removePackage($signature, $force = true) |
|
212
|
212
|
{ |
|
213
|
213
|
/** @var modTransportPackage $package */ |
|
214
|
214
|
$package = $this->modx->getObject('transport.modTransportPackage', [ |
|
@@ -246,7 +246,7 @@ discard block |
|
|
block discarded – undo |
|
246
|
246
|
* @return bool |
|
247
|
247
|
* @throws TransportException |
|
248
|
248
|
*/ |
|
249
|
|
- public function unInstallPackage($signature, $preexisting_mode=null) |
|
|
249
|
+ public function unInstallPackage($signature, $preexisting_mode = null) |
|
250
|
250
|
{ |
|
251
|
251
|
/** @var modTransportPackage $package */ |
|
252
|
252
|
$package = $this->modx->getObject('transport.modTransportPackage', [ |
|
@@ -288,7 +288,7 @@ discard block |
|
|
block discarded – undo |
|
288
|
288
|
* @throws TransportNotFoundException |
|
289
|
289
|
* @return bool|modTransportPackage |
|
290
|
290
|
*/ |
|
291
|
|
- protected function downloadPackageFiles($signature, modTransportProvider $provider, $latest=true) |
|
|
291
|
+ protected function downloadPackageFiles($signature, modTransportProvider $provider, $latest = true) |
|
292
|
292
|
{ |
|
293
|
293
|
$transfer_options = []; |
|
294
|
294
|
|
|
@@ -313,7 +313,7 @@ discard block |
|
|
block discarded – undo |
|
313
|
313
|
|
|
314
|
314
|
$this->possible_package_signatures = $provider->find(['query' => $parts['base']]); |
|
315
|
315
|
|
|
316
|
|
- throw new TransportNotFoundException('Failed to download package ' . $signature. |
|
|
316
|
+ throw new TransportNotFoundException('Failed to download package '.$signature. |
|
317
|
317
|
' from the '.$provider->get('name').' transport provider. Verify the signature and provider'); |
|
318
|
318
|
} |
|
319
|
319
|
|
|
@@ -334,7 +334,7 @@ discard block |
|
|
block discarded – undo |
|
334
|
334
|
$this->modx->cacheManager->refresh(); |
|
335
|
335
|
|
|
336
|
336
|
if (!$installed) { |
|
337
|
|
- throw new TransportException('Failed to install package ' . $package->signature); |
|
|
337
|
+ throw new TransportException('Failed to install package '.$package->signature); |
|
338
|
338
|
} |
|
339
|
339
|
|
|
340
|
340
|
$this->userInteractionHandler->tellUser('Extra '.$package->get('signature').' has been installed!', userInteractionHandler::MASSAGE_SUCCESS); |
|
@@ -360,7 +360,7 @@ discard block |
|
|
block discarded – undo |
|
360
|
360
|
$packageArray['updated'] = ''; |
|
361
|
361
|
} |
|
362
|
362
|
|
|
363
|
|
- $packageArray['created']= utf8_encode(date($this->date_format, strtotime($packageArray['created']))); |
|
|
363
|
+ $packageArray['created'] = utf8_encode(date($this->date_format, strtotime($packageArray['created']))); |
|
364
|
364
|
|
|
365
|
365
|
if ($packageArray['installed'] == null || $packageArray['installed'] == '0000-00-00 00:00:00') { |
|
366
|
366
|
$packageArray['installed'] = null; |
|
@@ -380,7 +380,7 @@ discard block |
|
|
block discarded – undo |
|
380
|
380
|
'count' => 0, |
|
381
|
381
|
'versions' => [] |
|
382
|
382
|
]; |
|
383
|
|
- if ($package->get('provider') > 0 && $this->modx->getOption('auto_check_pkg_updates',null,false)) { |
|
|
383
|
+ if ($package->get('provider') > 0 && $this->modx->getOption('auto_check_pkg_updates', null, false)) { |
|
384
|
384
|
$updateCacheKey = 'mgr/providers/updates/'.$package->get('provider').'/'.$package->get('signature'); |
|
385
|
385
|
$updateCacheOptions = array( |
|
386
|
386
|
xPDO::OPT_CACHE_KEY => $this->modx->cacheManager->getOption('cache_packages_key', null, 'packages'), |
|
@@ -459,7 +459,7 @@ discard block |
|
|
block discarded – undo |
|
459
|
459
|
* @param string $name |
|
460
|
460
|
* @return bool|modTransportProvider |
|
461
|
461
|
*/ |
|
462
|
|
- protected function getProvider($name='modx.com') |
|
|
462
|
+ protected function getProvider($name = 'modx.com') |
|
463
|
463
|
{ |
|
464
|
464
|
if (isset($this->provider_map[$name]) && $this->providerCache[$this->provider_map[$name]]) { |
|
465
|
465
|
return $this->providerCache[$this->provider_map[$name]]; |