From 8acc1587b1cd4f6fc78bbedb88f414cd18efa942 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 25 Nov 2009 13:38:59 -0800 Subject: Revert "Allow plugin DB_DataObject classes to not have to use the .ini file by overriding keys(), table(), and sequenceKey() for them" This reverts commit a373d07ae00b878f47970f2e4a7d86c6ec3a65cf. Conflicts: classes/statusnet.ini lib/schema.php plugins/Authentication/AuthenticationPlugin.php plugins/OpenID/OpenIDPlugin.php plugins/UserFlag/UserFlagPlugin.php --- plugins/Authentication/AuthenticationPlugin.php | 13 +++++++++++-- plugins/Authentication/User_username.php | 22 ++-------------------- plugins/OpenID/OpenIDPlugin.php | 20 ++++++++++++++++++-- plugins/OpenID/User_openid.php | 22 ++-------------------- plugins/OpenID/User_openid_trustroot.php | 20 ++------------------ plugins/UserFlag/UserFlagPlugin.php | 11 ++++++++++- plugins/UserFlag/User_flag_profile.php | 21 ++------------------- 7 files changed, 47 insertions(+), 82 deletions(-) (limited to 'plugins') diff --git a/plugins/Authentication/AuthenticationPlugin.php b/plugins/Authentication/AuthenticationPlugin.php index cd1de1149..a76848b04 100644 --- a/plugins/Authentication/AuthenticationPlugin.php +++ b/plugins/Authentication/AuthenticationPlugin.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * Superclass for plugins that do authentication + * Superclass for plugins that do authentication and/or authorization * * PHP version 5 * @@ -204,7 +204,16 @@ abstract class AuthenticationPlugin extends Plugin function onCheckSchema() { $schema = Schema::get(); - $schema->ensureDataObject('User_username'); + $schema->ensureTable('user_username', + array(new ColumnDef('provider_name', 'varchar', + '255', false, 'PRI'), + new ColumnDef('username', 'varchar', + '255', false, 'PRI'), + new ColumnDef('user_id', 'integer', + null, false), + new ColumnDef('created', 'datetime', + null, false), + new ColumnDef('modified', 'timestamp'))); return true; } diff --git a/plugins/Authentication/User_username.php b/plugins/Authentication/User_username.php index 6826f2681..f30f60d83 100644 --- a/plugins/Authentication/User_username.php +++ b/plugins/Authentication/User_username.php @@ -2,9 +2,9 @@ /** * Table Definition for user_username */ -require_once INSTALLDIR.'/classes/Plugin_DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class User_username extends Plugin_DataObject +class User_username extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -43,22 +43,4 @@ class User_username extends Plugin_DataObject return false; } } - - /** - * Get the TableDef object that represents the table backing this class - * @return TableDef TableDef instance - */ - function tableDef() - { - return new TableDef($this->__table, - array(new ColumnDef('provider_name', 'varchar', - '255', false, 'PRI'), - new ColumnDef('username', 'varchar', - '255', false, 'PRI'), - new ColumnDef('user_id', 'integer', - null, false), - new ColumnDef('created', 'datetime', - null, false), - new ColumnDef('modified', 'timestamp'))); - } } diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php index 6dd8a3f5a..9b0a4cd45 100644 --- a/plugins/OpenID/OpenIDPlugin.php +++ b/plugins/OpenID/OpenIDPlugin.php @@ -281,8 +281,24 @@ class OpenIDPlugin extends Plugin function onCheckSchema() { $schema = Schema::get(); - $schema->ensureDataObject('User_openid'); - $schema->ensureDataObject('User_openid_trustroot'); + $schema->ensureTable('user_openid', + array(new ColumnDef('canonical', 'varchar', + '255', false, 'PRI'), + new ColumnDef('display', 'varchar', + '255', false), + new ColumnDef('user_id', 'integer', + null, false, 'MUL'), + new ColumnDef('created', 'datetime', + null, false), + new ColumnDef('modified', 'timestamp'))); + $schema->ensureTable('user_openid_trustroot', + array(new ColumnDef('trustroot', 'varchar', + '255', false, 'PRI'), + new ColumnDef('user_id', 'integer', + null, false, 'PRI'), + new ColumnDef('created', 'datetime', + null, false), + new ColumnDef('modified', 'timestamp'))); return true; } diff --git a/plugins/OpenID/User_openid.php b/plugins/OpenID/User_openid.php index c3624118e..338e0f6e9 100644 --- a/plugins/OpenID/User_openid.php +++ b/plugins/OpenID/User_openid.php @@ -2,9 +2,9 @@ /** * Table Definition for user_openid */ -require_once INSTALLDIR.'/classes/Plugin_DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class User_openid extends Plugin_DataObject +class User_openid extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -33,22 +33,4 @@ class User_openid extends Plugin_DataObject return ($cnt > 0); } - - /** - * Get the TableDef object that represents the table backing this class - * @return TableDef TableDef instance - */ - function tableDef() - { - return new TableDef($this->__table, - array(new ColumnDef('canonical', 'varchar', - '255', false, 'PRI'), - new ColumnDef('display', 'varchar', - '255', false), - new ColumnDef('user_id', 'integer', - null, false, 'MUL'), - new ColumnDef('created', 'datetime', - null, false), - new ColumnDef('modified', 'timestamp'))); - } } diff --git a/plugins/OpenID/User_openid_trustroot.php b/plugins/OpenID/User_openid_trustroot.php index b208dddfd..4654b72df 100644 --- a/plugins/OpenID/User_openid_trustroot.php +++ b/plugins/OpenID/User_openid_trustroot.php @@ -2,9 +2,9 @@ /** * Table Definition for user_openid_trustroot */ -require_once INSTALLDIR.'/classes/Plugin_DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class User_openid_trustroot extends Plugin_DataObject +class User_openid_trustroot extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -26,20 +26,4 @@ class User_openid_trustroot extends Plugin_DataObject { return Memcached_DataObject::pkeyGet('User_openid_trustroot', $kv); } - - /** - * Get the TableDef object that represents the table backing this class - * @return TableDef TableDef instance - */ - function tableDef() - { - return new TableDef($this->__table, - array(new ColumnDef('trustroot', 'varchar', - '255', false, 'PRI'), - new ColumnDef('user_id', 'integer', - null, false, 'PRI'), - new ColumnDef('created', 'datetime', - null, false), - new ColumnDef('modified', 'timestamp'))); - } } diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php index c276c4b9f..1a3ef3777 100644 --- a/plugins/UserFlag/UserFlagPlugin.php +++ b/plugins/UserFlag/UserFlagPlugin.php @@ -48,7 +48,16 @@ class UserFlagPlugin extends Plugin $schema = Schema::get(); // For storing user-submitted flags on profiles - $schema->ensureDataObject('User_flag_profile'); + + $schema->ensureTable('user_flag_profile', + array(new ColumnDef('profile_id', 'integer', null, + false, 'PRI'), + new ColumnDef('user_id', 'integer', null, + false, 'PRI'), + new ColumnDef('created', 'datetime', null, + false, 'MUL'), + new ColumnDef('cleared', 'datetime', null, + true, 'MUL'))); return true; } diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php index 2fb27912d..30bd4ae68 100644 --- a/plugins/UserFlag/User_flag_profile.php +++ b/plugins/UserFlag/User_flag_profile.php @@ -21,9 +21,9 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/classes/Plugin_DataObject.php'; +require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class User_flag_profile extends Plugin_DataObject +class User_flag_profile extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -65,21 +65,4 @@ class User_flag_profile extends Plugin_DataObject return !empty($ufp); } - - /** - * Get the TableDef object that represents the table backing this class - * @return TableDef TableDef instance - */ - function tableDef() - { - return new TableDef($this->__table, - array(new ColumnDef('profile_id', 'integer', null, - false, 'PRI'), - new ColumnDef('user_id', 'integer', null, - false, 'PRI'), - new ColumnDef('created', 'datetime', null, - false, 'MUL'), - new ColumnDef('cleared', 'datetime', null, - true, 'MUL'))); - } } -- cgit v1.2.3-54-g00ecf