fix
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?
|
||||
|
||||
use Bitrix\Main\EventManager;
|
||||
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
|
||||
class bx_null extends \CModule
|
||||
{
|
||||
public $sys = [];
|
||||
var $MODULE_GROUP_RIGHTS = 'Y';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$module = [];
|
||||
if(file_exists(__DIR__.'/../.module.json')){
|
||||
$module = json_decode(file_get_contents(__DIR__.'/../.module.json'), true);
|
||||
}
|
||||
|
||||
$this->sys = $module;
|
||||
|
||||
$this->MODULE_ID = $module['id'];
|
||||
$this->MODULE_VERSION = $module['version'];
|
||||
$this->MODULE_VERSION_DATE = $module['date'];
|
||||
|
||||
$langPrefix = strtoupper($module['prefix']);
|
||||
|
||||
$this->PARTNER_NAME = GetMessage("{$langPrefix}_PARTNER_NAME");
|
||||
$this->PARTNER_URI = GetMessage("{$langPrefix}_PARTNER_URI");
|
||||
$this->MODULE_NAME = GetMessage("{$langPrefix}_MODULE_NAME");
|
||||
$this->MODULE_DESCRIPTION = GetMessage("{$langPrefix}_MODULE_DESCRIPTION");
|
||||
}
|
||||
|
||||
|
||||
function DoInstall()
|
||||
{
|
||||
global $DOCUMENT_ROOT, $APPLICATION;
|
||||
|
||||
if(is_array($this->sys['deps'])){
|
||||
foreach ($this->sys['deps'] as $moduleId){
|
||||
if (!\Bitrix\Main\Loader::includeModule($moduleId)) {
|
||||
$APPLICATION->ThrowException("Module {$moduleId} not installed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!CheckVersion(PHP_VERSION, "5.4.0")) {
|
||||
$APPLICATION->ThrowException('Php version required more 5.4.0');
|
||||
return false;
|
||||
}
|
||||
|
||||
RegisterModule($this->MODULE_ID);
|
||||
RegisterModuleDependences("main", "OnPageStart", $this->MODULE_ID);
|
||||
$this->InstallEvents();
|
||||
$this->InstallCatalogExport();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function DoUninstall()
|
||||
{
|
||||
global $DOCUMENT_ROOT, $APPLICATION;
|
||||
UnRegisterModule($this->MODULE_ID);
|
||||
UnRegisterModuleDependences("main", "OnPageStart", $this->MODULE_ID, "", "");
|
||||
$this->UnInstallEvents();
|
||||
$this->UnInstallCatalogExport();
|
||||
return true;
|
||||
}
|
||||
|
||||
function InstallCatalogExport()
|
||||
{
|
||||
if(is_dir(__DIR__."/catalog_export") && \Bitrix\Main\Loader::includeModule('catalog')){
|
||||
CopyDirFiles(__DIR__."/catalog_export", $_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS, true, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function UnInstallCatalogExport()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function InstallEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function UnInstallEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user