ROLLBACK queries in the proper order

This commit is contained in:
Mikael Nordfeldth 2015-03-08 19:44:23 +01:00
parent d6423bbbc8
commit 32dacb9369

View File

@ -28,9 +28,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Add a new application * Add a new application
@ -51,10 +49,8 @@ class NewApplicationAction extends FormAction
return _('New application'); return _('New application');
} }
protected function handlePost() protected function doPost()
{ {
parent::handlePost();
if ($this->arg('cancel')) { if ($this->arg('cancel')) {
common_redirect(common_local_url('oauthappssettings'), 303); common_redirect(common_local_url('oauthappssettings'), 303);
} elseif ($this->arg('save')) { } elseif ($this->arg('save')) {
@ -181,6 +177,7 @@ class NewApplicationAction extends FormAction
if (!$result) { if (!$result) {
common_log_db_error($consumer, 'INSERT', __FILE__); common_log_db_error($consumer, 'INSERT', __FILE__);
$app->query('ROLLBACK');
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form. // TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.')); $this->serverError(_('Could not create application.'));
} }
@ -191,9 +188,9 @@ class NewApplicationAction extends FormAction
if (!$this->app_id) { if (!$this->app_id) {
common_log_db_error($app, 'INSERT', __FILE__); common_log_db_error($app, 'INSERT', __FILE__);
$app->query('ROLLBACK');
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form. // TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.')); $this->serverError(_('Could not create application.'));
$app->query('ROLLBACK');
} }
try { try {