Skip to content

Instantly share code, notes, and snippets.

@gartes
Created August 17, 2020 13:10
Show Gist options
  • Save gartes/a3d83098fff297f718e6d340b0e64395 to your computer and use it in GitHub Desktop.
Save gartes/a3d83098fff297f718e6d340b0e64395 to your computer and use it in GitHub Desktop.
1
# Отменить, если устанавливаемый модуль не новее, чем текущая установленная версия
# Abort if the module being installed is not newer than the currently installed version
/* if (strtolower($typeExt) === 'update')
{
$manifest = $this->getItemArray( Factory::getDbo()->quote($this->extension));
$oldRelease = $manifest['version'];
# Кто-то пытается установить более раннюю версию, чем установлена сейчас
# Someone is trying to install a lower version than is currently installed
if (version_compare($this->release, $oldRelease, '<'))
{
# Выдать сообщение об ошибке и вернуть false
# Throw some error message and return false
$this->app->enqueueMessage('Error msg' , 'error' ) ;
return false;
}
# Устанавливаемая версия выше той, которая установлена в настоящее время
# The version being installed is higher than what is currently installed
if (version_compare($oldRelease, $this->release, '<'))
{
# Здесь вы можете выполнить функцию
# You can execute a function here
# Если вы хотите сравнить конкретную версию.
# If you want to compare a specific version.
if (version_compare($oldRelease, '2.0.0', '<='))
{
# Функция обновления для версии 2.0.0
# Update function for version 2.0.0
# $this->updateToVersionTwo();
}
}
}*/
@gartes
Copy link
Author

gartes commented Aug 17, 2020

version_compare - in script.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment