[DATABASE] Start transactions with START TRANSACTION

"BEGIN" is non-standard and unnecessary.
This commit is contained in:
Alexei Sorokin
2020-06-08 12:25:01 +03:00
parent 97bddc4537
commit 6c035d01d4
36 changed files with 1588 additions and 1397 deletions

View File

@@ -1,44 +1,41 @@
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* StatusNet, the distributed open-source microblogging tool
*
* Twitter bridge administration panel
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Settings
* @package StatusNet
* @package GNUsocial
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
if (!defined('STATUSNET')) {
exit(1);
}
defined('GNUSOCIAL') || die();
/**
* Administer global Twitter bridge settings
*
* @category Admin
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @category Admin
* @package GNUsocial
* @author Zach Copley <zach@status.net>
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class TwitteradminpanelAction extends AdminPanelAction
{
@@ -47,10 +44,10 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return string page title
*/
function title()
public function title()
{
// TRANS: Page title for Twitter administration panel.
return _m('TITLE','Twitter');
return _m('TITLE', 'Twitter');
}
/**
@@ -58,7 +55,7 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return string instructions
*/
function getInstructions()
public function getInstructions()
{
// TRANS: Instructions for Twitter bridge administration page.
return _m('Twitter bridge settings');
@@ -69,7 +66,7 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return void
*/
function showForm()
public function showForm()
{
$form = new TwitterAdminPanelForm($this);
$form->show();
@@ -81,7 +78,7 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return void
*/
function saveSettings()
public function saveSettings()
{
static $settings = array(
'twitter' => array('consumer_key', 'consumer_secret'),
@@ -119,7 +116,7 @@ class TwitteradminpanelAction extends AdminPanelAction
$config = new Config();
$config->query('BEGIN');
$config->query('START TRANSACTION');
foreach ($settings as $section => $parts) {
foreach ($parts as $setting) {
@@ -143,7 +140,7 @@ class TwitteradminpanelAction extends AdminPanelAction
return;
}
function validate(&$values)
public function validate(&$values)
{
// Validate consumer key and secret (can't be too long)
@@ -162,7 +159,7 @@ class TwitteradminpanelAction extends AdminPanelAction
}
}
function isImportEnabled()
public function isImportEnabled()
{
// Since daemon setup isn't automated yet...
// @todo: if merged into main queues, detect presence of daemon config
@@ -177,7 +174,7 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return int ID of the form
*/
function id()
public function id()
{
return 'twitteradminpanel';
}
@@ -187,7 +184,7 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return string class of the form
*/
function formClass()
public function formClass()
{
return 'form_settings';
}
@@ -197,7 +194,7 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return string URL of the action
*/
function action()
public function action()
{
return common_local_url('twitteradminpanel');
}
@@ -207,7 +204,7 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return void
*/
function formData()
public function formData()
{
$this->out->elementStart(
'fieldset',
@@ -276,7 +273,8 @@ class TwitterAdminPanelForm extends AdminForm
$this->out->checkbox(
// TRANS: Checkbox label for global setting.
'signin', _m('Enable "Sign-in with Twitter"'),
'signin',
_m('Enable "Sign-in with Twitter"'),
(bool) $this->value('signin', 'twitter'),
// TRANS: Checkbox title.
_m('This allow users to login with their Twitter credentials.')
@@ -287,7 +285,8 @@ class TwitterAdminPanelForm extends AdminForm
$this->li();
$this->out->checkbox(
// TRANS: Checkbox label for global setting.
'enabled', _m('Enable Twitter import'),
'enabled',
_m('Enable Twitter import'),
(bool) $this->value('enabled', 'twitterimport'),
// TRANS: Checkbox title for global setting.
_m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
@@ -305,11 +304,16 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return void
*/
function formActions()
public function formActions()
{
// TRANS: Button text for saving the administrative Twitter bridge settings.
$this->out->submit('submit', _m('BUTTON','Save'), 'submit', null,
// TRANS: Button title for saving the administrative Twitter bridge settings.
_m('Save the Twitter bridge settings.'));
$this->out->submit(
'submit',
_m('BUTTON', 'Save'),
'submit',
null,
// TRANS: Button title for saving the administrative Twitter bridge settings.
_m('Save the Twitter bridge settings.')
);
}
}

View File

@@ -262,7 +262,7 @@ class TwitterImport
}
$profile = new Profile();
$profile->query("BEGIN");
$profile->query('START TRANSACTION');
$profile->nickname = $twuser->screen_name;
$profile->fullname = $twuser->name;
$profile->homepage = $twuser->url;