@@ -16,6 +16,10 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\HomeController::defaultAction</default>
|
<default key="_controller">Thelia\Controller\Admin\HomeController::defaultAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.home.view" path="/admin/latest-thelia-version">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\HomeController::getLatestTheliaVersion</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<route id="admin.home.stats" path="/admin/home/stats">
|
<route id="admin.home.stats" path="/admin/home/stats">
|
||||||
<default key="_controller">Thelia\Controller\Admin\HomeController::loadStatsAjaxAction</default>
|
<default key="_controller">Thelia\Controller\Admin\HomeController::loadStatsAjaxAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
|
use Thelia\Core\HttpFoundation\Response;
|
||||||
use Thelia\Core\Security\AccessManager;
|
use Thelia\Core\Security\AccessManager;
|
||||||
use Thelia\Model\CustomerQuery;
|
use Thelia\Model\CustomerQuery;
|
||||||
use Thelia\Model\OrderQuery;
|
use Thelia\Model\OrderQuery;
|
||||||
@@ -39,6 +40,26 @@ class HomeController extends BaseAdminController
|
|||||||
return $this->render('home');
|
return $this->render('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest available Thelia version from the Thelia web site.
|
||||||
|
*
|
||||||
|
* @return Thelia\Core\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function getLatestTheliaVersion()
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||||
|
|
||||||
|
// get the latest version
|
||||||
|
$version = @file_get_contents("http://thelia.net/version.php");
|
||||||
|
|
||||||
|
if ($version === false)
|
||||||
|
$version = $this->getTranslator()->trans("Not found");
|
||||||
|
else if (! preg_match("/^[0-9.]*$/", $version))
|
||||||
|
$version = $this->getTranslator()->trans("Unavailable");
|
||||||
|
|
||||||
|
return Response::create($version);
|
||||||
|
}
|
||||||
|
|
||||||
public function loadStatsAjaxAction()
|
public function loadStatsAjaxAction()
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
|
||||||
|
|||||||
Reference in New Issue
Block a user