本文整理汇总了PHP中CSearch类的典型用法代码示例。如果您正苦于以下问题:PHP CSearch类的具体用法?PHP CSearch怎么用?PHP CSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSearch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!Loader::includeModule('search')) {
throw new BitrixException('Search module is not installed');
}
$searchResult = array();
$bar = new ProgressBar($output, 0);
do {
$bar->display();
$searchResult = \CSearch::ReIndexAll($input->getOption('full'), static::UPDATE_TIME, $searchResult);
$bar->advance();
$bar->clear();
if (is_array($searchResult) && $searchResult['MODULE'] == 'main') {
list(, $path) = explode("|", $searchResult["ID"], 2);
$output->writeln("\r " . $path, OutputInterface::VERBOSITY_VERBOSE);
}
} while (is_array($searchResult));
$bar->finish();
$bar->clear();
$output->write("\r");
if (ModuleManager::isModuleInstalled('socialnetwork')) {
$output->writeln('<info>The Social Network module needs to be reindexed using the Social Network component in the public section of site.</info>');
}
$output->writeln(sprintf('<info>Reindexed</info> %d element%s.', $searchResult, $searchResult > 1 ? 's' : ''));
return 0;
}
示例2: BXDeleteFromSystem
function BXDeleteFromSystem($absoluteFilePath, $path, $site)
{
$io = CBXVirtualIo::GetInstance();
$f = $io->GetFile($absoluteFilePath);
$f->MarkWritable();
if (COption::GetOptionInt("main", "disk_space") > 0) {
$file_size = $f->GetFileSize();
$quota = new CDiskQuota();
$quota->UpdateDiskQuota("file", $file_size, "delete");
}
$sucess = $io->Delete($absoluteFilePath);
if (!$sucess) {
return false;
}
if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
$res_log['path'] = substr($path, 1);
CEventLog::Log("content", "PAGE_DELETE", "main", "", serialize($res_log));
}
$GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array($site, $path));
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("main", $site . "|" . $path);
}
//Delete from rewrite rule
CUrlRewriter::Delete(array("SITE_ID" => $site, "PATH" => $path));
if (class_exists("\\Bitrix\\Main\\Application", false)) {
\Bitrix\Main\Component\ParametersTable::deleteByFilter(array("SITE_ID" => $site, "REAL_PATH" => $path));
}
return true;
}
示例3: __prepareText
function __prepareText($text)
{
$res = array();
if ($this->bSearch) {
$res = stemming(CSearch::KillTags($text), $this->__lang);
} else {
$res = array();
}
return $res;
}
示例4: searchTitle
public function searchTitle($phrase = "", $nTopCount = 5, $arParams = array(), $bNotFilter = false, $order = "")
{
$DB = CDatabase::GetModuleConnection('search');
$bOrderByRank = $order == "rank";
$sqlHaving = array();
$sqlWords = array();
if (!empty($this->_arPhrase)) {
$last = true;
foreach (array_reverse($this->_arPhrase, true) as $word => $pos) {
if ($last && !preg_match("/[\\n\\r \\t]\$/", $phrase)) {
$last = false;
if (strlen($word) >= $this->minLength) {
$s = $sqlWords[] = "ct.WORD like '" . $DB->ForSQL($word) . "%'";
} else {
$s = "";
}
} else {
$s = $sqlWords[] = "ct.WORD = '" . $DB->ForSQL($word) . "'";
}
if ($s) {
$sqlHaving[] = "(sum(" . $s . ") > 0)";
}
}
}
if (!empty($sqlWords)) {
$bIncSites = false;
$strSqlWhere = CSearch::__PrepareFilter($arParams, $bIncSites);
if ($bNotFilter) {
if (!empty($strSqlWhere)) {
$strSqlWhere = "NOT (" . $strSqlWhere . ")";
} else {
$strSqlWhere = "1=0";
}
}
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tsc.ID\n\t\t\t\t\t,sc.MODULE_ID\n\t\t\t\t\t,sc.ITEM_ID\n\t\t\t\t\t,sc.TITLE\n\t\t\t\t\t,sc.PARAM1\n\t\t\t\t\t,sc.PARAM2\n\t\t\t\t\t,sc.DATE_CHANGE\n\t\t\t\t\t,L.DIR\n\t\t\t\t\t,L.SERVER_NAME\n\t\t\t\t\t,sc.URL as URL\n\t\t\t\t\t,scsite.URL as SITE_URL\n\t\t\t\t\t,scsite.SITE_ID\n\t\t\t\t\t,if(locate('" . $DB->ForSQL(ToUpper($phrase)) . "', upper(sc.TITLE)) > 0, 1, 0) RANK1\n\t\t\t\t\t,count(1) RANK2\n\t\t\t\t\t,min(ct.POS) RANK3\n\t\t\t\tFROM\n\t\t\t\t\tb_search_content_title ct\n\t\t\t\t\tINNER JOIN b_lang L ON ct.SITE_ID = L.LID\n\t\t\t\t\tinner join b_search_content sc on sc.ID = ct.SEARCH_CONTENT_ID\n\t\t\t\t\tINNER JOIN b_search_content_site scsite ON sc.ID = scsite.SEARCH_CONTENT_ID and ct.SITE_ID = scsite.SITE_ID\n\t\t\t\tWHERE\n\t\t\t\t\t" . CSearch::CheckPermissions("sc.ID") . "\n\t\t\t\t\tAND ct.SITE_ID = '" . SITE_ID . "'\n\t\t\t\t\tAND (" . implode(" OR ", $sqlWords) . ")\n\t\t\t\t\t" . (!empty($strSqlWhere) ? "AND " . $strSqlWhere : "") . "\n\t\t\t\tGROUP BY\n\t\t\t\t\tID, MODULE_ID, ITEM_ID, TITLE, PARAM1, PARAM2, DATE_CHANGE, DIR, SERVER_NAME, URL, SITE_URL, SITE_ID\n\t\t\t\t" . (count($sqlHaving) > 1 ? "HAVING " . implode(" AND ", $sqlHaving) : "") . "\n\t\t\t\tORDER BY " . ($bOrderByRank ? "RANK1 DESC, RANK2 DESC, RANK3 ASC, TITLE" : "DATE_CHANGE DESC, RANK1 DESC, RANK2 DESC, RANK3 ASC, TITLE") . "\n\t\t\t\tLIMIT 0, " . ($nTopCount + 1) . "\n\t\t\t";
$r = $DB->Query($strSql);
parent::CDBResult($r);
return true;
} else {
return false;
}
}
示例5: array
$arResult["order"]["active"] = "date";
$aSort = array("DATE_CHANGE" => "DESC");
} elseif ($_REQUEST["order"] == "topic") {
$arResult["order"]["active"] = "topic";
$aSort = array("PARAM2" => "DESC", "DATE_CHANGE" => "ASC");
}
$arFilter1 = array("MODULE_ID" => "forum", "SITE_ID" => SITE_ID, "QUERY" => $q, "TAGS" => $_REQUEST["tags"] ? $_REQUEST["tags"] : "");
if (intVal($_REQUEST["DATE_CHANGE"]) > 0) {
$arFilter1["DATE_CHANGE"] = Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANGUAGE_ID)), time() - intVal($_REQUEST["DATE_CHANGE"]) * 24 * 3600 + CTimeZone::GetOffset());
}
$arFilter2 = array();
if (!empty($arParams["FID_RANGE"]) || !empty($arParams["FID"])) {
$arFilter2["PARAM1"] = empty($arParams["FID_RANGE"]) ? array() : array_keys($arResult["FORUMS"]);
$arFilter2["PARAM1"] = empty($arParams["FID"]) ? $arFilter2["PARAM1"] : $arParams["FID"];
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter1, $aSort, array($arFilter2));
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
$obSearch->NavStart($arParams["TOPICS_PER_PAGE"], false);
$obSearch->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$arResult["NAV_RESULT"] = $obSearch;
$arResult["NAV_STRING"] = $obSearch->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arResult["EMPTY"] = "Y";
$topics = array();
if ($res = $obSearch->GetNext()) {
$arResult["order"]["~relevance"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : ""), array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~topic"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=topic", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
示例6: StemIndex
function StemIndex($arLID, $ID, $sContent)
{
$DB = CDatabase::GetModuleConnection('search');
static $CACHE_SITE_LANGS = array();
$ID = intval($ID);
$arLang = array();
if (!is_array($arLID)) {
$arLID = array();
}
foreach ($arLID as $site => $url) {
if (!array_key_exists($site, $CACHE_SITE_LANGS)) {
$db_site_tmp = CSite::GetByID($site);
if ($ar_site_tmp = $db_site_tmp->Fetch()) {
$CACHE_SITE_LANGS[$site] = array("LANGUAGE_ID" => $ar_site_tmp["LANGUAGE_ID"], "CHARSET" => $ar_site_tmp["CHARSET"], "SERVER_NAME" => $ar_site_tmp["SERVER_NAME"]);
} else {
$CACHE_SITE_LANGS[$site] = false;
}
}
if (is_array($CACHE_SITE_LANGS[$site])) {
$arLang[$CACHE_SITE_LANGS[$site]["LANGUAGE_ID"]] = true;
}
}
foreach ($arLang as $lang => $value) {
$sql_lang = $DB->ForSql($lang);
$arDoc = stemming($sContent, $lang);
$docLength = array_sum($arDoc);
if (BX_SEARCH_VERSION > 1) {
$arPos = stemming($sContent, $lang, false, true);
CSearch::RegisterStem($arDoc);
}
if ($docLength > 0) {
$doc = "";
$logDocLength = log($docLength < 20 ? 20 : $docLength);
$strSqlPrefix = "\n\t\t\t\t\t\tinsert ignore into b_search_content_stem\n\t\t\t\t\t\t(SEARCH_CONTENT_ID, LANGUAGE_ID, STEM, TF" . (BX_SEARCH_VERSION > 1 ? ",PS" : "") . ")\n\t\t\t\t\t\tvalues\n\t\t\t\t";
$maxValuesLen = 2048;
$strSqlValues = "";
if (BX_SEARCH_VERSION > 1) {
foreach ($arDoc as $word => $count) {
$stem_id = CSearch::RegisterStem($word);
//This is almost impossible, but happens
if ($stem_id > 0) {
$strSqlValues .= ",\n(" . $ID . ", '" . $sql_lang . "'" . ", " . CSearch::RegisterStem($word) . ", " . number_format(log($count + 1) / $logDocLength, 4, ".", "") . ", " . number_format($arPos[$word] / $count, 4, ".", "") . ")";
}
if (strlen($strSqlValues) > $maxValuesLen) {
$DB->Query($strSqlPrefix . substr($strSqlValues, 2), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strSqlValues = "";
}
}
} else {
foreach ($arDoc as $word => $count) {
$strSqlValues .= ",\n(" . $ID . ", '" . $sql_lang . "'" . ", '" . $DB->ForSQL($word) . "'" . ", " . number_format(log($count + 1) / $logDocLength, 4, ".", "") . ")";
if (strlen($strSqlValues) > $maxValuesLen) {
$DB->Query($strSqlPrefix . substr($strSqlValues, 2), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strSqlValues = "";
}
}
}
if (strlen($strSqlValues) > 0) {
$DB->Query($strSqlPrefix . substr($strSqlValues, 2), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strSqlValues = "";
}
}
}
}
示例7: IntVal
</font></td>
</tr>
<tr><td colspan="2" align="center" class="forumbody"><font class="forumbodytext">
<input type="submit" name="s" value="Искать">
</font></td></tr>
</table>
</td></tr></table>
</form>
<?php
if (strlen($q) > 0) {
$FORUM_ID = IntVal($_REQUEST["FORUM_ID"]);
if ($FORUM_ID <= 0) {
$FORUM_ID = false;
}
$obSearch = new CSearch($q, SITE_ID, "forum", false, $FORUM_ID);
if ($obSearch->errorno != 0) {
?>
<font class="text">В поисковой фразе обнаружена ошибка:</font>
<?php
echo ShowError($obSearch->error);
?>
<font class="text">Исправьте поисковую фразу и повторите поиск.</font><br><br>
<font class="text">
<b>Синтаксис поискового запроса:</b><br><br>
Обычно запрос представляет из себя просто одно или несколько слов,
например: <br> <i>контактная информация</i><br> По такому запросу будут
найдены страницы, на которых встречаются оба слова запроса. <br><br>
Логические операторы позволяют строить более сложные запросы, например:
<br> <i>контактная информация или телефон</i><br> По такому запросу
示例8: Delete
public static final function Delete($lesson_id)
{
global $USER_FIELD_MANAGER;
list($lesson_id, $simulate, $check_permissions, $user_id) = self::_funcDelete_ParseOptions($lesson_id);
if ($check_permissions) {
$oAccess = CLearnAccess::GetInstance($user_id);
if (!$oAccess->IsLessonAccessible($lesson_id, CLearnAccess::OP_LESSON_REMOVE)) {
throw new LearnException('EA_ACCESS_DENIED', LearnException::EXC_ERR_ALL_ACCESS_DENIED);
}
}
// Parents and childs of the lesson
$arNeighboursEdges = self::ListImmediateNeighbours($lesson_id);
// precache rights for lesson
if ($check_permissions) {
$IsLessonAccessibleFor_OP_LESSON_UNLINK_DESCENDANTS = $oAccess->IsLessonAccessible($lesson_id, CLearnAccess::OP_LESSON_UNLINK_DESCENDANTS);
$IsLessonAccessibleFor_OP_LESSON_UNLINK_FROM_PARENTS = $oAccess->IsLessonAccessible($lesson_id, CLearnAccess::OP_LESSON_UNLINK_FROM_PARENTS);
}
foreach (GetModuleEvents('learning', 'OnBeforeLessonDelete', true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($lesson_id));
}
foreach ($arNeighboursEdges as $arEdge) {
$child_lesson_id = (int) $arEdge['CHILD_LESSON'];
$parent_lesson_id = (int) $arEdge['PARENT_LESSON'];
if ($check_permissions) {
$IsLessonAccessible = false;
if ($child_lesson_id === $lesson_id) {
// if we will be remove edge to parent - use precached rights for OP_LESSON_UNLINK_FROM_PARENTS
$IsLessonAccessible = $IsLessonAccessibleFor_OP_LESSON_UNLINK_FROM_PARENTS && $oAccess->IsLessonAccessible($parent_lesson_id, CLearnAccess::OP_LESSON_UNLINK_DESCENDANTS);
} elseif ($parent_lesson_id === $lesson_id) {
// if we will be remove edge to child - use precached rights for OP_LESSON_UNLINK_DESCENDANTS
$IsLessonAccessible = $IsLessonAccessibleFor_OP_LESSON_UNLINK_DESCENDANTS && $oAccess->IsLessonAccessible($child_lesson_id, CLearnAccess::OP_LESSON_UNLINK_FROM_PARENTS);
} else {
throw new LearnException('EA_FATAL: $lesson_id (' . $lesson_id . ') not equal to one of: $child_lesson_id (' . $child_lesson_id . '), $parent_lesson_id (' . $parent_lesson_id . ')', LearnException::EXC_ERR_ALL_LOGIC | LearnException::EXC_ERR_ALL_GIVEUP);
}
if (!$IsLessonAccessible) {
throw new LearnException('EA_ACCESS_DENIED', LearnException::EXC_ERR_ALL_ACCESS_DENIED);
}
if ($simulate === false) {
self::RelationRemove($parent_lesson_id, $child_lesson_id);
}
}
}
$linkedCourseId = self::GetLinkedCourse($lesson_id);
// If lesson is course, remove course
if ($linkedCourseId !== false) {
global $DB;
if ($simulate === false) {
if (!$DB->Query("DELETE FROM b_learn_course_site WHERE COURSE_ID = " . (int) $linkedCourseId, true)) {
throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);
}
$rc = self::CourseBecomeLesson($linkedCourseId);
// if course cannot be converted to lesson - don't remove lesson
if ($rc === false) {
throw new LearnException('EA_OTHER: lesson is unremovable because linked course is in use.', LearnException::EXC_ERR_LL_UNREMOVABLE_CL);
}
// reload cache of LINKED_LESSON_ID -> COURSE_ID
self::GetCourseToLessonMap_ReloadCache();
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("learning", false, "C" . $linkedCourseId);
CSearch::DeleteIndex("learning", "C" . $linkedCourseId);
}
}
}
// And remove lesson
if ($simulate === false) {
global $DB;
$r = $DB->Query("SELECT PREVIEW_PICTURE, DETAIL_PICTURE \n\t\t\t\tFROM b_learn_lesson \n\t\t\t\tWHERE ID = " . (int) $lesson_id, true);
if ($r === false) {
throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);
}
$arRes = $r->Fetch();
if (!$arRes) {
throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);
}
CFile::Delete($arRes['PREVIEW_PICTURE']);
CFile::Delete($arRes['DETAIL_PICTURE']);
// Remove questions
$q = CLQuestion::GetList(array(), array('LESSON_ID' => $lesson_id));
while ($arQ = $q->Fetch()) {
if (!CLQuestion::Delete($arQ['ID'])) {
throw new LearnException('EA_QUESTION_NOT_REMOVED', LearnException::EXC_ERR_ALL_GIVEUP);
}
}
CLearnGraphNode::Remove($lesson_id);
$USER_FIELD_MANAGER->delete('LEARNING_LESSONS', $lesson_id);
CLearnCacheOfLessonTreeComponent::MarkAsDirty();
CEventLog::add(array('AUDIT_TYPE_ID' => 'LEARNING_REMOVE_ITEM', 'MODULE_ID' => 'learning', 'ITEM_ID' => 'L #' . $lesson_id, 'DESCRIPTION' => 'lesson removed'));
if (CModule::IncludeModule('search')) {
CSearch::DeleteIndex('learning', false, 'L' . $lesson_id);
CSearch::DeleteIndex('learning', 'L' . $lesson_id);
}
}
if ($simulate === false) {
foreach (GetModuleEvents('learning', 'OnAfterLessonDelete', true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($lesson_id));
}
}
}
示例9: unset
$whereFavorisSansCibles["search_auto"] = " LIKE '1'";
$tab_favoris_user_sans_cibles = $favoris_sans_cibles->loadList($whereFavorisSansCibles);
unset($whereFavorisSansCibles["user_id"]);
$function_id = $user->loadRefFunction()->_id;
$whereFavoris["function_id"] = " = '{$function_id}'";
$tab_favoris_function_sans_cibles = $favoris_sans_cibles->loadList($whereFavorisSansCibles);
unset($whereFavorisSansCibles["function_id"]);
$group_id = $user->loadRefFunction()->group_id;
$whereFavorisSansCibles["group_id"] = " = '{$group_id}'";
$tab_favoris_group_sans_cibles = $favoris->loadList($whereFavorisSansCibles);
$tab_favoris += $tab_favoris_user_sans_cibles + $tab_favoris_function_sans_cibles + $tab_favoris_group_sans_cibles;
}
// On effectue la recherche automatique
if (isset($tab_favoris)) {
try {
$search = new CSearch();
$results = $search->searchAuto($tab_favoris, $_ref_object);
} catch (Exception $e) {
CAppUI::displayAjaxMsg("search-not-connected", UI_MSG_ERROR);
mbLog($e->getMessage());
}
}
// Récupération des rss items pour le marquage pmsi (preuves de recherche PMSI)
$rss_items = array();
$items = array();
if ($contexte == "pmsi" && CModule::getActive("atih")) {
$rss = new CRSS();
$rss->sejour_id = $sejour_id;
$rss->loadMatchingObject();
$rss_items = $rss->loadRefsSearchItems();
foreach ($rss_items as $_items) {
示例10: DoUninstall
function DoUninstall()
{
if (!check_bitrix_sessid()) {
return false;
}
$GLOBALS["errors"] = false;
$step = IntVal($_REQUEST["step"]);
if ($step < 2) {
$GLOBALS["APPLICATION"]->IncludeAdminFile(GetMessage("FORUM_DELETE"), $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/install/do_uninstall1.php");
} else {
if ($this->UnInstallDB(array("savedata" => $_REQUEST["savedata"]))) {
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum");
}
$this->UnInstallEvents();
$this->UnInstallFiles();
}
$GLOBALS["CACHE_MANAGER"]->CleanAll();
$GLOBALS["stackCacheManager"]->CleanAll();
$GLOBALS["errors"] = $this->errors;
$GLOBALS["APPLICATION"]->IncludeAdminFile(GetMessage("FORUM_DELETE"), $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/install/do_uninstall2.php");
}
}
示例11: OnUserDelete
function OnUserDelete($ID)
{
if (CModule::IncludeModule('search')) {
CSearch::Index("intranet", "U" . $ID, array("TITLE" => "", "BODY" => ""), true);
}
}
示例12: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
$arSQLErrors = array();
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("iblock");
}
if (!CModule::IncludeModule("iblock")) {
return false;
}
$arSql = $arErr = array();
if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") {
$rsIBlock = CIBlock::GetList(array("ID" => "ASC"), array(), false);
while ($arIBlock = $rsIBlock->Fetch()) {
if ($arIBlock["VERSION"] == 2) {
$arSql[] = "DROP TABLE b_iblock_element_prop_s" . $arIBlock["ID"];
$arSql[] = "DROP TABLE b_iblock_element_prop_m" . $arIBlock["ID"];
if ($DBType == "oracle") {
$arSql[] = "DROP SEQUENCE sq_b_iblock_element_prop_m" . $arIBlock["ID"];
}
}
$GLOBALS["USER_FIELD_MANAGER"]->OnEntityDelete("IBLOCK_" . $arIBlock["ID"] . "._SECTION");
}
foreach ($arSql as $strSql) {
if (!$DB->Query($strSql, true)) {
$arSQLErrors[] = "<hr><pre>Query:\n" . $strSql . "\n\nError:\n<font color=red>" . $DB->db_Error . "</font></pre>";
}
}
$db_res = $DB->Query("SELECT ID FROM b_file WHERE MODULE_ID = 'iblock'");
while ($arRes = $db_res->Fetch()) {
CFile::Delete($arRes["ID"]);
}
$this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/iblock/install/db/" . $DBType . "/uninstall.sql");
$this->UnInstallTasks();
}
if (is_array($this->errors)) {
$arSQLErrors = array_merge($arSQLErrors, $this->errors);
}
if (!empty($arSQLErrors)) {
$this->errors = $arSQLErrors;
$APPLICATION->ThrowException(implode("", $arSQLErrors));
return false;
}
UnRegisterModuleDependences("main", "OnGroupDelete", "iblock", "CIBlock", "OnGroupDelete");
UnRegisterModuleDependences("main", "OnBeforeLangDelete", "iblock", "CIBlock", "OnBeforeLangDelete");
UnRegisterModuleDependences("main", "OnLangDelete", "iblock", "CIBlock", "OnLangDelete");
UnRegisterModuleDependences("main", "OnUserTypeRightsCheck", "iblock", "CIBlockSection", "UserTypeRightsCheck");
UnRegisterModuleDependences("search", "OnReindex", "iblock", "CIBlock", "OnSearchReindex");
UnRegisterModuleDependences("search", "OnSearchGetURL", "iblock", "CIBlock", "OnSearchGetURL");
UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "iblock", "CIBlock", "GetAuditTypes");
UnRegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "iblock", "CEventIBlock", "MakeIBlockObject");
UnRegisterModuleDependences("main", "OnGetRatingContentOwner", "iblock", "CRatingsComponentsIBlock", "OnGetRatingContentOwner");
UnRegisterModuleDependences("main", "OnTaskOperationsChanged", "iblock", "CIBlockRightsStorage", "OnTaskOperationsChanged");
UnRegisterModuleDependences("main", "OnGroupDelete", "iblock", "CIBlockRightsStorage", "OnGroupDelete");
UnRegisterModuleDependences("main", "OnUserDelete", "iblock", "CIBlockRightsStorage", "OnUserDelete");
UnRegisterModuleDependences("perfmon", "OnGetTableSchema", "iblock", "iblock", "OnGetTableSchema");
UnRegisterModuleDependences("sender", "OnConnectorList", "iblock", "\\Bitrix\\Iblock\\SenderEventHandler", "onConnectorListIblock");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_DateTime_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_XmlID_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_FileMan_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_HTML_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_ElementList_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_Sequence_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_ElementAutoComplete_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_SKU_GetUserTypeDescription");
UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "iblock", "CIBlockProperty", "_SectionAutoComplete_GetUserTypeDescription");
UnRegisterModule("iblock");
return true;
}
示例13: UpdateSearch
function UpdateSearch($ID, $bOverWrite = false)
{
if (!CModule::IncludeModule("search")) {
return;
}
global $DB;
$ID = Intval($ID);
static $arGroups = array();
static $arSITE = array();
$strSql = "\n\t\t\tSELECT BS.ID, BS.NAME, BS.DESCRIPTION_TYPE, BS.DESCRIPTION, BS.XML_ID as EXTERNAL_ID,\n\t\t\t\tBS.CODE, BS.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("BS.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.SECTION_PAGE_URL,\n\t\t\t\tB.ACTIVE as ACTIVE1,\n\t\t\t\tBS.GLOBAL_ACTIVE as ACTIVE2,\n\t\t\t\tB.INDEX_SECTION, B.RIGHTS_MODE\n\t\t\tFROM b_iblock_section BS, b_iblock B\n\t\t\tWHERE BS.IBLOCK_ID=B.ID\n\t\t\t\tAND BS.ID=" . $ID;
$dbrIBlockSection = $DB->Query($strSql);
if ($arIBlockSection = $dbrIBlockSection->Fetch()) {
$IBLOCK_ID = $arIBlockSection["IBLOCK_ID"];
$SECTION_URL = "=ID=" . $arIBlockSection["ID"] . "&EXTERNAL_ID=" . $arIBlockSection["EXTERNAL_ID"] . "&IBLOCK_TYPE_ID=" . $arIBlockSection["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlockSection["IBLOCK_ID"] . "&IBLOCK_CODE=" . $arIBlockSection["IBLOCK_CODE"] . "&IBLOCK_EXTERNAL_ID=" . $arIBlockSection["IBLOCK_EXTERNAL_ID"] . "&CODE=" . $arIBlockSection["CODE"];
if ($arIBlockSection["ACTIVE1"] != "Y" || $arIBlockSection["ACTIVE2"] != "Y" || $arIBlockSection["INDEX_SECTION"] != "Y") {
CSearch::DeleteIndex("iblock", "S" . $arIBlockSection["ID"]);
return;
}
if (!array_key_exists($IBLOCK_ID, $arGroups)) {
$arGroups[$IBLOCK_ID] = array();
$strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "ORDER BY GROUP_ID";
$dbrIBlockGroup = $DB->Query($strSql);
while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) {
$arGroups[$IBLOCK_ID][] = $arIBlockGroup["GROUP_ID"];
if ($arIBlockGroup["GROUP_ID"] == 2) {
break;
}
}
}
if (!array_key_exists($IBLOCK_ID, $arSITE)) {
$arSITE[$IBLOCK_ID] = array();
$strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID;
$dbrIBlockSite = $DB->Query($strSql);
while ($arIBlockSite = $dbrIBlockSite->Fetch()) {
$arSITE[$IBLOCK_ID][] = $arIBlockSite["SITE_ID"];
}
}
$BODY = $arIBlockSection["DESCRIPTION_TYPE"] == "html" ? CSearch::KillTags($arIBlockSection["DESCRIPTION"]) : $arIBlockSection["DESCRIPTION"];
$BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("IBLOCK_" . $arIBlockSection["IBLOCK_ID"] . "_SECTION", $arIBlockSection["ID"]);
if ($arIBlockSection["RIGHTS_MODE"] !== "E") {
$arPermissions = $arGroups[$IBLOCK_ID];
} else {
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arIBlockSection["ID"]);
$arPermissions = $obSectionRights->GetGroups(array("section_read"));
}
CSearch::Index("iblock", "S" . $ID, array("LAST_MODIFIED" => $arIBlockSection["LAST_MODIFIED"], "TITLE" => $arIBlockSection["NAME"], "PARAM1" => $arIBlockSection["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $SECTION_URL, "BODY" => $BODY), $bOverWrite);
}
}
示例14: UnInstallDB
function UnInstallDB($arParams = Array())
{
global $DB, $DBType, $APPLICATION;
if(array_key_exists("savedata", $arParams) && $arParams["savedata"] != "Y")
{
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/".$DBType."/uninstall.sql");
if (!empty($errors))
{
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
else
{
$this->UnInstallUserFields();
}
}
if (CModule::IncludeModule("search"))
CSearch::DeleteIndex("blog");
UnRegisterModuleDependences("search", "OnReindex", "blog", "CBlogSearch", "OnSearchReindex");
UnRegisterModuleDependences("main", "OnUserDelete", "blog", "CBlogUser", "Delete");
UnRegisterModuleDependences("main", "OnSiteDelete", "blog", "CBlogSitePath", "DeleteBySiteID");
UnRegisterModuleDependences("socialnetwork", "OnSocNetGroupDelete", "blog", "CBlogSoNetPost", "OnGroupDelete");
UnRegisterModuleDependences("socialnetwork", "OnSocNetFeaturesAdd", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch");
UnRegisterModuleDependences("socialnetwork", "OnSocNetFeaturesUpdate", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch");
UnRegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsAdd", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch");
UnRegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsUpdate", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch");
UnRegisterModuleDependences("main", "OnAfterAddRating", "blog", "CRatingsComponentsBlog", "OnAfterAddRating");
UnRegisterModuleDependences("main", "OnAfterUpdateRating", "blog", "CRatingsComponentsBlog", "OnAfterUpdateRating");
UnRegisterModuleDependences("main", "OnSetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnSetRatingConfigs");
UnRegisterModuleDependences("main", "OnGetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnGetRatingConfigs");
UnRegisterModuleDependences("main", "OnGetRatingsObjects", "blog", "CRatingsComponentsBlog", "OnGetRatingObject");
UnRegisterModuleDependences("main", "OnGetRatingContentOwner", "blog", "CRatingsComponentsBlog", "OnGetRatingContentOwner");
UnRegisterModuleDependences("im", "OnGetNotifySchema", "blog", "CBlogNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences("main", "OnAfterRegisterModule", "main", "blog", "installUserFields", "/modules/blog/install/index.php"); // check UF
UnRegisterModuleDependences('conversion', 'OnGetCounterTypes' , 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onGetCounterTypes');
UnRegisterModuleDependences('conversion', 'OnGetRateTypes' , 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onGetRateTypes');
UnRegisterModuleDependences('blog', 'OnPostAdd', 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onPostAdd');
UnRegisterModule("blog");
return true;
}
示例15: DELETE
function DELETE($options)
{
$io = self::GetIo();
if (isset($options['path'])) {
$options['path'] = $this->_udecode($options['path']);
}
$this->IsDir($options);
if ($this->arParams["not_found"]) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
return "404 Not found";
}
if (!$this->CheckRights("DELETE", true, $options["path"])) {
$this->ThrowAccessDenied();
return "403 Forbidden";
}
$quota = false;
if (COption::GetOptionInt("main", "disk_space") > 0) {
$quota = new CDiskQuota();
}
$trashPath = $this->GetMetaID("TRASH");
$arPath = explode("/", $this->arParams["item_id"]);
if (!$this->arParams["is_dir"]) {
//$file = $io->CombinePath($this->real_path_full, $this->arParams["item_id"]);
//$path = $io->CombinePath($this->real_path, $this->arParams["item_id"]);
$file = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path_full);
$path = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path);
if ($file === false || $path === false) {
return "404 Not found";
}
$arPath = explode("/", $this->arParams["item_id"]);
if ($arPath[1] != $this->meta_names["TRASH"]["name"] && !isset($options['force'])) {
return $this->_move_to_trash($options, $this->arParams);
} else {
// in trash or options[force]
$oFile = $io->GetFile($file);
$file_size = $oFile->GetFileSize();
if ($io->Delete($file)) {
$this->_delete_props($this->arParams['item_id']);
$GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("main", SITE_ID . "|" . $path);
}
if ($quota) {
$quota->updateDiskQuota("file", $file_size, "delete");
}
} else {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
return "404 Not found";
}
}
} else {
if ($arPath[1] != $this->meta_names["TRASH"]["name"] && !isset($options['force'])) {
return $this->_move_to_trash($options, $this->arParams);
} else {
$params = $this->GetFilesAndFolders($this->arParams["item_id"]);
if (empty($params)) {
return true;
}
rsort($params, SORT_STRING);
foreach ($params as $file) {
$path = str_replace($this->real_path_full, "", $file);
$path = $io->CombinePath("/", $path);
$file = $io->CombinePath($this->real_path_full, $path);
if (!$io->ValidatePathString($file)) {
return "404 Not found";
}
if ($io->FileExists($file)) {
//$path = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file);
$oFile = $io->GetFile($file);
$file_size = $oFile->GetFileSize();
if ($io->Delete($file)) {
$this->_delete_props(str_replace(array($this->real_path_full, "///", "//"), "/", $file));
$GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("main", SITE_ID . "|" . $path);
}
if ($quota) {
$quota->updateDiskQuota("file", $file_size, "delete");
}
} else {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
return "404 Not found";
}
} elseif ($io->DirectoryExists($file)) {
$path = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file);
if ($io->Delete($file)) {
$this->_delete_props(str_replace(array($this->real_path_full, "///", "//"), "/", $file));
$GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
} else {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
return "404 Not found";
}
}
}
if ($path == $trashPath) {
$trashID = $this->GetMetaID('TRASH');
}
}
}
clearstatcache();
//.........这里部分代码省略.........