94 lines
2.4 KiB
PHP
94 lines
2.4 KiB
PHP
<?
|
|
|
|
use Bitrix\Main\EventManager;
|
|
|
|
IncludeModuleLangFile(__FILE__);
|
|
|
|
class bx_nullable extends \CModule
|
|
{
|
|
public $module = [];
|
|
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->module = $module;
|
|
|
|
$this->MODULE_ID = $module['id'];
|
|
$this->MODULE_VERSION = $module['version'];
|
|
$this->MODULE_VERSION_DATE = $module['date'];
|
|
|
|
$langPrefix = $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->module['deps'])){
|
|
foreach ($this->module['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;
|
|
}
|
|
} |