CSteipp has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/120974

Change subject: Allow copying DAO objects
......................................................................

Allow copying DAO objects

To allow copying between databases, it seems like it would be useful
to allow DAO's to be copied.

Change-Id: Iad92f94a73069daf80e0c612ea3c23d4b470f0de
---
M backend/MWOAuthConsumerAcceptance.php
M backend/MWOAuthDAO.php
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/74/120974/1

diff --git a/backend/MWOAuthConsumerAcceptance.php 
b/backend/MWOAuthConsumerAcceptance.php
index 9bafdab..0005c6e 100644
--- a/backend/MWOAuthConsumerAcceptance.php
+++ b/backend/MWOAuthConsumerAcceptance.php
@@ -33,7 +33,7 @@
        /** @var string Hex token */
        protected $accessToken;
        /** @var string Secret HMAC key */
-       protected $secretToken;
+       protected $accessSecret;
        /** @var array List of grants */
        protected $grants;
        /** @var string TS_MW timestamp of acceptance */
diff --git a/backend/MWOAuthDAO.php b/backend/MWOAuthDAO.php
index fe6704f..63f0f42 100644
--- a/backend/MWOAuthDAO.php
+++ b/backend/MWOAuthDAO.php
@@ -414,4 +414,17 @@
        final public function checkChangeToken( RequestContext $context, 
$oldToken ) {
                return ( $this->getChangeToken( $context ) === $oldToken );
        }
+
+       /**
+        * Clone this to another object
+        * @return MWOAuthDAO
+        */
+       public function copy( DBConnRef $db ) {
+               $new = new static();
+               $rowVals = $this->decodeRow( $db, $this->getRowArray( $db ) );
+               foreach ( static::getFieldColumnMap() as $field => $column ) {
+                       $new->setField( $field,  $rowVals[$column] );
+               }
+               return $new;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/120974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad92f94a73069daf80e0c612ea3c23d4b470f0de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <cste...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to