mirror of
https://github.com/friendica/friendica
synced 2024-12-23 02:40:17 +00:00
Remove extraneous dba::connect calls
This commit is contained in:
parent
decfc553f7
commit
3985a4bc43
11 changed files with 18 additions and 60 deletions
|
@ -33,7 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
|
||||||
use Friendica\Util\ExAuth;
|
use Friendica\Util\ExAuth;
|
||||||
|
|
||||||
if (sizeof($_SERVER["argv"]) == 0) {
|
if (sizeof($_SERVER["argv"]) == 0) {
|
||||||
|
@ -55,10 +54,6 @@ require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
@include ".htconfig.php";
|
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
$oAuth = new ExAuth();
|
$oAuth = new ExAuth();
|
||||||
|
|
||||||
$oAuth->readStdin();
|
$oAuth->readStdin();
|
|
@ -28,8 +28,9 @@ require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
require_once ".htconfig.php";
|
if ($a->mode === App::MODE_INSTALL) {
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
die("Friendica isn't properly installed yet.\n");
|
||||||
|
}
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
|
@ -125,11 +126,9 @@ if (!$foreground) {
|
||||||
file_put_contents($pidfile, $pid);
|
file_put_contents($pidfile, $pid);
|
||||||
|
|
||||||
// We lose the database connection upon forking
|
// We lose the database connection upon forking
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
$a->loadDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
Config::set('system', 'worker_daemon_mode', true);
|
Config::set('system', 'worker_daemon_mode', true);
|
||||||
|
|
||||||
// Just to be sure that this script really runs endlessly
|
// Just to be sure that this script really runs endlessly
|
||||||
|
|
|
@ -24,14 +24,9 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "boot.php";
|
require_once "boot.php";
|
||||||
require_once "include/dba.php";
|
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
require_once ".htconfig.php";
|
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
// Check the database structure and possibly fixes it
|
// Check the database structure and possibly fixes it
|
||||||
|
|
|
@ -41,10 +41,7 @@ if (!$a->mode == App::MODE_INSTALL) {
|
||||||
require_once "include/dba.php";
|
require_once "include/dba.php";
|
||||||
|
|
||||||
if (!$a->mode == App::MODE_INSTALL) {
|
if (!$a->mode == App::MODE_INSTALL) {
|
||||||
$result = dba::connect($db_host, $db_user, $db_pass, $db_data);
|
if (!dba::connected()) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
System::unavailable();
|
System::unavailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode === App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Friendica isn\'t properly installed yet.');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nurl = normalise_link($this->getArgument(0));
|
$nurl = normalise_link($this->getArgument(0));
|
||||||
|
|
|
@ -92,12 +92,8 @@ HELP;
|
||||||
throw new CommandArgsException('Too many arguments');
|
throw new CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode === \Friendica\App::MODE_INSTALL) {
|
||||||
$result = dba::connect($db_host, $db_user, $db_pass, $db_data);
|
$this->out('Database isn\'t ready or populated yet, showing file config only');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) == 3) {
|
if (count($this->args) == 3) {
|
||||||
|
|
|
@ -56,11 +56,7 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if (!\dba::connected()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
throw new \RuntimeException('Unable to connect to database');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode == \Friendica\App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_id = Contact::getIdForURL($this->getArgument(0));
|
$contact_id = Contact::getIdForURL($this->getArgument(0));
|
||||||
|
|
|
@ -64,12 +64,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode == \Friendica\App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,12 +64,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode == \Friendica\App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core\Config::load();
|
Core\Config::load();
|
||||||
|
|
|
@ -58,12 +58,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode == \Friendica\App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nick = $this->getArgument(0);
|
$nick = $this->getArgument(0);
|
||||||
|
|
Loading…
Reference in a new issue