diff options
author | Zach Copley <zach@status.net> | 2010-02-05 03:19:12 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-02-05 03:19:12 +0000 |
commit | 23802e58d6d01e5f8dacade2161147d31b2dacb9 (patch) | |
tree | 707120cc8d2d0217e4168473b7a7ef25e94919e0 /classes | |
parent | 4502bea9a86fe5992eb9b359d90f0c1f004998c1 (diff) | |
parent | 857494c9c61d872b7decf69de226bba6cd250d99 (diff) |
Merge branch 'temp'
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Consumer.php | 30 | ||||
-rw-r--r-- | classes/Oauth_application.php | 17 | ||||
-rw-r--r-- | classes/statusnet.ini | 1 |
3 files changed, 48 insertions, 0 deletions
diff --git a/classes/Consumer.php b/classes/Consumer.php index ad64a8491..ce399f278 100644 --- a/classes/Consumer.php +++ b/classes/Consumer.php @@ -36,4 +36,34 @@ class Consumer extends Memcached_DataObject return $cons; } + /** + * Delete a Consumer and related tokens and nonces + * + * XXX: Should this happen in an OAuthDataStore instead? + * + */ + function delete() + { + // XXX: Is there any reason NOT to do this kind of cleanup? + + $this->_deleteTokens(); + $this->_deleteNonces(); + + parent::delete(); + } + + function _deleteTokens() + { + $token = new Token(); + $token->consumer_key = $this->consumer_key; + $token->delete(); + } + + function _deleteNonces() + { + $nonce = new Nonce(); + $nonce->consumer_key = $this->consumer_key; + $nonce->delete(); + } + } diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php index a6b539087..748b64220 100644 --- a/classes/Oauth_application.php +++ b/classes/Oauth_application.php @@ -137,4 +137,21 @@ class Oauth_application extends Memcached_DataObject } } + function delete() + { + $this->_deleteAppUsers(); + + $consumer = $this->getConsumer(); + $consumer->delete(); + + parent::delete(); + } + + function _deleteAppUsers() + { + $oauser = new Oauth_application_user(); + $oauser->application_id = $this->id; + $oauser->delete(); + } + } diff --git a/classes/statusnet.ini b/classes/statusnet.ini index e28424ce2..5f8da7cf5 100644 --- a/classes/statusnet.ini +++ b/classes/statusnet.ini @@ -367,6 +367,7 @@ modified = 384 [oauth_application__keys] id = N +name = U [oauth_application_user] profile_id = 129 |