mirror of
https://github.com/Mibew/mibew.git
synced 2025-05-15 16:04:22 +03:00
Add "check for updates" button to "about" page
This commit is contained in:
parent
930ea9a6ac
commit
2fc85b1068
@ -759,6 +759,13 @@ update_run:
|
|||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
|
|
||||||
|
update_check:
|
||||||
|
path: /update/check
|
||||||
|
defaults:
|
||||||
|
_controller: Mibew\Controller\UpdateController::checkUpdatesAction
|
||||||
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
|
|
||||||
## Users (visitors avaiting page)
|
## Users (visitors avaiting page)
|
||||||
users:
|
users:
|
||||||
path: /operator/users
|
path: /operator/users
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
namespace Mibew\Controller;
|
namespace Mibew\Controller;
|
||||||
|
|
||||||
|
use Mibew\Maintenance\UpdateChecker;
|
||||||
use Mibew\Maintenance\Updater;
|
use Mibew\Maintenance\Updater;
|
||||||
use Mibew\Style\PageStyle;
|
use Mibew\Style\PageStyle;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@ -33,6 +34,11 @@ class UpdateController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
protected $updater = null;
|
protected $updater = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var UpdateChecker|null
|
||||||
|
*/
|
||||||
|
protected $updateChecker = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders update intro page.
|
* Renders update intro page.
|
||||||
*
|
*
|
||||||
@ -74,6 +80,26 @@ class UpdateController extends AbstractController
|
|||||||
return $this->render('update_progress', $parameters);
|
return $this->render('update_progress', $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the Update checker.
|
||||||
|
*
|
||||||
|
* @param Request $request Incoming request.
|
||||||
|
* @return Response|string Rendered page contents or Symfony's response
|
||||||
|
* object.
|
||||||
|
*/
|
||||||
|
public function checkUpdatesAction(Request $request)
|
||||||
|
{
|
||||||
|
$checker = $this->getUpdateChecker();
|
||||||
|
$success = $checker->run();
|
||||||
|
if (!$success) {
|
||||||
|
foreach ($checker->getErrors() as $error) {
|
||||||
|
trigger_error('Update checking failed: ' . $error, E_USER_WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect($this->generateUrl('about'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -99,4 +125,18 @@ class UpdateController extends AbstractController
|
|||||||
|
|
||||||
return $this->updater;
|
return $this->updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an instance of Update Checker.
|
||||||
|
*
|
||||||
|
* @return UpdateChecker
|
||||||
|
*/
|
||||||
|
protected function getUpdateChecker()
|
||||||
|
{
|
||||||
|
if (is_null($this->updateChecker)) {
|
||||||
|
$this->updateChecker = new UpdateChecker();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->updateChecker;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
{{#if availableUpdates}}
|
|
||||||
<h2>{{l10n "Available updates"}}</h2>
|
<h2>{{l10n "Available updates"}}</h2>
|
||||||
|
{{#if availableUpdates}}
|
||||||
{{#each availableUpdates}}
|
{{#each availableUpdates}}
|
||||||
<h3>{{title}} ({{version}})</h3>
|
<h3>{{title}} ({{version}})</h3>
|
||||||
{{#if description}}
|
{{#if description}}
|
||||||
@ -47,7 +47,10 @@
|
|||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{else}}
|
||||||
|
There is no available updates.<br/><br/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
<a href="{{route "update_check"}}">{{l10n "Check for available updates"}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-footer">
|
<div class="form-footer">
|
||||||
|
Loading…
Reference in New Issue
Block a user