Index: pykota/trunk/conf/pykota.conf.sample
===================================================================
--- pykota/trunk/conf/pykota.conf.sample (revision 1147)
+++ pykota/trunk/conf/pykota.conf.sample (revision 1149)
@@ -60,4 +60,14 @@
 #
 storagecaching: No
+
+# Should full job history be disabled ?
+# If unset or set to No, full job history is kept in the database.
+# This will be useful in the future when the report generator
+# will be written.
+# Disabling the job history can be useful with heavily loaded
+# LDAP servers, to not make the LDAP tree grow out of control.
+# Disabling the job history with the PostgreSQL backend works too
+# but it's probably less useful than with LDAP.
+disablehistory: No
 
 # LDAP example, uncomment and adapt it to your own configuration :
Index: pykota/trunk/setup.py
===================================================================
--- pykota/trunk/setup.py (revision 1144)
+++ pykota/trunk/setup.py (revision 1149)
@@ -24,4 +24,9 @@
 #
 # $Log$
+# Revision 1.25  2003/10/08 07:01:19  jalet
+# Job history can be disabled.
+# Some typos in README.
+# More messages in setup script.
+#
 # Revision 1.24  2003/10/07 09:07:27  jalet
 # Character encoding added to please latest version of Python
@@ -163,5 +168,5 @@
             return ACTION_ABORT
     
-if "install" in sys.argv :
+if ("install" in sys.argv) and not ("help" in sys.argv) :
     # checks if Python version is correct, we need >= 2.1
     if not (sys.version > "2.1") :
@@ -268,5 +273,13 @@
                 sys.stderr.write("INSTALLATION ABORTED BECAUSE CONFIGURATION INCOMPLETE.\n")
                 sys.exit(-1)
-        
+                
+        # Say something about caching mechanism and disabling job history
+        sys.stdout.write("You can now activate the database caching mechanism\nwhich is disabled by default.\nIt is especially recommanded with the LDAP backend.\n")
+        sys.stdout.write("You can now disable the preservation of the complete\njob history which is enabled by default.\nIt is probably more useful with the LDAP backend.\n")
+        sys.stdout.write("PLEASE LOOK AT THE SAMPLE CONFIGURATION FILE conf/pykota.conf.sample\n")
+        sys.stdout.write("TO LEARN HOW TO DO\n")
+        dummy = raw_input("Please press ENTER when you have read the message above. ")
+        sys.stdout.write("\n")
+            
     # change files permissions    
     os.chmod("/etc/pykota/pykota.conf", 0644)
@@ -279,5 +292,5 @@
     sys.stdout.write("PLEASE READ DOCUMENTATION IN initscripts/postgresql/ TO LEARN HOW TO DO.\n")
     sys.stdout.write("YOU CAN DO THAT AFTER THE INSTALLATION IS FINISHED, OR PRESS CTRL+C NOW.\n")
-    sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION.\n\n")
+    sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION\nOR IF YOU ARE ALREADY RUNNING VERSION 1.14 OR ABOVE.\n\n")
     dummy = raw_input("Please press ENTER when you have read the message above. ")
     
Index: pykota/trunk/README
===================================================================
--- pykota/trunk/README (revision 1107)
+++ pykota/trunk/README (revision 1149)
@@ -78,5 +78,7 @@
           
         - Complete job history is saved. This will allow more
-          complex reports in the future.
+          complex reports in the future. This can be disabled
+          if preserving the history is of no interest or
+          makes the database grow out of control.
           
         - Price per page and price per job can be defined for  
@@ -298,5 +300,5 @@
 printing quota.
 
-To see printer command usage, you can use :
+To see printer quota usage, you can use :
 
     $ repykota --printer lp
Index: pykota/trunk/pykota/storages/pgstorage.py
===================================================================
--- pykota/trunk/pykota/storages/pgstorage.py (revision 1144)
+++ pykota/trunk/pykota/storages/pgstorage.py (revision 1149)
@@ -22,4 +22,9 @@
 #
 # $Log$
+# Revision 1.19  2003/10/08 07:01:20  jalet
+# Job history can be disabled.
+# Some typos in README.
+# More messages in setup script.
+#
 # Revision 1.18  2003/10/07 09:07:30  jalet
 # Character encoding added to please latest version of Python
@@ -420,8 +425,12 @@
     def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None) :    
         """Adds a job in a printer's history."""
-        if jobsize is not None :
-            self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize) VALUES (%s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize)))
-        else :    
-            self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action)))
+        if (not self.disablehistory) or (not printer.LastJob.Exists) :
+            if jobsize is not None :
+                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize) VALUES (%s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize)))
+            else :    
+                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action)))
+        else :        
+            # here we explicitly want to reset jobsize to NULL if needed
+            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(printer.LastJob.ident)))
             
     def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :
Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1147)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1149)
@@ -22,4 +22,9 @@
 #
 # $Log$
+# Revision 1.33  2003/10/08 07:01:20  jalet
+# Job history can be disabled.
+# Some typos in README.
+# More messages in setup script.
+#
 # Revision 1.32  2003/10/07 14:23:25  jalet
 # More work on cache
@@ -664,5 +669,10 @@
     def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None) :    
         """Adds a job in a printer's history."""
-        uuid = self.genUUID()
+        if (not self.disablehistory) or (not printer.LastJob.Exists) :
+            uuid = self.genUUID()
+            dn = "cn=%s,%s" % (uuid, self.info["jobbase"])
+        else :    
+            uuid = printer.LastJob.ident[3:].split(",")[0]
+            dn = printer.LastJob.ident
         fields = {
                    "objectClass" : ["pykotaObject", "pykotaJob"],
@@ -674,8 +684,13 @@
                    "pykotaAction" : action,
                  }
-        if jobsize is not None :         
+        if (not self.disablehistory) or (not printer.LastJob.Exists) :
+            if jobsize is not None :         
+                fields.update({ "pykotaJobSize" : str(jobsize) })
+            self.doAdd(dn, fields)
+        else :    
+            # here we explicitly want to reset jobsize to 'None' if needed
             fields.update({ "pykotaJobSize" : str(jobsize) })
-        dn = "cn=%s,%s" % (uuid, self.info["jobbase"])
-        self.doAdd(dn, fields)
+            self.doModify(dn, fields)
+            
         if printer.LastJob.Exists :
             fields = {
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 1144)
+++ pykota/trunk/pykota/version.py (revision 1149)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.15alpha7_unofficial"
+__version__ = "1.15alpha8_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 1138)
+++ pykota/trunk/NEWS (revision 1149)
@@ -22,4 +22,11 @@
 PyKota NEWS :
 
+    - 1.15alpha8 :
+    
+        - Job history can be disabled if needed.
+          This feature may be useful for people who use the LDAP
+          backend and don't want their LDAP tree to grow out of
+          control.
+        
     - 1.15alpha7 : 
     
