updateKeys -> updateWithKeys (w/ functionality)
This commit is contained in:
parent
e38d78eba9
commit
4917a422a1
|
@ -108,7 +108,7 @@ class ConfirmaddressAction extends Action
|
|||
$cur->smsemail = $carrier->toEmailAddress($cur->sms);
|
||||
}
|
||||
|
||||
$result = $cur->updateKeys($orig_user);
|
||||
$result = $cur->updateWithKeys($orig_user);
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($cur, 'UPDATE', __FILE__);
|
||||
|
|
|
@ -484,7 +484,7 @@ class EmailsettingsAction extends SettingsAction
|
|||
|
||||
$user->email = null;
|
||||
|
||||
$result = $user->updateKeys($original);
|
||||
$result = $user->updateWithKeys($original);
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
|
@ -517,7 +517,7 @@ class EmailsettingsAction extends SettingsAction
|
|||
$user->incomingemail = null;
|
||||
$user->emailpost = 0;
|
||||
|
||||
if (!$user->updateKeys($orig)) {
|
||||
if (!$user->updateWithKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error removing incoming e-mail address.
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
|
@ -541,7 +541,7 @@ class EmailsettingsAction extends SettingsAction
|
|||
$user->incomingemail = mail_new_incoming_address();
|
||||
$user->emailpost = 1;
|
||||
|
||||
if (!$user->updateKeys($orig)) {
|
||||
if (!$user->updateWithKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error adding incoming e-mail address.
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
|
|
|
@ -105,7 +105,7 @@ class RecoverpasswordAction extends Action
|
|||
if (!$user->email) {
|
||||
$orig = clone($user);
|
||||
$user->email = $email;
|
||||
$result = $user->updateKeys($orig);
|
||||
$result = $user->updateWithKeys($orig);
|
||||
if (!$result) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when updating a user's e-mail address in the database fails while recovering a password.
|
||||
|
|
|
@ -444,7 +444,7 @@ class SmssettingsAction extends SettingsAction
|
|||
$user->carrier = null;
|
||||
$user->smsemail = null;
|
||||
|
||||
$result = $user->updateKeys($original);
|
||||
$result = $user->updateWithKeys($original);
|
||||
if (!$result) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error removing a registered SMS phone number.
|
||||
|
@ -556,7 +556,7 @@ class SmssettingsAction extends SettingsAction
|
|||
|
||||
$user->incomingemail = null;
|
||||
|
||||
if (!$user->updateKeys($orig)) {
|
||||
if (!$user->updateWithKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when the user could not be updated in SMS settings.
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
|
@ -581,7 +581,7 @@ class SmssettingsAction extends SettingsAction
|
|||
|
||||
$user->incomingemail = mail_new_incoming_address();
|
||||
|
||||
if (!$user->updateKeys($orig)) {
|
||||
if (!$user->updateWithKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when the user could not be updated in SMS settings.
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
|
|
|
@ -322,13 +322,16 @@ abstract class Managed_DataObject extends Memcached_DataObject
|
|||
}
|
||||
|
||||
// 'update' won't write key columns, so we have to do it ourselves.
|
||||
public function updateKeys(&$orig)
|
||||
// This also automatically calls "update" _before_ it sets the keys.
|
||||
public function updateWithKeys(&$orig)
|
||||
{
|
||||
if (!$orig instanceof $this) {
|
||||
throw new ServerException('Tried updating a DataObject with a different class than itself.');
|
||||
}
|
||||
|
||||
$this->_connect();
|
||||
// Update non-keys first, if necessary.
|
||||
$this->update($orig);
|
||||
|
||||
$parts = array();
|
||||
foreach ($this->keys() as $k) {
|
||||
if (strcmp($this->$k, $orig->$k) != 0) {
|
||||
|
|
|
@ -838,7 +838,7 @@ class Profile extends Managed_DataObject
|
|||
common_debug("Updating User ({$this->id}) nickname from {$dataObject->nickname} to {$this->nickname}");
|
||||
$origuser = clone($local);
|
||||
$local->nickname = $this->nickname;
|
||||
$result = $local->updateKeys($origuser);
|
||||
$result = $local->updateWithKeys($origuser);
|
||||
if ($result === false) {
|
||||
common_log_db_error($local, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown when user profile settings could not be updated.
|
||||
|
|
|
@ -150,7 +150,7 @@ class ConfirmfirstemailAction extends Action
|
|||
|
||||
$this->user->email = $this->confirm->address;
|
||||
|
||||
$this->user->updateKeys($orig);
|
||||
$this->user->updateWithKeys($orig);
|
||||
|
||||
$this->user->emailChanged();
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ function clear_jabber($id)
|
|||
} else {
|
||||
$original = clone($user);
|
||||
$user->jabber = null;
|
||||
$result = $user->updateKeys($original);
|
||||
$result = $user->updateWithKeys($original);
|
||||
}
|
||||
echo "\n";
|
||||
} else if (!$user) {
|
||||
|
|
|
@ -69,7 +69,7 @@ try {
|
|||
|
||||
$user->email = $email;
|
||||
|
||||
if (!$user->updateKeys($orig)) {
|
||||
if (!$user->updateWithKeys($orig)) {
|
||||
print "Failed!\n";
|
||||
throw new Exception("Can't update email address.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user