Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions Core/Controller/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,20 @@ private function disableBetaUpdatesAction(): void
*/
private function downloadAction(): void
{
$idItem = $this->request->get('item', '');
$this->updaterItems = self::getUpdateItems();

$idItem = $this->request->query('item', '');
$this->downloadPlugin($idItem);

// ¿Hay que desactivar algo?
$disable = $this->request->query('disable', '');
foreach (explode(',', $disable) as $plugin) {
Plugins::disable($plugin);
}
}

private function downloadPlugin($idItem): void
{
foreach ($this->updaterItems as $key => $item) {
if ($item['id'] != $idItem) {
continue;
Expand All @@ -176,16 +188,19 @@ private function downloadAction(): void
}

Tools::log()->error('download-error', [
'%body%' => $http->body(),
'%body%' => $http->body() . ' - ' . 'Plugin ' . $item['name'],
'%error%' => $http->errorMessage(),
'%status%' => $http->status(),
]);
}
}

// ¿Hay que desactivar algo?
$disable = $this->request->get('disable', '');
foreach (explode(',', $disable) as $plugin) {
Plugins::disable($plugin);
private function downloadAllPluginsAction(): void
{
$this->updaterItems = self::getUpdateItems();

foreach ($this->updaterItems as $updater_item) {
$this->downloadPlugin($updater_item['id']);
}
}

Expand All @@ -208,6 +223,10 @@ protected function execAction(string $action): void
$this->downloadAction();
return;

case 'download-all-plugins':
$this->downloadAllPluginsAction();
break;

case 'post-update':
$this->postUpdateAction();
break;
Expand Down
10 changes: 10 additions & 0 deletions Core/View/Updater.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@
</div>
<div class="row">
<div class="col-sm">
{% set hasUndownloaded = fsc.updaterItems|reduce((carry, item) => carry or not item.downloaded, false) %}
{% if hasUndownloaded %}
<div class="d-flex justify-content-end mb-1">
<a href="{{ fsc.url() }}?action=download-all-plugins"
class="btn btn-spin-action btn-sm btn-secondary"
onclick="animateSpinner('add')">
<i class="fa-solid fa-download fa-fw me-1" aria-hidden="true"></i>{{ trans('download-all-plugins') }}
</a>
</div>
{% endif %}
<div class="card shadow-sm mb-4">
<div class="table-responsive">
<table class="table table-hover mb-0">
Expand Down
Loading