Exemple #1
0
 /**
  * Runs index by folder.
  * @param Folder $folder Target folder.
  * @throws \Bitrix\Main\LoaderException
  * @return void
  */
 public function indexFolder(Folder $folder)
 {
     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 = $folder->getStorage();
     if (!$storage) {
         return;
     }
     if (!$storage->getProxyType()->canIndexBySearch()) {
         return;
     }
     $searchData = array('LAST_MODIFIED' => $folder->getUpdateTime() ?: $folder->getCreateTime(), 'TITLE' => $folder->getName(), 'PARAM1' => $folder->getStorageId(), 'PARAM2' => $folder->getParentId(), 'SITE_ID' => $storage->getSiteId() ?: SITE_ID, 'URL' => $this->getDetailUrl($folder), 'PERMISSIONS' => $this->getSimpleRights($folder), 'BODY' => $this->getFolderContent($folder));
     if ($storage->getProxyType() instanceof Group) {
         $searchData['PARAMS'] = array('socnet_group' => $storage->getEntityId(), 'entity' => 'socnet_group');
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     CSearch::index(Driver::INTERNAL_MODULE_ID, $this->getItemId($folder), $searchData, true);
 }
Exemple #2
0
 /**
  * Returns path to list folder.
  * @param Folder $folder Target folder.
  * @return string
  */
 public function getPathFolderList(Folder $folder)
 {
     if ($folder->getStorage()->getRootObjectId() == $folder->getId()) {
         return $folder->getStorage()->getProxyType()->getBaseUrlFolderList();
     }
     $crumbs = implode('/', CrumbStorage::getInstance()->getByObject($folder));
     if ($crumbs) {
         $crumbs .= '/';
     }
     $crumbs .= $folder->getName();
     return $folder->getStorage()->getProxyType()->getBaseUrlFolderList() . $crumbs;
 }