Update use statement lists with new Friendica\Database\dba class
- Remove unused use statement - Remove superfluous use statements (classes in the same namespace) - Add missing use statements
This commit is contained in:
@@ -6,27 +6,13 @@
|
||||
|
||||
namespace Friendica\Core;
|
||||
|
||||
use dba;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Util\Network;
|
||||
use const CONTACT_IS_FRIEND;
|
||||
use const NETWORK_DFRN;
|
||||
use const NETWORK_DIASPORA;
|
||||
use const NETWORK_FACEBOOK;
|
||||
use const NETWORK_MAIL;
|
||||
use const NETWORK_OSTATUS;
|
||||
use const PHP_EOL;
|
||||
use function dbesc;
|
||||
use function defaults;
|
||||
use function get_markup_template;
|
||||
use function get_server;
|
||||
use function local_user;
|
||||
use function remote_user;
|
||||
use function replace_macros;
|
||||
|
||||
/**
|
||||
* Handle ACL management and display
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
*/
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Core\Worker;
|
||||
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -228,12 +226,12 @@ class Addon
|
||||
/**
|
||||
* @brief Calls a single hook.
|
||||
*
|
||||
* @param \Friendica\App $a
|
||||
* @param App $a
|
||||
* @param string $name of the hook to call
|
||||
* @param array $hook Hook data
|
||||
* @param string|array &$data to transmit to the callback handler
|
||||
*/
|
||||
public static function callSingleHook(\Friendica\App $a, $name, $hook, &$data = null)
|
||||
public static function callSingleHook(App $a, $name, $hook, &$data = null)
|
||||
{
|
||||
// Don't run a theme's hook if the user isn't using the theme
|
||||
if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . $a->getCurrentTheme()) === false) {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Friendica\Core\Cache;
|
||||
|
||||
use dba;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use dba;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use dba;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use dba;
|
||||
use Exception;
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use dba;
|
||||
use Exception;
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use dba;
|
||||
use Friendica\Database\dba;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @brief tool to archive a contact on the server
|
||||
@@ -55,19 +57,19 @@ HELP;
|
||||
}
|
||||
|
||||
if ($a->mode === App::MODE_INSTALL) {
|
||||
throw new \RuntimeException('Friendica isn\'t properly installed yet.');
|
||||
throw new RuntimeException('Friendica isn\'t properly installed yet.');
|
||||
}
|
||||
|
||||
$nurl = normalise_link($this->getArgument(0));
|
||||
if (!dba::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
|
||||
throw new \RuntimeException(L10n::t('Could not find any unarchived contact entry for this URL (%s)', $nurl));
|
||||
throw new RuntimeException(L10n::t('Could not find any unarchived contact entry for this URL (%s)', $nurl));
|
||||
}
|
||||
if (dba::update('contact', ['archive' => true], ['nurl' => $nurl])) {
|
||||
$condition = ["`cid` IN (SELECT `id` FROM `contact` WHERE `archive`)"];
|
||||
dba::delete('queue', $condition);
|
||||
$this->out(L10n::t('The contact entries have been archived'));
|
||||
} else {
|
||||
throw new \RuntimeException('The contact archival failed.');
|
||||
throw new RuntimeException('The contact archival failed.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Asika\SimpleConsole\Console;
|
||||
use dba;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Install;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\dba;
|
||||
use RuntimeException;
|
||||
|
||||
require_once 'mod/install.php';
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Asika\SimpleConsole\CommandArgsException;
|
||||
use dba;
|
||||
use Friendica\App;
|
||||
use Friendica\Core;
|
||||
use RuntimeException;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/text.php';
|
||||
@@ -92,7 +93,7 @@ HELP;
|
||||
throw new CommandArgsException('Too many arguments');
|
||||
}
|
||||
|
||||
if (!($a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||
if (!($a->mode & App::MODE_DBCONFIGAVAILABLE)) {
|
||||
$this->out('Database isn\'t ready or populated yet, showing file config only');
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ HELP;
|
||||
$value = $this->getArgument(2);
|
||||
|
||||
if (is_array(Core\Config::get($cat, $key))) {
|
||||
throw new \RuntimeException("$cat.$key is an array and can't be set using this command.");
|
||||
throw new RuntimeException("$cat.$key is an array and can't be set using this command.");
|
||||
}
|
||||
|
||||
$result = Core\Config::set($cat, $key, $value);
|
||||
@@ -151,7 +152,7 @@ HELP;
|
||||
if (count($this->args) == 0) {
|
||||
Core\Config::load();
|
||||
|
||||
if (Core\Config::get('system', 'config_adapter') == 'jit' && $a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE) {
|
||||
if (Core\Config::get('system', 'config_adapter') == 'jit' && $a->mode & App::MODE_DBCONFIGAVAILABLE) {
|
||||
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\Core;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBStructure;
|
||||
use RuntimeException;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
@@ -56,8 +58,8 @@ HELP;
|
||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||
}
|
||||
|
||||
if (!\dba::connected()) {
|
||||
throw new \RuntimeException('Unable to connect to database');
|
||||
if (!dba::connected()) {
|
||||
throw new RuntimeException('Unable to connect to database');
|
||||
}
|
||||
|
||||
Core\Config::load();
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use RuntimeException;
|
||||
|
||||
require_once 'include/text.php';
|
||||
|
||||
@@ -65,7 +67,7 @@ HELP;
|
||||
}
|
||||
|
||||
if ($a->isInstallMode()) {
|
||||
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||
throw new RuntimeException('Database isn\'t ready or populated yet');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,16 +77,16 @@ HELP;
|
||||
* */
|
||||
$net = Probe::uri($this->getArgument(0));
|
||||
if (in_array($net['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
|
||||
throw new \RuntimeException('This account seems not to exist.');
|
||||
throw new RuntimeException('This account seems not to exist.');
|
||||
}
|
||||
|
||||
$nurl = normalise_link($net['url']);
|
||||
$contact = \dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||
$contact = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||
if (DBM::is_result($contact)) {
|
||||
\dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
|
||||
dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
|
||||
$this->out('NOTICE: The account should be silenced from the global community page');
|
||||
} else {
|
||||
throw new \RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');
|
||||
throw new RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace Friendica\Core\Console;
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use dba;
|
||||
use Friendica\Model\User;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @brief tool to set a new password for a user
|
||||
@@ -59,14 +59,14 @@ HELP;
|
||||
}
|
||||
|
||||
if ($a->isInstallMode()) {
|
||||
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||
throw new RuntimeException('Database isn\'t ready or populated yet');
|
||||
}
|
||||
|
||||
$nick = $this->getArgument(0);
|
||||
|
||||
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
|
||||
if (!DBM::is_result($user)) {
|
||||
throw new \RuntimeException(L10n::t('User not found'));
|
||||
throw new RuntimeException(L10n::t('User not found'));
|
||||
}
|
||||
|
||||
$password = $this->getArgument(1);
|
||||
@@ -76,15 +76,15 @@ HELP;
|
||||
}
|
||||
|
||||
if (!$password) {
|
||||
throw new \RuntimeException(L10n::t('Password can\'t be empty'));
|
||||
throw new RuntimeException(L10n::t('Password can\'t be empty'));
|
||||
}
|
||||
|
||||
if (!Config::get('system', 'disable_password_exposed', false) && User::isPasswordExposed($password)) {
|
||||
throw new \RuntimeException(L10n::t('The new password has been exposed in a public data dump, please choose another.'));
|
||||
throw new RuntimeException(L10n::t('The new password has been exposed in a public data dump, please choose another.'));
|
||||
}
|
||||
|
||||
if (!User::updatePassword($user['uid'], $password)) {
|
||||
throw new \RuntimeException(L10n::t('Password update failed. Please try again.'));
|
||||
throw new RuntimeException(L10n::t('Password update failed. Please try again.'));
|
||||
}
|
||||
|
||||
$this->out(L10n::t('Password changed.'));
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use dba;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\dba;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
@@ -14,7 +14,7 @@ require_once 'include/dba.php';
|
||||
* Provide Languange, Translation, and Localisation functions to the application
|
||||
* Localisation can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").
|
||||
*/
|
||||
class L10n extends \Friendica\BaseObject
|
||||
class L10n extends BaseObject
|
||||
{
|
||||
/**
|
||||
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Friendica\Core\Lock;
|
||||
|
||||
use dba;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
||||
@@ -9,17 +9,12 @@ namespace Friendica\Core;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Friendica\Core\Session;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use SessionHandlerInterface;
|
||||
use dba;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
|
||||
@@ -5,14 +5,9 @@
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
use dba;
|
||||
|
||||
require_once "include/dba.php";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
namespace Friendica\Core;
|
||||
|
||||
use dba;
|
||||
use Friendica\Database\dba;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Process;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
Reference in New Issue
Block a user