function UnInstallDB($arParams = array()) { global $DB, $APPLICATION; CAgent::RemoveModuleAgents('calendar'); $errors = null; if ((true == array_key_exists("savedata", $arParams)) && ($arParams["savedata"] != 'Y')) { $GLOBALS["USER_FIELD_MANAGER"]->OnEntityDelete("CALENDAR_EVENT"); $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/'.$this->MODULE_ID.'/install/db/'.strtolower($DB->type).'/uninstall.sql'); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $this->UnInstallTasks(); } UnRegisterModuleDependences("pull", "OnGetDependentModule", "calendar", "CCalendarPullSchema", "OnGetDependentModule"); UnRegisterModuleDependences("im", "OnGetNotifySchema", "calendar", "CCalendarNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences("im", "OnBeforeConfirmNotify", "calendar", "CCalendar", "HandleImCallback"); UnRegisterModuleDependences('intranet', 'OnPlannerInit', 'calendar', 'CCalendarEventHandlers', 'OnPlannerInit'); UnRegisterModuleDependences('intranet', 'OnPlannerAction', 'calendar', 'CCalendarEventHandlers', 'OnPlannerAction'); UnRegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'calendar', 'CCalendarRestService', 'OnRestServiceBuildDescription'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetFeaturesList', 'calendar', 'CCalendarLiveFeed', 'AddEvent'); UnRegisterModuleDependences('socialnetwork', 'OnSonetLogEntryMenuCreate', 'calendar', 'CCalendarLiveFeed', 'OnSonetLogEntryMenuCreate'); UnRegisterModuleDependences('socialnetwork', 'OnAfterSonetLogEntryAddComment', 'calendar', 'CCalendarLiveFeed', 'OnAfterSonetLogEntryAddComment'); UnRegisterModuleDependences('socialnetwork', 'OnForumCommentIMNotify', 'calendar', 'CCalendarLiveFeed', 'OnForumCommentIMNotify'); UnRegisterModuleDependences('socialnetwork', 'onAfterCommentAddAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentAddAfter'); UnRegisterModuleDependences('socialnetwork', 'onAfterCommentUpdateAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentUpdateAfter'); UnRegisterModuleDependences('search', 'BeforeIndex', 'calendar', 'CCalendarLiveFeed', 'FixForumCommentURL'); UnRegisterModule("calendar"); // Clear cache $arPath = array( 'access_tasks', 'type_list', 'section_list', 'attendees_list', 'event_list' ); $cache = new CPHPCache; foreach($arPath as $path) if ($path != '') $cache->CleanDir("calendar/".$path); // Remove tasks from LiveFeed if ( IsModuleInstalled('socialnetwork') && CModule::IncludeModule('socialnetwork') ) { $dbRes = CSocNetLog::GetList( array(), array("EVENT_ID" => "calendar"), false, false, array("ID") ); if ($dbRes) { while ($arRes = $dbRes->Fetch()) CSocNetLog::Delete($arRes["ID"]); } } // Remove tasks from IM if (IsModuleInstalled('im') && CModule::IncludeModule('im')) { if (method_exists('CIMNotify', 'DeleteByModule')) CIMNotify::DeleteByModule('calendar'); } return true; }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { $rsUserType = CUserTypeEntity::getList(array(), array('ENTITY_ID' => 'TASKS_TASK', 'FIELD_NAME' => 'UF_TASK_WEBDAV_FILES')); if ($arUserType = $rsUserType->fetch()) { $obUserField = new CUserTypeEntity(); $obUserField->Delete($arUserType['ID']); } $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/tasks/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } //delete agents CAgent::RemoveModuleAgents("tasks"); if (CModule::IncludeModule("search")) { CSearch::DeleteIndex("tasks"); } UnRegisterModule("tasks"); UnRegisterModuleDependences("search", "OnReindex", "tasks", "CTasks", "OnSearchReindex"); UnRegisterModuleDependences("main", "OnUserDelete", "tasks", "CTasks", "OnUserDelete"); UnRegisterModuleDependences("im", "OnGetNotifySchema", "tasks", "CTasksNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences('main', 'OnBeforeUserDelete', 'tasks', 'CTasks', 'OnBeforeUserDelete'); UnRegisterModuleDependences("pull", "OnGetDependentModule", "tasks", "CTasksPullSchema", "OnGetDependentModule"); UnRegisterModuleDependences('search', 'BeforeIndex', 'tasks', 'CTasksTools', 'FixForumCommentURL'); UnRegisterModuleDependences('intranet', 'OnPlannerInit', 'tasks', 'CTaskPlannerMaintance', 'OnPlannerInit'); UnRegisterModuleDependences('intranet', 'OnPlannerAction', 'tasks', 'CTaskPlannerMaintance', 'OnPlannerAction'); UnRegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'tasks', 'CTaskRestService', 'OnRestServiceBuildDescription'); UnRegisterModuleDependences('forum', 'OnCommentTopicAdd', 'tasks', 'CTaskComments', 'onCommentTopicAdd'); UnRegisterModuleDependences('forum', 'OnAfterCommentTopicAdd', 'tasks', 'CTaskComments', 'onAfterCommentTopicAdd'); UnRegisterModuleDependences('forum', 'OnAfterCommentAdd', 'tasks', 'CTaskComments', 'onAfterCommentAdd'); UnRegisterModuleDependences('forum', 'OnAfterCommentUpdate', 'tasks', 'CTaskComments', 'onAfterCommentUpdate'); UnRegisterModuleDependences('forum', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onForumUninstall'); UnRegisterModuleDependences('webdav', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onWebdavUninstall'); UnRegisterModuleDependences('intranet', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onIntranetUninstall'); UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'tasks', 'CTaskPlannerMaintance', 'OnAfterTMDayStart'); UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'tasks', 'CTaskCountersNotifier', 'onAfterTimeManagerDayStart'); UnRegisterModuleDependences('timeman', 'OnAfterTMEntryUpdate', 'tasks', 'CTaskTimerManager', 'onAfterTMEntryUpdate'); UnRegisterModuleDependences('tasks', 'OnBeforeTaskUpdate', 'tasks', 'CTaskTimerManager', 'onBeforeTaskUpdate'); UnRegisterModuleDependences('tasks', 'OnBeforeTaskDelete', 'tasks', 'CTaskTimerManager', 'onBeforeTaskDelete'); UnRegisterModuleDependences('socialnetwork', 'OnBeforeSocNetGroupDelete', 'tasks', 'CTasks', 'onBeforeSocNetGroupDelete'); UnRegisterModuleDependences("main", "OnAfterRegisterModule", "main", "tasks", "InstallUserFields", "/modules/tasks/install/index.php"); // check webdav UF UnRegisterModuleDependences("main", "OnBeforeUserTypeAdd", "tasks", "CTasksRarelyTools", "onBeforeUserTypeAdd"); UnRegisterModuleDependences("main", "OnBeforeUserTypeUpdate", "tasks", "CTasksRarelyTools", "onBeforeUserTypeUpdate"); UnRegisterModuleDependences("main", "OnBeforeUserTypeDelete", "tasks", "CTasksRarelyTools", "onBeforeUserTypeDelete"); // im "ilike" UnRegisterModuleDependences("main", "OnGetRatingContentOwner", "tasks", "CTaskNotifications", "OnGetRatingContentOwner"); UnRegisterModuleDependences("im", "OnGetMessageRatingVote", "tasks", "CTaskNotifications", "OnGetMessageRatingVote"); if ((!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") && IsModuleInstalled('socialnetwork') && CModule::IncludeModule('socialnetwork')) { $dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "tasks"), false, false, array("ID")); if ($dbRes) { while ($arRes = $dbRes->Fetch()) { CSocNetLog::Delete($arRes["ID"]); } } } // Remove tasks from IM if (IsModuleInstalled('im') && CModule::IncludeModule('im')) { if (method_exists('CIMNotify', 'DeleteByModule')) { CIMNotify::DeleteByModule('tasks'); } } // remove comment edit flags COption::RemoveOption('tasks', 'task_comment_allow_edit', ''); COption::RemoveOption('tasks', 'task_comment_allow_remove', ''); return true; }