]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Plugins with classes that extend Managed_DataObject get better code reuse
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Aug 2013 18:00:01 +0000 (20:00 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Aug 2013 18:00:01 +0000 (20:00 +0200)
The switch to having a function in Managed_DataObject is now being applied
to plugins which can use this as well.

There are some plugins that still use Memcached_DataObject, but these will
be taken care of later.

20 files changed:
plugins/ActivitySpam/Spam_score.php
plugins/Blog/Blog_entry.php
plugins/EmailReminder/classes/Email_reminder.php
plugins/Event/Happening.php
plugins/Event/RSVP.php
plugins/ExtendedProfile/classes/Profile_detail.php
plugins/GNUsocialPhoto/Photo.php
plugins/GNUsocialVideo/Video.php
plugins/ModLog/ModLog.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OpenID/User_openid_prefs.php
plugins/Poll/Poll.php
plugins/Poll/Poll_response.php
plugins/Poll/User_poll_prefs.php
plugins/QnA/classes/QnA_Answer.php
plugins/QnA/classes/QnA_Question.php
plugins/QnA/classes/QnA_Vote.php
plugins/Realtime/Realtime_channel.php
plugins/SearchSub/SearchSub.php
plugins/TagSub/TagSub.php

index 997a9f83ad3add167aec94e1190161ab2635fccb..dd7209f59446698808b4c6c14a7809a352bc2eeb 100644 (file)
@@ -53,20 +53,6 @@ class Spam_score extends Managed_DataObject
     public $score;       // float
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * @param string $k Key to use to lookup (usually 'notice_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return Spam_score object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Managed_DataObject::staticGet('Spam_score', $k, $v);
-    }
-
     function saveNew($notice, $result) {
 
         $score = new Spam_score();
index b40039b2d78677e20460be045cb6b427c63e4c48..4d1820936ff33f2f7d398f7419707c069002e367 100644 (file)
@@ -60,11 +60,6 @@ class Blog_entry extends Managed_DataObject
     public $modified; // datetime
 
     const TYPE = ActivityObject::ARTICLE;
-    
-    function staticGet($k, $v=null)
-    {
-        return Managed_DataObject::staticGet('Blog_entry', $k, $v);
-    }
 
     static function schemaDef()
     {
index 29af05a9150c225ca525eca37fdd483dacc3a48b..235305f04722a3c26587edfa9a2287012879b9dc 100644 (file)
@@ -37,21 +37,6 @@ class Email_reminder extends Managed_DataObject
     public $created;  // timestamp
     public $modified; // timestamp
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup
-     * @param mixed  $v Value to lookup
-     *
-     * @return QnA_Answer object found, or null for no hits
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('email_reminder', $k, $v);
-    }
-
     /**
      * Do we need to send a reminder?
      *
index b8347bdb2c399a5ee0da73d710fd411c4a2d7b56..52aa206435e23f484442ff862c6bb98e0d7863c4 100644 (file)
@@ -63,20 +63,6 @@ class Happening extends Managed_DataObject
     public $description;           // text
     public $created;               // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * @param string $k Key to use to lookup (usually 'id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return Happening object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('Happening', $k, $v);
-    }
-
     /**
      * The One True Thingy that must be defined and declared.
      */
index 1f47958e9a266b4e07fdd3828c614b6f0d46f813..32206613544ebb1687f20970ea6baa49f726d5b2 100644 (file)
@@ -56,19 +56,6 @@ class RSVP extends Managed_DataObject
     public $response;            // tinyint
     public $created;           // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * @param string $k Key to use to lookup (usually 'id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return RSVP object found, or null for no hits
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('RSVP', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 94e52c396c6a2506c3d97a8228b0747074062703..5335786ef9721b0108d79a93a93520d71df7ebda 100644 (file)
@@ -69,22 +69,6 @@ class Profile_detail extends Managed_DataObject
     public $created;
     public $modified;
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup
-     * @param mixed  $v Value to lookup
-     *
-     * @return User_greeting_count object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('Profile_detail', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index f6d932a300e48a6d3a7f4bb1c367c37c3c686d32..2bbbe91fd57c251f89dcdedc25b5e03a366f3797 100644 (file)
@@ -45,11 +45,6 @@ class Photo extends Managed_DataObject
     public $title;             // varchar (255)
     public $description;       // text
     public $profile_id;        // int
-    
-    public function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('photo', $k, $v);
-    }
 
     public function getByNotice($notice)
     {
index 73e240c470ddd3033d5e31160b46026b36cafe2a..7525b22fe5ff5f120c858a08b4c730422e7ada2c 100644 (file)
@@ -42,11 +42,6 @@ class Video extends Managed_DataObject
     public $uri;               // varchar (255)  // This is the corresponding notice's uri.
     public $url;               // varchar (255)
     public $profile_id;        // int
-    
-    public function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('Video', $k, $v);
-    }
 
     public function getByNotice($notice)
     {
index b2c654683852220cfcd3dfa0039ddf3801dea87f..ff2588cfdbaac43dfb3515ef0d253c3557cc238a 100644 (file)
@@ -55,20 +55,6 @@ class ModLog extends Managed_DataObject
     public $grant;        // 1 = grant, 0 = revoke
     public $created;      // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return TagSub object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Managed_DataObject::staticGet('ModLog', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 661b7fe3f70285a6da416d421b55f1eeaf4f6935..47817f28732b47cd4b4cb7377f45060b682c65bf 100644 (file)
@@ -42,11 +42,6 @@ class Ostatus_profile extends Managed_DataObject
     public $created;
     public $modified;
 
-    public /*static*/ function staticGet($k, $v=null)
-    {
-        return parent::staticGet(__CLASS__, $k, $v);
-    }
-
     /**
      * Return table definition for Schema setup and DB_DataObject usage.
      *
index 74a21f685eb0ff328239adbb3379c0497a4b73b3..fcd88f454197db1970f9c1722fcf4fb7fcabf7fa 100644 (file)
@@ -53,22 +53,6 @@ class User_openid_prefs extends Managed_DataObject
     public $created;            // datetime
     public $modified;           // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return TagSub object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Managed_DataObject::staticGet('User_openid_prefs', $k, $v);
-    }
-
     /**
      * The One True Thingy that must be defined and declared.
      */
index 399d49240614585ef16952063484fb1732372315..f9155def4a40db536edcc82cf7668f43736144bf 100644 (file)
@@ -53,22 +53,6 @@ class Poll extends Managed_DataObject
     public $options;     // text; newline(?)-delimited
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return User_greeting_count object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('Poll', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 2518ac2bebd057f8a35e9b6b5a070c8cd99e6238..a63d790b539952f920d9f911e16ad3dd153d0658 100644 (file)
@@ -52,22 +52,6 @@ class Poll_response extends Managed_DataObject
     public $selection;   // int -> choice #
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return User_greeting_count object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('Poll_response', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 338e811948e2d90b2cd000a671b11a57d88b4bc6..450a6b9cfb72c6361ab3a62d37a94fc3d5d84fc2 100644 (file)
@@ -50,22 +50,6 @@ class User_poll_prefs extends Managed_DataObject
     public $created;          // datetime
     public $modified;         // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return User_greeting_count object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('User_poll_prefs', $k, $v);
-    }
-
     /**
      * The One True Thingy that must be defined and declared.
      */
index 7f92e47c61653a8c5499d0544ca970c2f2ce304a..0d34f6baf8d8b6ab31ea14b0b8631bf467740f7b 100644 (file)
@@ -55,22 +55,6 @@ class QnA_Answer extends Managed_DataObject
     public $content;     // text -> response text
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup
-     * @param mixed  $v Value to lookup
-     *
-     * @return QnA_Answer object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('QnA_Answer', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 820656870b8fe782d2253e99e2615122969ae984..e1713b466056f6cb6275d423a643442e93372f22 100644 (file)
@@ -55,22 +55,6 @@ class QnA_Question extends Managed_DataObject
     public $closed;      // int (boolean) whether a question is closed
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup
-     * @param mixed  $v Value to lookup
-     *
-     * @return QnA_Question object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('QnA_Question', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index cbb8a717c94a32692fb7f1a6c451f08bf3d5ad9d..025f6b0c6be558dcb31d31aca7f7959eb29efcd1 100644 (file)
@@ -55,22 +55,6 @@ class QnA_Vote extends Managed_DataObject
     public $profile_id;  // int -> question.id
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup
-     * @param mixed  $v Value to lookup
-     *
-     * @return QnA_Vote object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('QnA_Vote', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 1d2ca53912acba22c202352cec45b41b949e3e24..3538e884a01d463245533cceb879be228a24e5db 100644 (file)
@@ -61,21 +61,6 @@ class Realtime_channel extends Managed_DataObject
     public $created;       // created date
     public $modified;      // modified date
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return Realtime_channel object found, or null for no hits
-     */
-    function staticGet($k, $v=null)
-    {
-        return Managed_DataObject::staticGet('Realtime_channel', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index 7e9a94caa9ef8ad79979918183f4dd9e61b3d8ea..246720b6a5790cf5d0083dfa197735240b6a4c8b 100644 (file)
@@ -50,22 +50,6 @@ class SearchSub extends Managed_DataObject
     public $profile_id;  // int -> profile.id
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return SearchSub object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('SearchSub', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *
index c0c4c1ec86f4c2233f31fbf743563019a0d21605..b91778654034e9eaee46965a23c00a994cda269b 100644 (file)
@@ -49,22 +49,6 @@ class TagSub extends Managed_DataObject
     public $profile_id;  // int -> profile.id
     public $created;     // datetime
 
-    /**
-     * Get an instance by key
-     *
-     * This is a utility method to get a single instance with a given key value.
-     *
-     * @param string $k Key to use to lookup (usually 'user_id' for this class)
-     * @param mixed  $v Value to lookup
-     *
-     * @return TagSub object found, or null for no hits
-     *
-     */
-    function staticGet($k, $v=null)
-    {
-        return Memcached_DataObject::staticGet('TagSub', $k, $v);
-    }
-
     /**
      * Get an instance by compound key
      *