[Cartoweb-dev] Accounting improvement and standars

Bruno Friedmann bruno at ioda-net.ch
Wed Jun 20 04:12:17 EDT 2007


Yesterday, I'm looking about accounting plugin.

Here's a try to improve a bit the accounting implementation.

As said in doc we can use db as storage place.
So we decide to use a dedicated db for our accounting
Put the line in client_conf

; accounting
accountingOn = true
accountingStorage = db
accountingDsn =
pgsql://@DB_USER@:@DB_PASSWD@@@DB_HOST@:@DB_PORT@/@DB_ACC_NAME@

# You need to place the different variable in your .ini.in ...


My first surprise is why there's not a table param permitting as in the
auth plugin to choose the table name.
In our case, we want a table by project in one db.

So someting like this is usefull
accountingTbl = @TBL_ACC_NAME@

But we more research we found the problem : there's a raw name in
common/Accounting.php

Around line 180

       $dsn = $this->getConfig()->accountingDsn;
+++       $tbl = $this->getConfig()->accountingTbl;
 
And line 193
----            $sql = "INSERT INTO cw_accounting (date, info) VALUES " .
                "(now(), '$accountingPacket')";

+++           $sql = "INSERT INTO ".$tbl." (date, info) VALUES " .
                "(now(), '$accountingPacket')";


With this super simple modification, we can initialize and do accounting
on our table choice.

Hope this so trivial, that you could implement it quickly in svn for
next release.

I've got only a little trouble : the cw3setup.php doesn't replace my
accountingTbl in ini.in during the .ini building process.
Did you have a trick how tho manage successfully this ?

Thanks in advance.

-- 

     Bruno Friedmann  bruno at ioda-net.ch

Ioda-Net Sàrl   - www.ioda-net.ch
  2830 Vellerat - Switzerland
  
  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760

C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com





More information about the Cartoweb-dev mailing list