*/
use Friendica\App;
-use Friendica\Core\Config;
use Friendica\Util\ExAuth;
if (sizeof($_SERVER["argv"]) == 0) {
$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->readStdin();
\ No newline at end of file
$a = new App(dirname(__DIR__));
-require_once ".htconfig.php";
-dba::connect($db_host, $db_user, $db_pass, $db_data);
+if ($a->mode === App::MODE_INSTALL) {
+ die("Friendica isn't properly installed yet.\n");
+}
Config::load();
file_put_contents($pidfile, $pid);
// 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);
// Just to be sure that this script really runs endlessly
}
require_once "boot.php";
-require_once "include/dba.php";
$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();
// Check the database structure and possibly fixes it
require_once "include/dba.php";
if (!$a->mode == App::MODE_INSTALL) {
- $result = dba::connect($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
-
- if (!$result) {
+ if (!dba::connected()) {
System::unavailable();
}
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode === App::MODE_INSTALL) {
+ throw new \RuntimeException('Friendica isn\'t properly installed yet.');
}
$nurl = normalise_link($this->getArgument(0));
throw new CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode === \Friendica\App::MODE_INSTALL) {
+ $this->out('Database isn\'t ready or populated yet, showing file config only');
}
if (count($this->args) == 3) {
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
-
- if (!$result) {
+ if (!\dba::connected()) {
throw new \RuntimeException('Unable to connect to database');
}
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode == \Friendica\App::MODE_INSTALL) {
+ throw new \RuntimeException('Database isn\'t ready or populated yet');
}
$contact_id = Contact::getIdForURL($this->getArgument(0));
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode == \Friendica\App::MODE_INSTALL) {
+ throw new \RuntimeException('Database isn\'t ready or populated yet');
}
/**
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode == \Friendica\App::MODE_INSTALL) {
+ throw new \RuntimeException('Database isn\'t ready or populated yet');
}
Core\Config::load();
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once '.htconfig.php';
- $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');
+ if ($a->mode == \Friendica\App::MODE_INSTALL) {
+ throw new \RuntimeException('Database isn\'t ready or populated yet');
}
$nick = $this->getArgument(0);