common_sql_now() is recommended before DB_DataObject_Cast::dateTime()
This commit is contained in:
parent
01935c7cd0
commit
a8bcdc905f
@ -49,7 +49,7 @@ class User_username extends Managed_DataObject
|
|||||||
$user_username->user_id = $user->id;
|
$user_username->user_id = $user->id;
|
||||||
$user_username->provider_name = $provider_name;
|
$user_username->provider_name = $provider_name;
|
||||||
$user_username->username = $username;
|
$user_username->username = $username;
|
||||||
$user_username->created = DB_DataObject_Cast::dateTime();
|
$user_username->created = common_sql_now();
|
||||||
|
|
||||||
if($user_username->insert()){
|
if($user_username->insert()){
|
||||||
return $user_username;
|
return $user_username;
|
||||||
|
@ -460,7 +460,7 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore
|
|||||||
if ($n->find(true)) {
|
if ($n->find(true)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$n->created = DB_DataObject_Cast::dateTime();
|
$n->created = common_sql_now();
|
||||||
$n->insert();
|
$n->insert();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
$con = new Consumer();
|
$con = new Consumer();
|
||||||
$con->consumer_key = $consumer_key;
|
$con->consumer_key = $consumer_key;
|
||||||
$con->seed = common_good_rand(16);
|
$con->seed = common_good_rand(16);
|
||||||
$con->created = DB_DataObject_Cast::dateTime();
|
$con->created = common_sql_now();
|
||||||
if (!$con->insert()) {
|
if (!$con->insert()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
if ($n->find(true)) {
|
if ($n->find(true)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$n->created = DB_DataObject_Cast::dateTime();
|
$n->created = common_sql_now();
|
||||||
$n->insert();
|
$n->insert();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
$t->secret = common_good_rand(16);
|
$t->secret = common_good_rand(16);
|
||||||
$t->type = 0; // request
|
$t->type = 0; // request
|
||||||
$t->state = 0; // unauthorized
|
$t->state = 0; // unauthorized
|
||||||
$t->created = DB_DataObject_Cast::dateTime();
|
$t->created = common_sql_now();
|
||||||
if (!$t->insert()) {
|
if (!$t->insert()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +110,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
$at->tok = common_good_rand(16);
|
$at->tok = common_good_rand(16);
|
||||||
$at->secret = common_good_rand(16);
|
$at->secret = common_good_rand(16);
|
||||||
$at->type = 1; // access
|
$at->type = 1; // access
|
||||||
$at->created = DB_DataObject_Cast::dateTime();
|
$at->created = common_sql_now();
|
||||||
if (!$at->insert()) {
|
if (!$at->insert()) {
|
||||||
$e = $at->_lastError;
|
$e = $at->_lastError;
|
||||||
common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
|
common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
|
||||||
@ -273,7 +273,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
if ($exists) {
|
if ($exists) {
|
||||||
$profile->update($orig_profile);
|
$profile->update($orig_profile);
|
||||||
} else {
|
} else {
|
||||||
$profile->created = DB_DataObject_Cast::dateTime(); # current time
|
$profile->created = common_sql_now(); # current time
|
||||||
$id = $profile->insert();
|
$id = $profile->insert();
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
// TRANS: Exception thrown when creating a new profile fails in OAuth store.
|
// 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.'));
|
throw new Exception(_('Error updating remote profile.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$remote->created = DB_DataObject_Cast::dateTime(); # current time
|
$remote->created = common_sql_now(); # current time
|
||||||
if (!$remote->insert()) {
|
if (!$remote->insert()) {
|
||||||
// TRANS: Exception thrown when creating a remote profile fails in OAuth store.
|
// TRANS: Exception thrown when creating a remote profile fails in OAuth store.
|
||||||
throw new Exception(_('Error inserting remote profile.'));
|
throw new Exception(_('Error inserting remote profile.'));
|
||||||
@ -473,7 +473,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
|||||||
if ($sub_exists) {
|
if ($sub_exists) {
|
||||||
$orig_sub = clone($sub);
|
$orig_sub = clone($sub);
|
||||||
} else {
|
} else {
|
||||||
$sub->created = DB_DataObject_Cast::dateTime();
|
$sub->created = common_sql_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub->token = $token->key;
|
$sub->token = $token->key;
|
||||||
|
@ -94,7 +94,7 @@ class OpenidtrustAction extends Action
|
|||||||
$user_openid_trustroot = new User_openid_trustroot();
|
$user_openid_trustroot = new User_openid_trustroot();
|
||||||
$user_openid_trustroot->user_id = $this->user->id;
|
$user_openid_trustroot->user_id = $this->user->id;
|
||||||
$user_openid_trustroot->trustroot = $this->trust_root;
|
$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()) {
|
if (!$user_openid_trustroot->insert()) {
|
||||||
$err = PEAR::getStaticProperty('DB_DataObject','lastError');
|
$err = PEAR::getStaticProperty('DB_DataObject','lastError');
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ function oid_link_user($id, $canonical, $display)
|
|||||||
$oid->user_id = $id;
|
$oid->user_id = $id;
|
||||||
$oid->canonical = $canonical;
|
$oid->canonical = $canonical;
|
||||||
$oid->display = $display;
|
$oid->display = $display;
|
||||||
$oid->created = DB_DataObject_Cast::dateTime();
|
$oid->created = common_sql_now();
|
||||||
|
|
||||||
if (!$oid->insert()) {
|
if (!$oid->insert()) {
|
||||||
$err = PEAR::getStaticProperty('DB_DataObject','lastError');
|
$err = PEAR::getStaticProperty('DB_DataObject','lastError');
|
||||||
|
Loading…
Reference in New Issue
Block a user