protected function processActionDefault() { $this->arResult = array('FILES' => $this->loadFilesData(), 'UID' => $this->getComponentId()); $driver = \Bitrix\Disk\Driver::getInstance(); $this->arResult['CLOUD_DOCUMENT'] = array(); static $documentHandlerName = null; static $documentHandlerCode = null; static $isLocal = null; if ($documentHandlerName === null) { if (Configuration::canCreateFileByCloud()) { $documentServiceCode = \Bitrix\Disk\UserConfiguration::getDocumentServiceCode(); if (!$documentServiceCode) { $documentServiceCode = 'l'; } if (LocalDocumentController::isLocalService($documentServiceCode)) { $documentHandlerName = LocalDocumentController::getName(); $documentHandlerCode = LocalDocumentController::getCode(); $isLocal = true; } else { $defaultDocumentHandler = \Bitrix\Disk\Driver::getInstance()->getDocumentHandlersManager()->getDefaultServiceForCurrentUser(); if ($defaultDocumentHandler) { $documentHandlerName = $defaultDocumentHandler->getName(); $documentHandlerCode = $defaultDocumentHandler->getCode(); $isLocal = false; } } } } if ($documentHandlerCode) { $this->arResult['CLOUD_DOCUMENT'] = array('DEFAULT_SERVICE' => $documentHandlerCode, 'DEFAULT_SERVICE_LABEL' => $documentHandlerName, 'IS_LOCAL' => $isLocal); $this->arResult['DEFAULT_DOCUMENT_SERVICE_EDIT_NAME'] = $documentHandlerName; $this->arResult['DEFAULT_DOCUMENT_SERVICE_EDIT_CODE'] = $documentHandlerCode; } else { $documentHandlerCode = 'l'; } if ($this->editMode) { $this->arResult['controlName'] = $this->arParams['PARAMS']['arUserField']['FIELD_NAME']; $this->arResult['SHARE_EDIT_ON_OBJECT_UF'] = Configuration::isEnabledDefaultEditInUf(); $urlManager = $driver->getUrlManager(); $this->arResult['CREATE_BLANK_URL'] = $urlManager->getUrlToStartCreateUfFileByService('docx', $documentHandlerCode); $this->arResult['RENAME_FILE_URL'] = $urlManager->getUrlDocumentController('rename', array('document_action' => 'rename')); $this->arResult['UPLOAD_FILE_URL'] = $urlManager->getUrlToUploadUfFile(); //now we show checkbox only if it's create post, etc. $this->arResult['DISK_ATTACHED_OBJECT_ALLOW_EDIT'] = empty($this->arResult['FILES']); $userFieldManager = \Bitrix\Disk\Driver::getInstance()->getUserFieldManager(); $this->arResult['INPUT_NAME_OBJECT_ALLOW_EDIT'] = $userFieldManager->getInputNameForAllowEditByEntityType($this->arParams['PARAMS']['arUserField']['ENTITY_ID']); } foreach (GetModuleEvents("main", $this->arParams['PARAMS']['arUserField']["USER_TYPE_ID"], true) as $arEvent) { if (!ExecuteModuleEventEx($arEvent, array($this->arResult, $this->arParams))) { return; } } if (is_array($this->arParams['PARAMS'])) { $this->arParams = array_merge($this->arParams, $this->arParams['PARAMS']); } $this->includeComponentTemplate($this->editMode ? 'edit' : 'show' . ($this->arParams['INLINE'] == 'Y' ? '_inline' : '')); }
/** * Changes index after rename. * @param File $file Target file. * @throws \Bitrix\Main\LoaderException * @return void */ public function changeName(File $file) { if (!Loader::includeModule('search')) { return; } //here we place configuration by Module (Options). Example, we can deactivate index for big files in Disk. if (!Configuration::allowIndexFiles()) { return; } $detailUrl = Driver::getInstance()->getUrlManager()->getPathFileDetail($file); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ CSearch::changeIndex(Driver::INTERNAL_MODULE_ID, array('TITLE' => $file->getName(), 'URL' => $detailUrl), $this->getItemId($file)); }
/** * Autoconnect, notify. * @param Sharing[] $successSharingByEntity * @param File|Folder|BaseObject $objectToSharing */ protected static function processConnectAndNotify(array $successSharingByEntity, BaseObject $objectToSharing) { $isFolder = $objectToSharing instanceof Folder; if (Configuration::canAutoconnectSharedObjects()) { $urlManager = Driver::getInstance()->getUrlManager(); foreach ($successSharingByEntity as $entity => $sharingModel) { /** @var \Bitrix\Disk\Sharing $sharingModel */ if (!$sharingModel->approve()) { unset($successSharingByEntity[$entity]); } else { if (!$sharingModel->isToUser()) { continue; } $pathInListing = $urlManager->getPathInListing($sharingModel->getLinkObject()) . "#hl-{$sharingModel->getLinkObjectId()}"; $uriToDisconnect = $pathInListing . "!detach"; $message = Loc::getMessage($isFolder ? 'DISK_SHARING_MODEL_AUTOCONNECT_NOTIFY' : 'DISK_SHARING_MODEL_AUTOCONNECT_NOTIFY_FILE', array('#NAME#' => '<a href="' . $pathInListing . '">' . $objectToSharing->getName() . '</a>', '#DESCRIPTION#' => $sharingModel->getDescription(), '#DISCONNECT_LINK#' => '<a href="' . $uriToDisconnect . '">' . Loc::getMessage('DISK_SHARING_MODEL_TEXT_DISCONNECT_LINK') . '</a>')); list($subTag, $tag) = $sharingModel->getNotifyTags(); Driver::getInstance()->sendNotify(substr($sharingModel->getToEntity(), 1), array('FROM_USER_ID' => $sharingModel->getCreatedBy(), 'NOTIFY_EVENT' => 'sharing', 'NOTIFY_TAG' => $tag, 'NOTIFY_SUB_TAG' => $subTag, 'NOTIFY_MESSAGE' => $message, 'NOTIFY_MESSAGE_OUT' => strip_tags($message))); } } } else { $buttons = array(array('TITLE' => Loc::getMessage($isFolder ? 'DISK_SHARING_MODEL_APPROVE_Y' : 'DISK_SHARING_MODEL_APPROVE_Y_FILE'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => Loc::getMessage('DISK_SHARING_MODEL_APPROVE_N_2_DECLINE'), 'VALUE' => 'N', 'TYPE' => 'cancel')); $message = Loc::getMessage($isFolder ? 'DISK_SHARING_MODEL_TEXT_APPROVE_CONFIRM' : 'DISK_SHARING_MODEL_TEXT_APPROVE_CONFIRM_FILE', array('#NAME#' => $objectToSharing->getName())); foreach ($successSharingByEntity as $entity => $sharingModel) { if (!$sharingModel->isToUser()) { continue; } list($subTag, $tag) = $sharingModel->getNotifyTags(); Driver::getInstance()->sendNotify(substr($sharingModel->getToEntity(), 1), array('NOTIFY_BUTTONS' => $buttons, 'NOTIFY_TYPE' => 'IM_NOTIFY_CONFIRM', 'FROM_USER_ID' => $sharingModel->getCreatedBy(), 'NOTIFY_EVENT' => 'sharing', 'NOTIFY_TAG' => $tag, 'NOTIFY_SUB_TAG' => $subTag, 'NOTIFY_MESSAGE' => $message, 'NOTIFY_MESSAGE_OUT' => strip_tags($message))); } } }
', DISK_FILE_VIEW_COPY_INTERNAL_LINK: '<?php echo GetMessageJS("DISK_FILE_VIEW_COPY_INTERNAL_LINK"); ?> ', DISK_FILE_VIEW_EXT_LINK_ON: '<?php echo GetMessageJS("DISK_FILE_VIEW_EXT_LINK_ON"); ?> ', DISK_FILE_VIEW_EXT_LINK_OFF: '<?php echo GetMessageJS("DISK_FILE_VIEW_EXT_LINK_OFF"); ?> ', disk_revision_api: '<?php echo (int) \Bitrix\Disk\Configuration::getRevisionApi(); ?> ', disk_document_service: '<?php echo (string) \Bitrix\Disk\UserConfiguration::getDocumentServiceCode(); ?> ', wd_desktop_disk_is_installed: '<?php echo (bool) \Bitrix\Disk\Desktop::isDesktopDiskInstall(); ?> ' }); </script>
protected function processActionDefault() { $driver = \Bitrix\Disk\Driver::getInstance(); $this->arResult['BUTTONS'] = array(); $securityContext = $this->storage->getCurrentUserSecurityContext(); /** @var Folder $folder */ $folder = $this->getFolder(); if (!$folder) { $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_FOLDER_TOOLBAR_ERROR_COULD_NOT_FIND_OBJECT'), self::ERROR_COULD_NOT_FIND_OBJECT))); $this->includeComponentTemplate(); } $this->arResult['CLOUD_DOCUMENT'] = array(); if ($this->isFolderList() && $folder->canAdd($securityContext)) { $this->arResult['BUTTONS'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_UPLOAD_FILE_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_UPLOAD_FILE_TITLE'), 'LINK' => "javascript:void(0);", 'ICON' => 'element-upload'); if (\Bitrix\Disk\Configuration::canCreateFileByCloud()) { $documentHandlerName = $documentHandlerCode = null; $documentServiceCode = \Bitrix\Disk\UserConfiguration::getDocumentServiceCode(); if (!$documentServiceCode) { $documentServiceCode = 'l'; } if (LocalDocumentController::isLocalService($documentServiceCode)) { $documentHandlerName = LocalDocumentController::getName(); $documentHandlerCode = LocalDocumentController::getCode(); } else { $defaultDocumentHandler = \Bitrix\Disk\Driver::getInstance()->getDocumentHandlersManager()->getDefaultServiceForCurrentUser(); if ($defaultDocumentHandler) { $documentHandlerName = $defaultDocumentHandler->getName(); $documentHandlerCode = $defaultDocumentHandler->getCode(); } } if ($documentHandlerCode) { $urlManager = $driver->getUrlManager(); $this->arResult['CLOUD_DOCUMENT'] = array('DEFAULT_SERVICE' => $documentHandlerCode, 'DEFAULT_SERVICE_LABEL' => $documentHandlerName, 'CREATE_BLANK_FILE_URL' => $urlManager->getUrlToStartCreateUfFileByService('docx', $documentHandlerCode), 'RENAME_BLANK_FILE_URL' => $urlManager->getUrlDocumentController('rename', array('document_action' => 'rename'))); $this->arResult['BUTTONS'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_CREATE_DOC_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_CREATE_DOC_TITLE'), 'LINK' => "javascript:BX.Disk['FolderToolbarClass_{$this->getComponentId()}'].createFile();", 'ICON' => 'docs-add'); } } $this->arResult['BUTTONS'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_CREATE_FOLDER_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_CREATE_FOLDER_TITLE'), 'LINK' => $this->extendedAddFolder ? "javascript:BX.Disk['FolderToolbarClass_{$this->getComponentId()}'].createExtendedFolder();" : "javascript:BX.Disk['FolderToolbarClass_{$this->getComponentId()}'].createFolder();", 'ICON' => 'folder-add'); } if ($this->isTrashCan() && $folder->canRestore($securityContext)) { if (!empty($this->arParams['URL_TO_EMPTY_TRASHCAN'])) { $this->arResult['BUTTONS'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EMPTY_TRASHCAN_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EMPTY_TRASHCAN_TITLE'), 'LINK' => "javascript:BX.Disk['FolderToolbarClass_{$this->getComponentId()}'].emptyTrashCan();", 'ICON' => 'empty-trashcan'); } } $this->arResult['DROPDOWN_FILTER'] = array(); if (!empty($this->arParams['URL_TO_FOLDER_LIST'])) { $this->arResult['DROPDOWN_FILTER'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_FOLDER_LIST_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_FOLDER_LIST_TITLE'), 'HREF' => $this->arParams['URL_TO_FOLDER_LIST']); if ($this->isFolderList()) { $this->arResult['DROPDOWN_FILTER_CURRENT_LABEL'] = Loc::getMessage('DISK_FOLDER_TOOLBAR_FOLDER_LIST_TEXT'); if ($this->arParams['RELATIVE_PATH'] && $folder->getId() != $this->storage->getRootObjectId()) { $relativePath = explode('/', trim($this->arParams['RELATIVE_PATH'], '/')); array_pop($relativePath); if ($relativePath) { $prevPageListing = rtrim(CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => implode('/', $relativePath))), '/'); } else { $prevPageListing = $this->arParams['URL_TO_FOLDER_LIST']; } array_unshift($this->arResult['BUTTONS'], array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TITLE'), 'LINK' => $prevPageListing, 'ICON' => 'back')); } } } if (!empty($this->arParams['PATH_TO_EXTERNAL_LINK_LIST'])) { $this->arResult['DROPDOWN_FILTER'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_TEXT_2'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_TITLE'), 'HREF' => $this->arParams['PATH_TO_EXTERNAL_LINK_LIST']); if ($this->isExternalLinkList()) { $this->arResult['DROPDOWN_FILTER_CURRENT_LABEL'] = Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_TEXT_2'); $this->arResult['BUTTONS'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TITLE'), 'LINK' => $this->arParams['URL_TO_FOLDER_LIST'], 'ICON' => 'back'); } } if (!empty($this->arParams['URL_TO_TRASHCAN_LIST'])) { $this->arResult['DROPDOWN_FILTER'][] = array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_TRASHCAN_TEXT_2'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_TRASHCAN_TITLE'), 'HREF' => $this->arParams['URL_TO_TRASHCAN_LIST']); if ($this->isTrashCan()) { $this->arResult['DROPDOWN_FILTER_CURRENT_LABEL'] = Loc::getMessage('DISK_FOLDER_TOOLBAR_TRASHCAN_TEXT'); array_unshift($this->arResult['BUTTONS'], array('TEXT' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TEXT'), 'TITLE' => Loc::getMessage('DISK_FOLDER_TOOLBAR_EXTERNAL_LINK_LIST_GO_BACK_TITLE'), 'LINK' => $this->arParams['URL_TO_FOLDER_LIST'], 'ICON' => 'back')); } } $this->includeComponentTemplate(); }
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)); }
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; }
/** * Returns status of migrate from old webdav * @return bool * @throws \Bitrix\Main\ArgumentNullException */ public static function isSuccessfullyConverted() { return Configuration::isSuccessfullyConverted(); }
/** * Changes index after rename. * @param BaseObject $object Target file or folder. * @throws \Bitrix\Main\LoaderException * @return void */ public function changeName(BaseObject $object) { if (!Loader::includeModule('search')) { return; } //here we place configuration by Module (Options). Example, we can deactivate index for big files in Disk. if (!Configuration::allowIndexFiles()) { return; } $storage = $object->getStorage(); if (!$storage) { return; } if (!$storage->getProxyType()->canIndexBySearch()) { return; } if ($object instanceof Folder) { $this->indexFolder($object); } elseif ($object instanceof File) { $this->indexFile($object); } }
/** * 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);