From a8bcdc905f197c75f502e44bdca486b8418e1d3a Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 14 Oct 2013 13:42:27 +0200 Subject: [PATCH] common_sql_now() is recommended before DB_DataObject_Cast::dateTime() --- classes/User_username.php | 2 +- lib/apignusocialoauthdatastore.php | 2 +- plugins/OMB/lib/omboauthdatastore.php | 14 +++++++------- plugins/OpenID/actions/openidtrust.php | 2 +- plugins/OpenID/openid.php | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/classes/User_username.php b/classes/User_username.php index 5f0ef63185..d9f517c548 100644 --- a/classes/User_username.php +++ b/classes/User_username.php @@ -49,7 +49,7 @@ class User_username extends Managed_DataObject $user_username->user_id = $user->id; $user_username->provider_name = $provider_name; $user_username->username = $username; - $user_username->created = DB_DataObject_Cast::dateTime(); + $user_username->created = common_sql_now(); if($user_username->insert()){ return $user_username; diff --git a/lib/apignusocialoauthdatastore.php b/lib/apignusocialoauthdatastore.php index 5a0c2a8243..17b19fb1d6 100644 --- a/lib/apignusocialoauthdatastore.php +++ b/lib/apignusocialoauthdatastore.php @@ -460,7 +460,7 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore if ($n->find(true)) { return true; } else { - $n->created = DB_DataObject_Cast::dateTime(); + $n->created = common_sql_now(); $n->insert(); return false; } diff --git a/plugins/OMB/lib/omboauthdatastore.php b/plugins/OMB/lib/omboauthdatastore.php index 9603986ba7..4c9ae69556 100644 --- a/plugins/OMB/lib/omboauthdatastore.php +++ b/plugins/OMB/lib/omboauthdatastore.php @@ -32,7 +32,7 @@ class OMBOAuthDataStore extends OAuthDataStore $con = new Consumer(); $con->consumer_key = $consumer_key; $con->seed = common_good_rand(16); - $con->created = DB_DataObject_Cast::dateTime(); + $con->created = common_sql_now(); if (!$con->insert()) { return null; } @@ -68,7 +68,7 @@ class OMBOAuthDataStore extends OAuthDataStore if ($n->find(true)) { return true; } else { - $n->created = DB_DataObject_Cast::dateTime(); + $n->created = common_sql_now(); $n->insert(); return false; } @@ -82,7 +82,7 @@ class OMBOAuthDataStore extends OAuthDataStore $t->secret = common_good_rand(16); $t->type = 0; // request $t->state = 0; // unauthorized - $t->created = DB_DataObject_Cast::dateTime(); + $t->created = common_sql_now(); if (!$t->insert()) { return null; } else { @@ -110,7 +110,7 @@ class OMBOAuthDataStore extends OAuthDataStore $at->tok = common_good_rand(16); $at->secret = common_good_rand(16); $at->type = 1; // access - $at->created = DB_DataObject_Cast::dateTime(); + $at->created = common_sql_now(); if (!$at->insert()) { $e = $at->_lastError; common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__); @@ -273,7 +273,7 @@ class OMBOAuthDataStore extends OAuthDataStore if ($exists) { $profile->update($orig_profile); } else { - $profile->created = DB_DataObject_Cast::dateTime(); # current time + $profile->created = common_sql_now(); # current time $id = $profile->insert(); if (!$id) { // TRANS: Exception thrown when creating a new profile fails in OAuth store. @@ -298,7 +298,7 @@ class OMBOAuthDataStore extends OAuthDataStore throw new Exception(_('Error updating remote profile.')); } } else { - $remote->created = DB_DataObject_Cast::dateTime(); # current time + $remote->created = common_sql_now(); # current time if (!$remote->insert()) { // TRANS: Exception thrown when creating a remote profile fails in OAuth store. throw new Exception(_('Error inserting remote profile.')); @@ -473,7 +473,7 @@ class OMBOAuthDataStore extends OAuthDataStore if ($sub_exists) { $orig_sub = clone($sub); } else { - $sub->created = DB_DataObject_Cast::dateTime(); + $sub->created = common_sql_now(); } $sub->token = $token->key; diff --git a/plugins/OpenID/actions/openidtrust.php b/plugins/OpenID/actions/openidtrust.php index d39d8541c6..4ea1c86ef3 100644 --- a/plugins/OpenID/actions/openidtrust.php +++ b/plugins/OpenID/actions/openidtrust.php @@ -94,7 +94,7 @@ class OpenidtrustAction extends Action $user_openid_trustroot = new User_openid_trustroot(); $user_openid_trustroot->user_id = $this->user->id; $user_openid_trustroot->trustroot = $this->trust_root; - $user_openid_trustroot->created = DB_DataObject_Cast::dateTime(); + $user_openid_trustroot->created = common_sql_now(); if (!$user_openid_trustroot->insert()) { $err = PEAR::getStaticProperty('DB_DataObject','lastError'); } diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index c38b646dc5..12c0ae7f31 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -89,7 +89,7 @@ function oid_link_user($id, $canonical, $display) $oid->user_id = $id; $oid->canonical = $canonical; $oid->display = $display; - $oid->created = DB_DataObject_Cast::dateTime(); + $oid->created = common_sql_now(); if (!$oid->insert()) { $err = PEAR::getStaticProperty('DB_DataObject','lastError');