public static function OnBeforeIBlockDelete($id) { $id = (int) $id; $query = CIBlock::GetList(array('ID' => 'ASC'), array('TYPE' => 'library', 'ID' => $id)); if (!$query) { return; } $iblock = $query->fetch(); if (!$iblock) { return; } if (\Bitrix\Disk\Configuration::isSuccessfullyConverted()) { return false; } return; }
public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = "") { $runtime = CBPRuntime::GetRuntime(); if (!is_array($arWorkflowParameters)) { $arWorkflowParameters = array(); } if (!is_array($arWorkflowVariables)) { $arWorkflowVariables = array(); } $documentService = $runtime->GetService("DocumentService"); if (!is_array($arCurrentValues)) { $arCurrentValues = array(); $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); if (is_array($arCurrentActivity["Properties"]) && array_key_exists("Fields", $arCurrentActivity["Properties"]) && is_array($arCurrentActivity["Properties"]["Fields"])) { foreach ($arCurrentActivity["Properties"]["Fields"] as $k => $v) { $arCurrentValues[$k] = $v; if (in_array($k, array("CREATED_BY", "RESPONSIBLE_ID", "ACCOMPLICES", "AUDITORS"))) { if (!is_array($arCurrentValues[$k])) { $arCurrentValues[$k] = array($arCurrentValues[$k]); } $ar = array(); foreach ($arCurrentValues[$k] as $val) { if (intval($val) . "!" == $val . "!") { $val = "user_" . $val; } $ar[] = $val; } $arCurrentValues[$k] = CBPHelper::UsersArrayToString($ar, $arWorkflowTemplate, $documentType); } if ('UF_TASK_WEBDAV_FILES' == $k && is_array($arCurrentValues[$k]) && CModule::IncludeModule("disk") && \Bitrix\Disk\Configuration::isSuccessfullyConverted()) { foreach ($arCurrentValues[$k] as $key => $fileId) { if (!empty($fileId) && is_string($fileId) && substr($fileId, 0, 1) != 'n') { $item = \Bitrix\Disk\Internals\FileTable::getList(array('select' => array('ID'), 'filter' => array('=XML_ID' => $fileId, 'TYPE' => \Bitrix\Disk\Internals\FileTable::TYPE_FILE)))->fetch(); if ($item) { $arCurrentValues[$k][$key] = 'n' . $item['ID']; } } } unset($fileId); } } } $arCurrentValues["HOLD_TO_CLOSE"] = $arCurrentActivity["Properties"]["HoldToClose"] ? "Y" : "N"; $arCurrentValues["AUTO_LINK_TO_CRM_ENTITY"] = $arCurrentActivity["Properties"]["AUTO_LINK_TO_CRM_ENTITY"] ? "Y" : "N"; } else { foreach (static::$arAllowedTasksFieldNames as $field) { if ((!is_array($arCurrentValues[$field]) && strlen($arCurrentValues[$field]) <= 0 || is_array($arCurrentValues[$field]) && count($arCurrentValues[$field]) <= 0) && strlen($arCurrentValues[$field . "_text"]) > 0) { $arCurrentValues[$field] = $arCurrentValues[$field . "_text"]; } } } $arDocumentFields = self::__GetFields(); return $runtime->ExecuteResourceFile(__FILE__, "properties_dialog.php", array("arCurrentValues" => $arCurrentValues, "formName" => $formName, "documentType" => $documentType, "popupWindow" => &$popupWindow, "arDocumentFields" => $arDocumentFields)); }
/** * Returns status of migrate from old webdav * @return bool * @throws \Bitrix\Main\ArgumentNullException */ public static function isSuccessfullyConverted() { return Configuration::isSuccessfullyConverted(); }
/** * Shows component disk.uf.file (edit mode). * @param array &$params Component parameters. * @param array &$result Component results. * @param null $component Component. * @return void */ public function showEdit(&$params, &$result, $component = null) { if (!Configuration::isSuccessfullyConverted()) { return; } global $APPLICATION; $APPLICATION->includeComponent('bitrix:disk.uf.file', $params["MOBILE"] == "Y" ? 'mobile' : '', array('EDIT' => 'Y', 'PARAMS' => $params, 'RESULT' => $result), $component, array("HIDE_ICONS" => "Y")); }
public function run() { if ($this->isStepFinished(__METHOD__)) { return self::STATUS_FINISH; } define('DISK_MIGRATE_MODE', true); $this->checkRequired(); if (\Bitrix\Disk\Configuration::isSuccessfullyConverted()) { return self::STATUS_FINISH; } if (!Option::get('disk', 'process_converted', false)) { try { $this->downDbHelpers(); } catch (Exception $e) { } $this->upDbHelpers(); if ($this->detectMigrationAfterDeletingModule()) { $this->processFinallyActions(); return self::STATUS_FINISH; } $this->registerHandlerToBlockIblock(); Option::set('disk', 'successfully_converted', false); Option::set('disk', 'process_converted', 'Y'); Option::set('webdav', 'successfully_converted', false); Option::set('webdav', 'process_converted', 'Y'); } $this->runResorting(); $this->migrateOptions(); $this->abortIfNeeded(); $this->moveUsers(); $this->abortIfNeeded(); $this->moveGroup(); $this->abortIfNeeded(); $this->moveSections(); $this->abortIfNeeded(); $this->moveNonUniqueSections(); $this->abortIfNeeded(); $this->moveStructureCommonStorages(); $this->abortIfNeeded(); $this->migrateDataCommonStorages(); $this->abortIfNeeded(); $this->moveSpecificXml(); $this->abortIfNeeded(); $this->moveElements(); $this->abortIfNeeded(); $this->setSymbolicLinks(); $this->abortIfNeeded(); $this->moveExternalLinks(); $this->abortIfNeeded(); $this->moveSharings(); $this->abortIfNeeded(); $this->migrateExternalLinks(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->moveWebdavElement(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->migrateWebdavElementInSocnet(); $this->abortIfNeeded(); $this->fillSelfObjectPath(); $this->abortIfNeeded(); $this->fillObjectPath(); $this->abortIfNeeded(); $this->migrateMetaFolders(); $this->abortIfNeeded(); //head self::RUN_STEPS_WITH_MODIFY_DATA && $this->migrateUfHead(); $this->abortIfNeeded(); $this->migrateTrashFiles(); $this->abortIfNeeded(); $this->migrateTrashFolders(); $this->abortIfNeeded(); $this->deleteTrashFolders(); $this->abortIfNeeded(); $this->fillObjectRights(); $this->abortIfNeeded(); $this->deletePairNegativeRights(); $this->abortIfNeeded(); !$this->publishDocs && $this->recalcRightsOnUnPublishObject(); $this->abortIfNeeded(); $this->migrateVersion(); $this->abortIfNeeded(); $this->migrateHeadVersion(); $this->abortIfNeeded(); $this->convertBadNames(); $this->setRealObjectId(); $this->abortIfNeeded(); $this->generateEmptyUserStorages(); $this->abortIfNeeded(); $this->markPendingObjectAsDeleted(); $this->abortIfNeeded(); $this->repairStorageId(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->migrateWebdavElementHistory(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->migrateCrmData(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->migrateSearchData(); $this->abortIfNeeded(); self::RUN_STEPS_WITH_MODIFY_DATA && $this->disableIndexIblocks(); $this->downDbHelpers(); //patch links in public files if (!ModuleManager::isModuleInstalled('bitrix24')) { $extranetSiteId = ModuleManager::isModuleInstalled("extranet") ? Option::get("extranet", "extranet_site") : false; $rsSite = SiteTable::getList(); while ($arSite = $rsSite->Fetch()) { $folder = "company"; if ($extranetSiteId && $arSite["LID"] == $extranetSiteId) { $folder = "contacts"; } $siteDocRoot = strlen($arSite["DOC_ROOT"]) > 0 ? $arSite["DOC_ROOT"] : $_SERVER["DOCUMENT_ROOT"]; $siteDir = strlen($arSite["DIR"]) > 0 ? $arSite["DIR"] : "/"; $filePath = $siteDocRoot . $siteDir . '.left.menu_ext.php'; $fp = fopen($filePath, 'r'); if ($fp !== false && $fp !== null) { $fileContents = fread($fp, filesize($filePath)); fclose($fp); preg_match('/' . $folder . '\\/personal\\/user\\/\\"\\.\\$USER_ID\\.\\"\\/files\\/lib\\//si', $fileContents, $matches); if (!empty($matches[0])) { $fileContentsNew = str_replace($folder . '/personal/user/".$USER_ID."/files/lib/', $folder . '/personal/user/".$USER_ID."/disk/path/', $fileContents); if ($fileContentsNew != $fileContents) { $fp = fopen($filePath, 'w'); fwrite($fp, $fileContentsNew); fclose($fp); } } } } //clean cached inline img (for resize with signature) $cache = new CPHPCache(); $cache->CleanDir("/blog/comment"); $cache->CleanDir("/blog/socnet_post"); $cache->CleanDir("/sonet/log"); } if (defined("BX_COMP_MANAGED_CACHE")) { //clean left menu. global $CACHE_MANAGER; $CACHE_MANAGER->clearByTag('sonet_group'); } $this->processFinallyActions(); $this->setStepFinished(__METHOD__); return self::STATUS_FINISH; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("iblock")) { ShowError(GetMessage("F_NO_MODULE_IBLOCK")); return 0; } elseif (!CModule::IncludeModule("webdav")) { ShowError(GetMessage("F_NO_MODULE_WEBDAV")); return 0; } if (CModule::IncludeModule("disk") && \Bitrix\Disk\Configuration::isSuccessfullyConverted()) { return 0; } $path = dirname(__FILE__); include_once $path . '/functions.php'; $componentPage = 'edit'; /******************************************************************** Input params ********************************************************************/ $arParams["EDIT"] = $arParams["EDIT"] == 'Y' ? $arParams["EDIT"] : 'N'; $arParams["PARAMS"] = is_array($arParams["PARAMS"]) ? $arParams["PARAMS"] : array(); $arParams["RESULT"] = is_array($arParams["RESULT"]) ? $arParams["RESULT"] : array(); $arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]); $arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]); $arParams["PARAMS"]['NAME_TEMPLATE'] = $arParams['NAME_TEMPLATE']; /******************************************************************** /Input params ********************************************************************/ $arResult['UID'] = strtolower($arParams['PARAMS']['arUserField']['ENTITY_ID']) . "_" . $this->randString(6);