<?
IncludeModuleLangFile(__FILE__);
include_once $_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/arturgolubev.cssinliner/lib/installation.php';
Class arturgolubev_cssinliner extends CModule
{
const MODULE_ID = 'arturgolubev.cssinliner';
var $MODULE_ID = 'arturgolubev.cssinliner';
var $MODULE_VERSION;
var $MODULE_VERSION_DATE;
var $MODULE_NAME;
var $MODULE_DESCRIPTION;
var $MODULE_CSS;
var $strError = '';
function __construct()
{
$arModuleVersion = array();
include(dirname(__FILE__)."/version.php");
$this->MODULE_VERSION = $arModuleVersion["VERSION"];
$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
$this->MODULE_NAME = GetMessage("arturgolubev.cssinliner_MODULE_NAME");
$this->MODULE_DESCRIPTION = GetMessage("arturgolubev.cssinliner_MODULE_DESC");
$this->PARTNER_NAME = GetMessage("arturgolubev.cssinliner_PARTNER_NAME");
$this->PARTNER_URI = GetMessage("arturgolubev.cssinliner_PARTNER_URI");
}
function InstallDB($arParams = array())
{
RegisterModuleDependences('main', 'OnEpilog', self::MODULE_ID, 'CArturgolubevCssinliner', 'onEpilog', 90);
RegisterModuleDependences('main', 'OnEndBufferContent', self::MODULE_ID, 'CArturgolubevCssinliner', 'onBufferContent', 90);
RegisterModuleDependences('main', 'OnFileDelete', self::MODULE_ID, 'CArturgolubevCssinliner', 'onFileDelete', 110);
RegisterModuleDependences('main', 'OnBeforeLocalRedirect', self::MODULE_ID, 'CArturgolubevCssinliner', 'onBeforeLocalRedirect', 110);
return true;
}
function UnInstallDB($arParams = array())
{
UnRegisterModuleDependences('main', 'OnEpilog', self::MODULE_ID, 'CArturgolubevCssinliner', 'onEpilog');
UnRegisterModuleDependences('main', 'OnEndBufferContent', self::MODULE_ID, 'CArturgolubevCssinliner', 'onBufferContent');
UnRegisterModuleDependences('main', 'OnFileDelete', self::MODULE_ID, 'CArturgolubevCssinliner', 'onFileDelete');
UnRegisterModuleDependences('main', 'OnBeforeLocalRedirect', self::MODULE_ID, 'CArturgolubevCssinliner', 'onBeforeLocalRedirect');
UnRegisterModuleDependences('main', 'OnGetStaticCacheProvider', self::MODULE_ID, '\Arturgolubev\Cssinliner\StaticCacheProvider', 'setCacheName');
return true;
}
function nextUpdateTmp(){
}
function InstallEvents()
{
return true;
}
function UnInstallEvents()
{
return true;
}
function InstallFiles($arParams = array())
{
$mPath = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID;
CopyDirFiles($mPath."/install/js", $_SERVER["DOCUMENT_ROOT"]."/bitrix/js",true,true);
CopyDirFiles($mPath."/install/tools", $_SERVER["DOCUMENT_ROOT"]."/bitrix/tools",true,true);
CopyDirFiles($mPath."/install/gadgets", $_SERVER["DOCUMENT_ROOT"]."/bitrix/gadgets", true, true);
CopyDirFiles($mPath."/install/admin", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin",true,true);
CopyDirFiles($mPath."/install/themes", $_SERVER["DOCUMENT_ROOT"]."/bitrix/themes", true, true);
if(class_exists('agInstaHelperCssinliner')){
$helper = new agInstaHelperCssinliner();
$helper->addGadgetToDesctop("WATCHER");
}
return true;
}
function UnInstallFiles()
{
DeleteDirFilesEx("/bitrix/js/".self::MODULE_ID);
DeleteDirFilesEx("/bitrix/tools/".self::MODULE_ID);
DeleteDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/admin/", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin");
DeleteDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/themes/.default/", $_SERVER["DOCUMENT_ROOT"]."/bitrix/themes/.default");
DeleteDirFilesEx("/bitrix/themes/.default/icons/".$this->MODULE_ID."/");
return true;
}
function DoInstall()
{
$this->InstallFiles();
$this->InstallDB();
RegisterModule(self::MODULE_ID);
if (class_exists('agInstaHelperCssinliner')){
$helper = new agInstaHelperCssinliner();
$helper->IncludeAdminFile(GetMessage("MOD_INST_OK"), "/bitrix/modules/".self::MODULE_ID."/install/success_install.php");
}
}
function DoUninstall()
{
UnRegisterModule(self::MODULE_ID);
$this->UnInstallDB();
$this->UnInstallFiles();
if(is_dir($_SERVER["DOCUMENT_ROOT"].'/upload/cssinliner_webp')){
if (class_exists('agInstaHelperCssinliner')){
$helper = new agInstaHelperCssinliner();
$helper->IncludeAdminFile(GetMessage("MOD_SMP_UNINSTALLED"), "/bitrix/modules/".self::MODULE_ID."/install/success_uninstall.php");
}
}
}
}
?>