summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po26
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php88
-rw-r--r--plugins/Sample/SamplePlugin.php17
3 files changed, 39 insertions, 92 deletions
diff --git a/plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po b/plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po
deleted file mode 100644
index e9622df88..000000000
--- a/plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po
+++ /dev/null
@@ -1,26 +0,0 @@
-# Translation of StatusNet - CacheLog to Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
-# Expored from translatewiki.net
-#
-# Author: Nghtwlkr
-# --
-# This file is distributed under the same license as the StatusNet package.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: StatusNet - CacheLog\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-10-27 23:43+0000\n"
-"PO-Revision-Date: 2010-10-27 23:46:21+0000\n"
-"Language-Team: Norwegian (bokmål)‬ <http://translatewiki.net/wiki/Portal:no>\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-POT-Import-Date: 2010-10-23 18:57:00+0000\n"
-"X-Generator: MediaWiki 1.17alpha (r75590); Translate extension (2010-09-17)\n"
-"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
-"X-Language-Code: no\n"
-"X-Message-Group: #out-statusnet-plugin-cachelog\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#: CacheLogPlugin.php:106
-msgid "Log reads and writes to the cache."
-msgstr "Logg leser og skriver til hurtiglageret."
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 03fcb71df..4ba0a6c85 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -25,7 +25,8 @@ if (!defined('STATUSNET')) {
* @package OStatusPlugin
* @maintainer Brion Vibber <brion@status.net>
*/
-class Ostatus_profile extends Memcached_DataObject
+
+class Ostatus_profile extends Managed_DataObject
{
public $__table = 'ostatus_profile';
@@ -47,74 +48,35 @@ class Ostatus_profile extends Memcached_DataObject
}
/**
- * return table definition for DB_DataObject
- *
- * DB_DataObject needs to know something about the table to manipulate
- * instances. This method provides all the DB_DataObject needs to know.
+ * Return table definition for Schema setup and DB_DataObject usage.
*
* @return array array of column definitions
*/
- function table()
- {
- return array('uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
- 'profile_id' => DB_DATAOBJECT_INT,
- 'group_id' => DB_DATAOBJECT_INT,
- 'feeduri' => DB_DATAOBJECT_STR,
- 'salmonuri' => DB_DATAOBJECT_STR,
- 'avatar' => DB_DATAOBJECT_STR,
- 'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
- 'modified' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
- }
static function schemaDef()
{
- return array(new ColumnDef('uri', 'varchar',
- 255, false, 'PRI'),
- new ColumnDef('profile_id', 'integer',
- null, true, 'UNI'),
- new ColumnDef('group_id', 'integer',
- null, true, 'UNI'),
- new ColumnDef('feeduri', 'varchar',
- 255, true, 'UNI'),
- new ColumnDef('salmonuri', 'text',
- null, true),
- new ColumnDef('avatar', 'text',
- null, true),
- new ColumnDef('created', 'datetime',
- null, false),
- new ColumnDef('modified', 'datetime',
- null, false));
- }
-
- /**
- * return key definitions for DB_DataObject
- *
- * DB_DataObject needs to know about keys that the table has; this function
- * defines them.
- *
- * @return array key definitions
- */
- function keys()
- {
- return array_keys($this->keyTypes());
- }
-
- /**
- * return key definitions for Memcached_DataObject
- *
- * Our caching system uses the same key definitions, but uses a different
- * method to get them.
- *
- * @return array key definitions
- */
- function keyTypes()
- {
- return array('uri' => 'K', 'profile_id' => 'U', 'group_id' => 'U', 'feeduri' => 'U');
- }
-
- function sequenceKey()
- {
- return array(false, false, false);
+ return array(
+ 'fields' => array(
+ 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true),
+ 'profile_id' => array('type' => 'integer'),
+ 'group_id' => array('type' => 'integer'),
+ 'feeduri' => array('type' => 'varchar', 'length' => 255),
+ 'salmonuri' => array('type' => 'varchar', 'length' => 255),
+ 'avatar' => array('type' => 'text'),
+ 'created' => array('type' => 'datetime', 'not null' => true),
+ 'modified' => array('type' => 'datetime', 'not null' => true),
+ ),
+ 'primary key' => array('uri'),
+ 'unique keys' => array(
+ 'ostatus_profile_profile_id_idx' => array('profile_id'),
+ 'ostatus_profile_group_id_idx' => array('group_id'),
+ 'ostatus_profile_feeduri_idx' => array('feeduri'),
+ ),
+ 'foreign keys' => array(
+ 'ostatus_profile_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
+ 'ostatus_profile_group_id_fkey' => array('user_group', array('group_id' => 'id')),
+ ),
+ );
}
/**
diff --git a/plugins/Sample/SamplePlugin.php b/plugins/Sample/SamplePlugin.php
index ef69121a9..a0d1140f3 100644
--- a/plugins/Sample/SamplePlugin.php
+++ b/plugins/Sample/SamplePlugin.php
@@ -172,9 +172,20 @@ class SamplePlugin extends Plugin
// For storing user-submitted flags on profiles
$schema->ensureTable('user_greeting_count',
- array(new ColumnDef('user_id', 'integer', null,
- true, 'PRI'),
- new ColumnDef('greeting_count', 'integer')));
+ array(
+ 'fields' => array(
+ 'user_id' => array('type' => 'int', 'not null' => true),
+ 'greeting_count' => array('type' => 'int'),
+ ),
+ 'primary key' => array('user_id'),
+ 'foreign keys' => array(
+ // Not all databases will support foreign keys, but even
+ // when not enforced it's helpful to include these definitions
+ // as documentation.
+ 'user_greeting_count_user_id_fkey' => array('user', array('user_id' => 'id')),
+ ),
+ )
+ );
return true;
}