Re: Re: Liveuser questions

From: Date: Mon, 29 Aug 2005 12:28:26 +0000
Subject: Re: Re: Liveuser questions
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20622@lists.php.net to get a copy of this message
Lukas Smith wrote:
Jeroen Houben wrote:
Sorry, but I have no idea where to start. The documentation, as far as I can see, does not discuss how to setup the initial tables or anything like that.. I would like to start with the medium permission container. Could you point me in the right direction please?
hmm guess i forgot to mention where the install class is installed to in the docs .. there is an install class in the [PEAR]/data/misc/schema/ directory. there is some sample code which is partially commented out at the top. basically its a two step process for both the auth and perm. first generate the schema xml file, second install the schema
Okay it took me a while to get this going. 1) I could not get any proper error infom the var_dump() just returned false. After I realised PEAR::ErrorStack was used, I created a small function that dumps the error, maybe you can include it in the install.php script.. function handleError($err) { var_dump($err); return PEAR_ERRORSTACK_PUSH; } 2) I found out I did not have the MDB2 postgres driver installed - this mechanism of installable drivers is not used in (M)DB, but was easy to overcome :-) 3) I had to add / change entries for "prefix" in the $conf array which now looks like this: $conf = array( 'authContainers' => array(
       array(
           'type'         => 'MDB2',
           'loginTimeout' => 0,
           'expireTime'   => 3600,
           'idleTime'     => 1800,
           'allowDuplicateHandles' => 0,
           'storage' => array(
               'prefix' => 'liveuser.',
               'dsn' => $dsn,
               'alias' => array(
                   'auth_user_id' => 'authUserId',
                   'lastlogin' => 'lastLogin',
                   'is_active' => 'isActive',
                   'owner_user_id' => 'owner_user_id',
                   'owner_group_id' => 'owner_group_id',
               ),
               'fields' => array(
                   'lastlogin' => 'timestamp',
                   'is_active' => 'boolean',
                   'owner_user_id' => 'integer',
                   'owner_group_id' => 'integer',
               ),
               'tables' => array(
                   'users' => array(
                       'fields' => array(
                           'lastlogin' => false,
                           'is_active' => false,
                           'owner_user_id' => false,
                           'owner_group_id' => false,
                       ),
                   ),
               ),
           ),
       ),
), 'permContainer' => array(
       'type'  => 'Complex',
       'storage' => array(
           'MDB2' => array('dsn' => $dsn,
           'prefix' => 'liveuser.')
       )
) );* I uncommented the install lines in install.php and everything is install fine in postgresql under the designated schema :-) tables will be names like liveuser.users, liveuser.groups etc - which makes it easer to organise my database. I did get a few notices: Notice: Only variable references should be returned by reference in /usr/local/share/php/pear/MDB2/Driver/pgsql.php on line 586 Also, the schema installation only works if you previously create the target schema: CREATE SCHEMA liveuser; MDB2 does not do it for you. I don't know if the actual permission queries will work too, but I'm pretty confident they will. Regards, Jeroen *

« previous php.pear.general (#20622) next »