restore indexallfilenames==0 function

This commit is contained in:
Jean-Francois Dockes 2010-07-05 15:26:33 +02:00
parent 387b66e165
commit 1b8ce2fc72
3 changed files with 12 additions and 3 deletions

View File

@ -388,6 +388,11 @@ FsIndexer::processone(const std::string &fn, const struct stat *stp,
displayableBytes(stp->st_size).c_str(), fn.c_str()));
FileInterner interner(fn, stp, m_config, m_tmpdir, FileInterner::FIF_none);
if (!interner.ok()) {
// no indexing whatsoever in this case. This typically means that
// indexallfilenames is not set
return FsTreeWalker::FtwOk;
}
// File name transcoded to utf8 for indexation.
string charset = m_config->getDefCharset(true);

View File

@ -172,7 +172,7 @@ void FileInterner::tmpcleanup()
FileInterner::FileInterner(const string &f, const struct stat *stp,
RclConfig *cnf,
const string& td, int flags, const string *imime)
: m_tdir(td)
: m_tdir(td), m_ok(false)
{
initcommon(cnf, flags);
init(f, stp, cnf, td, flags, imime);
@ -282,12 +282,13 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
m_handlers.push_back(df);
LOGDEB(("FileInterner::FileInterner: %s [%s]\n", l_mime.c_str(),
m_fn.c_str()));
m_ok = true;
}
// Setup from memory data (ie: out of the web cache). imime needs to be set.
FileInterner::FileInterner(const string &data, RclConfig *cnf,
const string& td, int flags, const string& imime)
: m_tdir(td)
: m_tdir(td), m_ok(false)
{
initcommon(cnf, flags);
init(data, cnf, td, flags, imime);
@ -338,6 +339,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
return;
}
m_handlers.push_back(df);
m_ok = true;
}
void FileInterner::initcommon(RclConfig *cnf, int flags)
@ -353,7 +355,7 @@ void FileInterner::initcommon(RclConfig *cnf, int flags)
FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
const string& td, int flags)
: m_tdir(td)
: m_tdir(td), m_ok(false)
{
LOGDEB(("FileInterner::FileInterner(idoc)\n"));
initcommon(cnf, flags);

View File

@ -159,6 +159,7 @@ class FileInterner {
const string& getReason() const {return m_reason;}
static void getMissingExternal(string& missing);
static void getMissingDescription(string& desc);
bool ok() {return m_ok;}
private:
static const unsigned int MAXHANDLERS = 20;
@ -172,6 +173,7 @@ class FileInterner {
// m_tdir and m_tfile are used only for decompressing input file if needed
const string& m_tdir;
string m_tfile;
bool m_ok; // Set after construction if ok
#ifdef RCL_USE_XATTR
// Fields found in file extended attributes. This is kept here,
// not in the file-level handler because we are only interested in