]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/UserFlag/User_flag_profile.php
More info for a proper, fancy-url lighttpd setup
[quix0rs-gnu-social.git] / plugins / UserFlag / User_flag_profile.php
index 69fe0f356b79b5d36fdf6f850fa0509546d48145..d0cdedccb31df2332a7cd7caa52ee2d715e1c023 100644 (file)
@@ -44,68 +44,37 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  * @link     http://status.net/
  */
-class User_flag_profile extends Memcached_DataObject
+class User_flag_profile extends Managed_DataObject
 {
     ###START_AUTOCODE
     /* the code below is auto generated do not remove the above tag */
 
     public $__table = 'user_flag_profile';               // table name
-    public $profile_id;                      // int(4)  primary_key not_null
-    public $user_id;                         // int(4)  primary_key not_null
-    public $created;                         // datetime   not_null default_0000-00-00%2000%3A00%3A00
-    public $cleared;                         // datetime   not_null default_0000-00-00%2000%3A00%3A00
-
-    /* Static get */
-    function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_flag_profile',$k,$v); }
+    public $profile_id;                      // int(11)  primary_key not_null
+    public $user_id;                         // int(11)  primary_key not_null
+    public $cleared;                         // datetime   default_0000-00-00%2000%3A00%3A00
+    public $created;                         // datetime()   not_null
+    public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    /**
-     * return table definition for DB_DataObject
-     *
-     * @return array array of column definitions
-     */
-    function table()
+    public static function schemaDef()
     {
         return array(
-                     'profile_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
-                     'user_id'    => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
-                     'created'    => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
-                     'cleared'    => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME
-                     );
-    }
-
-    /**
-     * return key definitions for DB_DataObject
-     *
-     * @return array key definitions
-     */
-    function keys()
-    {
-        return array('profile_id' => 'K', 'user_id' => 'K');
-    }
-
-    /**
-     * return key definitions for DB_DataObject
-     *
-     * @return array key definitions
-     */
-    function keyTypes()
-    {
-        return $this->keys();
-    }
-
-    /**
-     * Get a single object with multiple keys
-     *
-     * @param array $kv Map of key-value pairs
-     *
-     * @return User_flag_profile found object or null
-     */
-    function pkeyGet($kv)
-    {
-        return Memcached_DataObject::pkeyGet('User_flag_profile', $kv);
+            'fields' => array(
+                'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile id flagged'),
+                'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user id of the actor'),
+                'cleared' => array('type' => 'datetime', 'description' => 'when flag was removed'),
+                'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
+                'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
+            ),
+            'primary key' => array('profile_id', 'user_id'),
+            'indexes' => array(
+                'user_flag_profile_cleared_idx' => array('cleared'),
+                'user_flag_profile_created_idx' => array('created'),
+            ),
+        );
     }
 
     /**
@@ -142,7 +111,8 @@ class User_flag_profile extends Memcached_DataObject
 
         if (!$ufp->insert()) {
             // TRANS: Server exception.
-            $msg = sprintf(_m('Couldn\'t flag profile "%d" for review.'),
+            // TRANS: %d is a profile ID (number).
+            $msg = sprintf(_m('Could not flag profile "%d" for review.'),
                            $profile_id);
             throw new ServerException($msg);
         }