Skip to content

Commit

Permalink
Merge pull request #172 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Deploying v4.3.0 for 1-click upgrade module
  • Loading branch information
Quetzacoalt91 authored Sep 24, 2018
2 parents 0e679ea + 8ff30b5 commit 184904b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
Provides an automated method to upgrade your shop to the latest version of PrestaShop.
This module is compatible with all PrestaShop 1.6 & 1.7.

# Prerequisites

* PrestaShop 1.6 or 1.7
* PHP 5.6+

# Installation

You must have [composer][4] installed on your computer. Then, execute:
Expand Down
12 changes: 9 additions & 3 deletions autoupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/vendor/autoload.php';

class Autoupgrade extends Module
{
public function __construct()
Expand Down Expand Up @@ -57,6 +55,11 @@ public function __construct()

public function install()
{
if (50600 > PHP_VERSION_ID) {
$this->_errors[] = $this->trans('This version of 1-click upgrade requires PHP 5.6 to work properly. Please upgrade your server configuration.', array(), 'Modules.Autoupgrade.Admin');
return false;
}

if (defined('_PS_HOST_MODE_') && _PS_HOST_MODE_) {
return false;
}
Expand Down Expand Up @@ -198,6 +201,9 @@ private static function _removeDirectory($dir)
*/
public function trans($id, array $parameters = array(), $domain = null, $locale = null)
{
return (new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(get_class()))->trans($id, $parameters, $domain, $locale);
require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/UpgradeTools/Translator.php';

$translator = new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(get_class());
return $translator->trans($id, $parameters, $domain, $locale);
}
}
6 changes: 3 additions & 3 deletions classes/UpgradeTools/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __construct($caller)
public function trans($id, array $parameters = array(), $domain = null, $locale = null)
{
// If PrestaShop core is not instancied properly, do not try to translate
if (!method_exists(\Context::class, 'getContext') || null === \Context::getContext()->language) {
if (!method_exists('\Context', 'getContext') || null === \Context::getContext()->language) {
return $this->applyParameters($id, $parameters);
}

if (method_exists(\Context::class, 'getTranslator')) {
if (method_exists('\Context', 'getTranslator')) {
return \Context::getContext()->getTranslator()->trans($id, $parameters, $domain, $locale);
}

if (method_exists(\Translate::class, 'getModuleTranslation')) {
if (method_exists('\Translate', 'getModuleTranslation')) {
$translated = \Translate::getModuleTranslation('autoupgrade', $id, $this->caller, null);
if (!count($parameters)) {
return $translated;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=5.4",
"php": ">=5.6",
"symfony/filesystem": "~2.8",
"doctrine/collections": "~1.3.0",
"twig/twig": "^1.35",
Expand Down

0 comments on commit 184904b

Please sign in to comment.