From a564b02d183b366a8485a70b5e6017af08a4296d Mon Sep 17 00:00:00 2001 From: vfilippov Date: Thu, 29 Sep 2011 18:09:16 +0000 Subject: [PATCH] Bug 82651 - Store contents for snippet retrieval in MySQL git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1399 6955db30-a419-402b-8a0d-67ecbb4d7f56 --- conf/viewvc.conf.dist | 2 +- lib/cvsdb.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conf/viewvc.conf.dist b/conf/viewvc.conf.dist index a6cf833a..95ce922e 100644 --- a/conf/viewvc.conf.dist +++ b/conf/viewvc.conf.dist @@ -634,7 +634,7 @@ enabled = 0 # Set to 1 to enable indexing of file contents using Sphinx and Tika index_content = 0 -# Set to limit stored text file content size (4 MB default, 0 = unlimited) +# Set to limit stored text file content size (4 MB default, 0 = unlimited, -1 = don't store content, index only) #content_max_size = 4194304 # Database hostname, port, and socket diff --git a/lib/cvsdb.py b/lib/cvsdb.py index 2c5ac066..d19c4efe 100644 --- a/lib/cvsdb.py +++ b/lib/cvsdb.py @@ -392,10 +392,11 @@ class CheckinDatabase: ) # Sphinx (at least 2.0.1) still caches all string attributes inside RAM, # so we'll store them in MySQL (used only for snippet display) - # Limit content size: - if self.content_max_size and len(content) >= self.content_max_size: - content = content[0:self.content_max_size] - cursor.execute('INSERT INTO contents SET id=%s, content=%s', (commit_id, content)) + if self.content_max_size >= 0: + # Limit content size: + if self.content_max_size != 0 and len(content) >= self.content_max_size: + content = content[0:self.content_max_size] + cursor.execute('INSERT INTO contents SET id=%s, content=%s', (commit_id, content)) except Exception, e: print ("Error adding commit: '"+str(e)+"'\nValues were:\n"+ "\n".join(i+'='+str(props[i]) for i in props))