本文整理汇总了PHP中CSearch::ReIndexFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::ReIndexFile方法的具体用法?PHP CSearch::ReIndexFile怎么用?PHP CSearch::ReIndexFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::ReIndexFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Reindex
function Reindex($file)
{
$io = self::GetIo();
if (CModule::IncludeModule('search')) {
$path = $file;
if (strpos($file, $this->real_path_full) !== false) {
$path = substr($file, strlen($this->real_path_full) + 1);
}
$path = $io->CombinePath($this->real_path, $path);
$url = $this->base_url . substr($file, strlen($this->real_path_full));
if (strpos(strtolower(PHP_OS), 'win') !== false) {
usleep(1000);
}
// pass thru windows write cache
clearstatcache();
$searchID = CSearch::ReIndexFile(array(SITE_ID, $path));
if (intval($searchID) > 0) {
CSearch::Update($searchID, array('URL' => $url));
}
}
}
示例2: CopyEx
function CopyEx($path_from, $path_to, $bDeleteAfterCopy = false, $bOverride = false)
{
global $APPLICATION, $USER;
CMain::InitPathVars($site_from, $path_from);
$DOC_ROOT_FROM = CSite::GetSiteDocRoot($site_from);
CMain::InitPathVars($site_to, $path_to);
$DOC_ROOT_TO = CSite::GetSiteDocRoot($site_to);
$strWarning = '';
//check: if we copy to the same directory
if (strpos($DOC_ROOT_TO . $path_to . "/", $DOC_ROOT_FROM . $path_from . "/") === 0) {
return GetMessage("FILEMAN_LIB_BAD_FOLDER") . ": \"" . $path_from . "\".\n";
}
$io = CBXVirtualIo::GetInstance();
if ($io->DirectoryExists($DOC_ROOT_FROM . $path_from)) {
// Minimal access - read/listing for copying files
if (!$USER->CanDoFileOperation('fm_view_listing', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FOLDER_READ_DENY") . " \"" . $path_from . "\".\n";
}
if ($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_folder', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY") . " \"" . $path_from . "\".\n";
}
//Check: folder exist or not
$strWarTmp = CFileMan::CreateDir(array($site_to, $path_to));
if (strlen($strWarTmp) > 0) {
return $strWarTmp;
}
$APPLICATION->CopyFileAccessPermission(array($site_from, $path_from), array($site_to, $path_to));
} else {
// If we can write this file
if (!$USER->CanDoFileOperation('fm_create_new_file', array($site_to, $path_to))) {
return GetMessage("FILEMAN_FILEMAN_FILE_WRITE_DENY") . " \"" . $path_to . "\".\n";
}
// If we can't read source-file
if (!$USER->CanDoFileOperation('fm_view_file', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "\".\n";
}
// Copying php or system file without PHP or LPA access
if (!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($Elem["NAME"]) || substr($Elem["NAME"], 0, 1) == "."))) {
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "\".\n";
}
// If we can't move source-file
if ($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_file', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FILE_DEL_DENY") . " \"" . $path_from . "\".\n";
}
//Check if folder already exist and trying to create if not
$p = strrpos($path_to, "/");
$path_to_dir = substr($path_to, 0, $p);
$strWarTmp = CFileMan::CreateDir(array($site_to, $path_to_dir));
if (strlen($strWarTmp) > 0) {
return $strWarTmp;
}
if ($io->FileExists($DOC_ROOT_TO . $path_to) || $io->DirectoryExists($DOC_ROOT_TO . $path_to)) {
if ($bOverride) {
$strWarn = CFileMan::DeleteEx(array($site_to, $path_to));
if ($strWarn != "") {
return $strWarn;
}
} else {
return GetMessage("FILEMAN_FILEMAN_FILE_WITH_NAME") . " \"" . $path_to . "\" " . GetMessage("FILEMAN_FILEMAN_ALREADY_EXISTS") . "!\n";
}
}
$APPLICATION->CopyFileAccessPermission(array($site_from, $path_from), array($site_to, $path_to));
//************************** Quota **************************//
if (COption::GetOptionInt("main", "disk_space") > 0) {
$f = $io->GetFile($DOC_ROOT_FROM . $path_from);
$size = $f->GetFileSize();
$quota = new CDiskQuota();
if (!$quota->checkDiskQuota(array("FILE_SIZE" => $size))) {
return $quota->LAST_ERROR;
}
}
//************************** Quota **************************//
// Copy file
if (DEBUG_FILE_MAN) {
echo "copy(" . $DOC_ROOT_FROM . $path_from . "," . $DOC_ROOT_TO . $path_to . ");<br>";
}
if (!$io->Copy($DOC_ROOT_FROM . $path_from, $DOC_ROOT_TO . $path_to)) {
$strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from), '#PATH_TO#' => htmlspecialcharsex($path_to)));
}
//************************** Quota **************************//
if (COption::GetOptionInt("main", "disk_space") > 0) {
$quota->updateDiskQuota("file", $size, "copy");
}
//************************** Quota **************************//
if (CModule::IncludeModule("search")) {
$site = CSite::GetSiteByFullPath($DOC_ROOT_TO . $path_to);
CSearch::ReIndexFile(array($site_to, $path_to), $site);
}
if ($bDeleteAfterCopy && strlen($strWarning) <= 0) {
// If was command "delete after copy"?
$strWarning .= CFileMan::DeleteFile(array($site_from, $path_from));
}
return $strWarning;
}
// Recursive
$d = $io->GetDirectory($DOC_ROOT_FROM . $path_from);
$arChildren = $d->GetChildren();
foreach ($arChildren as $child) {
$fn = $child->GetName();
if ($child->IsDirectory()) {
//.........这里部分代码省略.........