From 1689b6498720cc147ac37901b0eefb30c15d5c10 Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Wed, 10 Oct 2018 13:48:24 +0200 Subject: [PATCH] Dev: Possible to manually check for updates in the plugin manager --- .../core/plugins/UpdateCheck/UpdateCheck.php | 54 ++++++++++++++----- application/libraries/MenuObjects/Menu.php | 6 +-- .../views/admin/pluginmanager/index.php | 14 +++++ 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/application/core/plugins/UpdateCheck/UpdateCheck.php b/application/core/plugins/UpdateCheck/UpdateCheck.php index 52e396e2a91..d26f3652d0d 100644 --- a/application/core/plugins/UpdateCheck/UpdateCheck.php +++ b/application/core/plugins/UpdateCheck/UpdateCheck.php @@ -88,14 +88,34 @@ public function beforeControllerAction() */ public function beforePluginManagerMenuRender() { + $notificationUpdateUrl = Notification::getUpdateUrl(); $event = $this->event; $event->append( 'extraMenus', - new Menu( - [ - 'href' => '' - ] - ) + [ + new Menu( + [ + 'href' => $this->getCheckUrl(), + 'iconClass' => 'fa fa-refresh', + 'label' => gT('Check updates'), + 'onClick' => << Yii::app()->createUrl( - 'admin/pluginhelper', - array( - 'sa' => 'ajax', - 'plugin' => 'updateCheck', - 'method' => 'checkAll' - ) - ), + 'url' => $this->getCheckUrl(), 'notificationUpdateUrl' => Notification::getUpdateUrl() ]; echo $this->api->renderTwig(__DIR__ . '/views/index.twig', $data); } + /** + * @return string + */ + protected function getCheckUrl() + { + return Yii::app()->createUrl( + 'admin/pluginhelper', + [ + 'sa' => 'ajax', + 'plugin' => 'updateCheck', + 'method' => 'checkAll' + ] + ); + } + /** * @return void */ diff --git a/application/libraries/MenuObjects/Menu.php b/application/libraries/MenuObjects/Menu.php index 3955f2ca8c6..79114cebf52 100644 --- a/application/libraries/MenuObjects/Menu.php +++ b/application/libraries/MenuObjects/Menu.php @@ -34,7 +34,7 @@ class Menu implements MenuInterface /** * @var string */ - protected $onCLick = ""; + protected $onClick = ""; /** * @param array $options - Options for either dropdown menu or plain link @@ -63,7 +63,7 @@ public function __construct($options) } if (isset($options['onClick'])) { - $this->iconClass = $options['onCLick']; + $this->onClick = $options['onClick']; } } @@ -112,6 +112,6 @@ public function getIconClass() */ public function getOnClick() { - return $this->onCLick; + return $this->onClick; } } diff --git a/application/views/admin/pluginmanager/index.php b/application/views/admin/pluginmanager/index.php index 5f14f5b5683..942710b7ad7 100644 --- a/application/views/admin/pluginmanager/index.php +++ b/application/views/admin/pluginmanager/index.php @@ -30,6 +30,20 @@ class='btn btn-default ' */ ?> + + getOnClick()): ?> + onclick='getOnClick(); ?>' + + class='btn btn-default' + > + getIconClass()): ?> +   + + getLabel(); ?> + +