On Tue, Dec 1, 2009 at 1:38 PM, Martin Higham <[email protected]> wrote:
> As far as I understand it from the PEAR docs (
> http://pear.php.net/manual/en/package.database.db-dataobject.intro-autobuilding.php
> ) DB_DataObject relies on schema file for its table definitions but you can
> hand code the class instead. This is effectively what I did by adding the
> table() and key() functions to User_username.
> Interestingly the other two plugins that define database tables (OpenID and
> UserFlag) both include table and key functions in the appropriate DataObject
> class definitions.
> I added the following to User_username to get it to work
>     // now define your table structure.
>     // key is column name, value is type
>     function table() {
>         return array(
>             'user_id'     => DB_DATAOBJECT_INT,
>             'username'   => DB_DATAOBJECT_STR,
>             'provider_name'   => DB_DATAOBJECT_STR ,
>             'created'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE +
> DB_DATAOBJECT_TIME,
>         );
>     }
>
>     // now define the keys.
>     function keys() {
>         return array('provider_name', 'username');
>     }
>
Thankyou very much Martin. That did the trick!


> 2009/12/1 Chris Fanning <[email protected]>
>>
>> I don't know if I'm onto something or not.
>>
>> in the file /classes/Memcached_DataObject.php I added this log.
>>
>> function insert()
>> {
>> common_log(LOG_INFO, 'log database: '.$this->_database);
>> common_log(LOG_INFO, 'log table: '.$this->__table);
>>
>>    $result = parent::insert();
>>    return $result;
>> }
>>
>>
>> 2009-12-01 10:41:46 LOG_INFO: log database:
>> 2009-12-01 10:41:46 LOG_INFO: log table: user_username
>> 2009-12-01 10:41:46 LOG_ERR: PEAR error: DB_DataObject Error:
>> insert:No table definition for user_username :
>> 2009-12-01 10:41:46 LOG_ERR: #0
>> PEAR_Error->PEAR_Error(string,integer,integer,string) called at
>> [/usr/share/php/DB/DataObject/Error.php:44]
>>
>> Does that mean that perhaps the database name is missing?
>>
>> I'm stuck. But am learning something about php ;)
>>
>> Chris.
>>
>> On Tue, Dec 1, 2009 at 11:21 AM, Chris Fanning
>> <[email protected]> wrote:
>> > On Mon, Nov 30, 2009 at 2:52 PM, Martin Higham <[email protected]>
>> > wrote:
>> >> I did find that if I added table() and key() functions to User_username
>> >> that
>> >> this fixed the problem.
>> >
>> > Could you please explain this a bit more?
>> > Thanks.
>> > Chris.
>> >
>> >> I don't know enough about how DB_DataObject works to know where it
>> >> expects
>> >> to find the table definition normally. Is there a script that needs to
>> >> be
>> >> run for the plugin database table definition to be created?
>> >> Martin
>> >>
>> >> 2009/11/30 Chris Fanning <[email protected]>
>> >>>
>> >>> On Sat, Nov 28, 2009 at 5:00 PM, Martin Higham <[email protected]>
>> >>> wrote:
>> >>> > Forgot to send this reply to the list
>> >>> >
>> >>> >> Well the table is there, I can see it if I access the db through
>> >>> >> phpadmin
>> >>> >> but I still get the same error
>> >>> >>
>> >>> >>
>> >>> >> 2009/11/27 Christopher Vollick <[email protected]>
>> >>> >>>
>> >>> >>> On 27-Nov-09, at 11:24 AM, Martin Higham wrote:
>> >>> >>>>
>> >>> >>>> User_username::register(object,string,string) is being called
>> >>> >>>> from
>> >>> >>>> the
>> >>> >>>> AuthenticationPlugin supplied as part of StatusNet 0.9.
>> >>> >>>>
>> >>> >>>> I would have expected the StatusNet code base to define any
>> >>> >>>> database
>> >>> >>>> tables it needed, but it may be that I've missed a key part out
>> >>> >>>> from
>> >>> >>>> the
>> >>> >>>> Plugin setup.
>> >>> >>>
>> >>> >>> So it is.
>> >>> >>> The onCheckSchema event of the Authentication plugin should
>> >>> >>> construct
>> >>> >>> that table.
>> >>> >>> For whatever reason, it would seem it didn't for you.
>> >>> >>>
>> >>> >>> Try running scripts/checkschema.php to do it manually.
>> >>> >>
>> >>> >
>> >>>
>> >>> Hi, I'm running into the same issue with the LdapAuthenticationPlugin
>> >>> After a fresh database install the table user_username is not present
>> >>> however it is created with structure (but empty) after I try to login
>> >>> with a user/pass on the ldap server.
>> >>>
>> >>> mysql> describe user_username;
>> >>> +---------------+--------------+------+-----+---------+-------+
>> >>> | Field         | Type         | Null | Key | Default | Extra |
>> >>> +---------------+--------------+------+-----+---------+-------+
>> >>> | provider_name | varchar(255) | NO   | PRI | NULL    |       |
>> >>> | username      | varchar(255) | NO   | PRI | NULL    |       |
>> >>> | user_id       | int(11)      | NO   |     | NULL    |       |
>> >>> | created       | datetime     | NO   |     | NULL    |       |
>> >>> | modified      | timestamp    | YES  |     | NULL    |       |
>> >>> +---------------+--------------+------+-----+---------+-------+
>> >>>
>> >>> The user attributes are taken from the ldap server and are copied into
>> >>> the 'user' table.
>> >>>
>> >>> addPlugin('ldapAuthentication', array(
>> >>>    'provider_name'=>'Example',
>> >>>    'authoritative'=>true,
>> >>>    'autoregistration'=>true,
>> >>>    ....
>> >>>
>> >>> log says:
>> >>> 2009-11-30 12:34:46 LOG_ERR: PEAR error: DB_DataObject Error:
>> >>> insert:No table definition for user_username :
>> >>> 2009-11-30 12:34:46 LOG_ERR: #0
>> >>> PEAR_Error->PEAR_Error(string,integer,integer,string) called at
>> >>> [/usr/share/php/DB/DataObject/Error.php:44]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #1
>> >>>
>> >>>
>> >>> DB_DataObject_Error->DB_DataObject_Error(string,integer,integer,string,NULL)
>> >>> called at [/usr/share/php/PEAR.php:576]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #2
>> >>> PEAR->raiseError(string,integer,NULL,NULL,NULL,string) called at
>> >>> [/usr/share/php/DB/DataObject.php:4144]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #3
>> >>> DB_DataObject->raiseError(string,integer) called at
>> >>> [/usr/share/php/DB/DataObject.php:904]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #4 DB_DataObject->insert() called at
>> >>>
>> >>> [/var/www/statusnet-mainline-9.0.x/classes/Memcached_DataObject.php:69]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #5 Memcached_DataObject->insert() called
>> >>> at
>> >>>
>> >>> [/var/www/statusnet-mainline-9.0.x/plugins/Authentication/User_username.php:40]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #6
>> >>> User_username::register(object,string,string) called at
>> >>>
>> >>>
>> >>> [/var/www/statusnet-mainline-9.0.x/plugins/Authentication/AuthenticationPlugin.php:136]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #7
>> >>> AuthenticationPlugin->onStartCheckPassword(string,string,object)
>> >>> called at []
>> >>> 2009-11-30 12:34:46 LOG_ERR: #8 call_user_func_array(array,array)
>> >>> called at [/var/www/statusnet-mainline-9.0.x/lib/event.php:105]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #9 Event::handle(string,array) called at
>> >>> [/var/www/statusnet-mainline-9.0.x/lib/util.php:123]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #10 common_check_user(string,string)
>> >>> called at [/var/www/statusnet-mainline-9.0.x/actions/login.php:139]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #11 LoginAction->checkLogin() called at
>> >>> [/var/www/statusnet-mainline-9.0.x/actions/login.php:81]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #12 LoginAction->handle(array) called at
>> >>> [/var/www/statusnet-mainline-9.0.x/index.php:297]
>> >>> 2009-11-30 12:34:46 LOG_ERR: #13 main() called at
>> >>> [/var/www/statusnet-mainline-9.0.x/index.php:312]
>> >>>
>> >>>
>> >>> Where should I start looking?
>> >>>
>> >>> Thanks.
>> >>> Chris.
>> >>>
>> >>> >
>> >>> > _______________________________________________
>> >>> > StatusNet-dev mailing list
>> >>> > [email protected]
>> >>> > http://lists.status.net/mailman/listinfo/statusnet-dev
>> >>> >
>> >>
>> >>
>> >
>
>
_______________________________________________
StatusNet-dev mailing list
[email protected]
http://lists.status.net/mailman/listinfo/statusnet-dev

Reply via email to