Skip to content

Commit

Permalink
- Исправление языковых констант
Browse files Browse the repository at this point in the history
- Добавление проверки расширений PHP
  • Loading branch information
dmitriitux committed May 20, 2019
1 parent 8d89cdd commit de10d78
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
5 changes: 4 additions & 1 deletion language/en-GB/en-GB.pkg_quantummanager.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PKG_QUANTUMMANAGER="Quantum Manager package"
PKG_QUANTUMMANAGER_DESCRIPTION="Package for Quantum Manager"
PKG_QUANTUMMANAGER_DESCRIPTION="Package for Quantum Manager"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_PHP="Required PHP version %s"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_JOOMLA="Required version of Joomla! %s"
PKG_QUANTUMMANAGER_ERROR_EXTENSIONS="PHP libraries required: %s"
5 changes: 4 additions & 1 deletion language/en-GB/en-GB.pkg_quantummanager.sys.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PKG_QUANTUMMANAGER="Quantum Manager package"
PKG_QUANTUMMANAGER_DESCRIPTION="Package for Quantum Manager"
PKG_QUANTUMMANAGER_DESCRIPTION="Package for Quantum Manager"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_PHP="Required PHP version %s"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_JOOMLA="Required version of Joomla! %s"
PKG_QUANTUMMANAGER_ERROR_EXTENSIONS="PHP libraries required: %s"
5 changes: 4 additions & 1 deletion language/ru-RU/ru-RU.pkg_quantummanager.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PKG_QUANTUMMANAGER="Quantum Manager пакет"
PKG_QUANTUMMANAGER_DESCRIPTION="Пакет расширений для Quantum Manager"
PKG_QUANTUMMANAGER_DESCRIPTION="Пакет расширений для Quantum Manager"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_PHP="Необходимая версия PHP %s"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_JOOMLA="Необходимая версия Joomla! %s"
PKG_QUANTUMMANAGER_ERROR_EXTENSIONS="Необходимые библиотеки PHP: %s"
5 changes: 4 additions & 1 deletion language/ru-RU/ru-RU.pkg_quantummanager.sys.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PKG_QUANTUMMANAGER="Quantum Manager пакет"
PKG_QUANTUMMANAGER_DESCRIPTION="Пакет расширений для Quantum Manager"
PKG_QUANTUMMANAGER_DESCRIPTION="Пакет расширений для Quantum Manager"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_PHP="Необходимая версия PHP %s"
PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_JOOMLA="Необходимая версия Joomla! %s"
PKG_QUANTUMMANAGER_ERROR_EXTENSIONS="Необходимые библиотеки PHP: %s"
32 changes: 30 additions & 2 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ class pkg_QuantummanagerInstallerScript
*/
protected $minimumJoomla = '3.9.0';

/**
* Extensions for php
* @var array
*/
protected $extensions = [
'fileinfo'
];

/**
* Method to check compatible.
*
Expand Down Expand Up @@ -82,7 +90,7 @@ protected function checkCompatible()
// Check PHP
if (!(version_compare(PHP_VERSION, $this->minimumPhp) >= 0))
{
$app->enqueueMessage(Text::sprintf('PKG_RIEX_ERROR_COMPATIBLE_PHP', $this->minimumPhp),
$app->enqueueMessage(Text::sprintf('PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_PHP', $this->minimumPhp),
'error');

return false;
Expand All @@ -91,15 +99,33 @@ protected function checkCompatible()
// Check joomla version
if (!$jversion->isCompatible($this->minimumJoomla))
{
$app->enqueueMessage(Text::sprintf('PKG_RIEX_ERROR_COMPATIBLE_JOOMLA', $this->minimumJoomla),
$app->enqueueMessage(Text::sprintf('PKG_QUANTUMMANAGER_ERROR_COMPATIBLE_JOOMLA', $this->minimumJoomla),
'error');

return false;
}

//Check extension
$extensionsNotLoaded = [];
foreach ($this->extensions as $extension)
{
if(!extension_loaded($extension))
{
$extensionsNotLoaded[] = $extension;
}
}

if(count($extensionsNotLoaded))
{
$app->enqueueMessage(Text::sprintf('PKG_QUANTUMMANAGER_ERROR_EXTENSIONS', implode(',', $extensionsNotLoaded)),
'error');
return false;
}

return true;
}


/**
* Method to download remotes.
*
Expand All @@ -125,4 +151,6 @@ protected function downloadRemotes($parent)
}
}
}


}

0 comments on commit de10d78

Please sign in to comment.