start update process
This commit is contained in:
@@ -1122,6 +1122,11 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default>
|
<default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<!-- update routing -->
|
||||||
|
<route id="update.index" path="/admin/update">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\UpdateController::indexAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- The default route, to display a template -->
|
<!-- The default route, to display a template -->
|
||||||
|
|
||||||
<route id="admin.processTemplate" path="/admin/{template}">
|
<route id="admin.processTemplate" path="/admin/{template}">
|
||||||
|
|||||||
71
core/lib/Thelia/Controller/Admin/UpdateController.php
Normal file
71
core/lib/Thelia/Controller/Admin/UpdateController.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Controller\Admin;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
use Thelia\Controller\Admin\BaseAdminController;
|
||||||
|
use Thelia\Core\Security\AccessManager;
|
||||||
|
use Thelia\Core\Security\Resource\AdminResources;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UpdateController
|
||||||
|
* @package Thelia\Controller\Update
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class UpdateController extends BaseAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
const UPDATE_RESOURCE = 'update';
|
||||||
|
|
||||||
|
protected static $version = array(
|
||||||
|
'0' => '2.0.0-beta1',
|
||||||
|
'1' => '2.0.0-beta2',
|
||||||
|
);
|
||||||
|
|
||||||
|
protected function isLatestVersion($version)
|
||||||
|
{
|
||||||
|
$lastEntry = array_pop(self::$version);
|
||||||
|
|
||||||
|
return $lastEntry == $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $this->checkAuth(AdminResources::UPDATE, array(), AccessManager::VIEW)) {
|
||||||
|
throw new NotFoundHttpException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentVersion = ConfigQuery::read('thelia_version');
|
||||||
|
|
||||||
|
if(true === $this->isLatestVersion($currentVersion)) {
|
||||||
|
return $this->render('update-notneeded');
|
||||||
|
} else {
|
||||||
|
return $this->render('update-index', array(
|
||||||
|
'current_version' => $currentVersion
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -103,4 +103,6 @@ final class AdminResources
|
|||||||
const STORE = "admin.configuration.store";
|
const STORE = "admin.configuration.store";
|
||||||
|
|
||||||
const TRANSLATIONS = "admin.configuration.translations";
|
const TRANSLATIONS = "admin.configuration.translations";
|
||||||
|
|
||||||
|
const UPDATE = "admin.update";
|
||||||
}
|
}
|
||||||
|
|||||||
6
templates/backOffice/default/update-notneeded.html
Normal file
6
templates/backOffice/default/update-notneeded.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{extends file="admin-layout.tpl"}
|
||||||
|
|
||||||
|
{block name="page-title"}{intl l='Update'}{/block}
|
||||||
|
|
||||||
|
{block name="check-resource"}update{/block}
|
||||||
|
{block name="check-access"}view{/block}
|
||||||
Reference in New Issue
Block a user