Merge
This commit is contained in:
parent
c2a9b3b9e9
commit
70e5639e29
17 changed files with 34 additions and 7 deletions
|
@ -68,7 +68,7 @@ function msearch_post(App $a)
|
||||||
$perpage
|
$perpage
|
||||||
);
|
);
|
||||||
|
|
||||||
while($search_result = DBA::fetch($search_stmt)) {
|
while ($search_result = DBA::fetch($search_stmt)) {
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'name' => $search_result['name'],
|
'name' => $search_result['name'],
|
||||||
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
|
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
|
||||||
|
@ -77,6 +77,8 @@ function msearch_post(App $a)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBA::close($search_stmt);
|
||||||
|
|
||||||
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
|
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
|
||||||
|
|
||||||
echo json_encode($output);
|
echo json_encode($output);
|
||||||
|
|
|
@ -614,6 +614,7 @@ class Worker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,6 +57,7 @@ class Database
|
||||||
/** @var PDO|mysqli */
|
/** @var PDO|mysqli */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
protected $driver;
|
protected $driver;
|
||||||
|
private $emulate_prepares = false;
|
||||||
private $error = false;
|
private $error = false;
|
||||||
private $errorno = 0;
|
private $errorno = 0;
|
||||||
private $affected_rows = 0;
|
private $affected_rows = 0;
|
||||||
|
@ -130,6 +131,8 @@ class Database
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->emulate_prepares = (bool)$this->configCache->get('database', 'emulate_prepares');
|
||||||
|
|
||||||
if (class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
|
if (class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
|
||||||
$this->driver = 'pdo';
|
$this->driver = 'pdo';
|
||||||
$connect = "mysql:host=" . $server . ";dbname=" . $db;
|
$connect = "mysql:host=" . $server . ";dbname=" . $db;
|
||||||
|
@ -428,8 +431,10 @@ class Database
|
||||||
{
|
{
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
foreach ($args AS $param => $value) {
|
foreach ($args AS $param => $value) {
|
||||||
if (is_int($args[$param]) || is_float($args[$param])) {
|
if (is_int($args[$param]) || is_float($args[$param]) || is_bool($args[$param])) {
|
||||||
$replace = intval($args[$param]);
|
$replace = intval($args[$param]);
|
||||||
|
} elseif (is_null($args[$param])) {
|
||||||
|
$replace = 'NULL';
|
||||||
} else {
|
} else {
|
||||||
$replace = "'" . $this->escape($args[$param]) . "'";
|
$replace = "'" . $this->escape($args[$param]) . "'";
|
||||||
}
|
}
|
||||||
|
@ -515,8 +520,8 @@ class Database
|
||||||
switch ($this->driver) {
|
switch ($this->driver) {
|
||||||
case 'pdo':
|
case 'pdo':
|
||||||
// If there are no arguments we use "query"
|
// If there are no arguments we use "query"
|
||||||
if (count($args) == 0) {
|
if ($this->emulate_prepares || count($args) == 0) {
|
||||||
if (!$retval = $this->connection->query($sql)) {
|
if (!$retval = $this->connection->query($this->replaceParameters($sql, $args))) {
|
||||||
$errorInfo = $this->connection->errorInfo();
|
$errorInfo = $this->connection->errorInfo();
|
||||||
$this->error = $errorInfo[2];
|
$this->error = $errorInfo[2];
|
||||||
$this->errorno = $errorInfo[1];
|
$this->errorno = $errorInfo[1];
|
||||||
|
@ -562,7 +567,7 @@ class Database
|
||||||
$can_be_prepared = in_array($command, ['select', 'update', 'insert', 'delete']);
|
$can_be_prepared = in_array($command, ['select', 'update', 'insert', 'delete']);
|
||||||
|
|
||||||
// The fallback routine is called as well when there are no arguments
|
// The fallback routine is called as well when there are no arguments
|
||||||
if (!$can_be_prepared || (count($args) == 0)) {
|
if ($this->emulate_prepares || !$can_be_prepared || (count($args) == 0)) {
|
||||||
$retval = $this->connection->query($this->replaceParameters($sql, $args));
|
$retval = $this->connection->query($this->replaceParameters($sql, $args));
|
||||||
if ($this->connection->errno) {
|
if ($this->connection->errno) {
|
||||||
$this->error = $this->connection->error;
|
$this->error = $this->connection->error;
|
||||||
|
|
|
@ -2057,6 +2057,7 @@ class Contact
|
||||||
|
|
||||||
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
||||||
}
|
}
|
||||||
|
DBA::close($duplicates);
|
||||||
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl]);
|
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2732,6 +2733,7 @@ class Contact
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -113,6 +113,7 @@ class GContact
|
||||||
|
|
||||||
$gcontacts[] = Contact::getDetailsByURL($result['nurl'], local_user());
|
$gcontacts[] = Contact::getDetailsByURL($result['nurl'], local_user());
|
||||||
}
|
}
|
||||||
|
DBA::close($results);
|
||||||
return $gcontacts;
|
return $gcontacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,6 +564,7 @@ class GContact
|
||||||
PortableContact::loadWorker(0, 0, 0, $base);
|
PortableContact::loadWorker(0, 0, 0, $base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Process
|
||||||
self::deleteByPid($process['pid']);
|
self::deleteByPid($process['pid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($processes);
|
||||||
DBA::commit();
|
DBA::commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Search
|
||||||
while ($term = DBA::fetch($termsStmt)) {
|
while ($term = DBA::fetch($termsStmt)) {
|
||||||
$tags[] = trim($term['term'], '#');
|
$tags[] = trim($term['term'], '#');
|
||||||
}
|
}
|
||||||
|
DBA::close($termsStmt);
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1298,6 +1298,7 @@ class User
|
||||||
$statistics['active_users_monthly']++;
|
$statistics['active_users_monthly']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($userStmt);
|
||||||
|
|
||||||
return $statistics;
|
return $statistics;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,7 @@ class UserItem
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($tags);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ class DBSync extends BaseAdmin
|
||||||
$failed[] = $upd;
|
$failed[] = $upd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($configStmt);
|
||||||
|
|
||||||
if (!count($failed)) {
|
if (!count($failed)) {
|
||||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
|
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
|
||||||
|
|
|
@ -121,6 +121,7 @@ class Site extends BaseAdmin
|
||||||
while ($user = DBA::fetch($usersStmt)) {
|
while ($user = DBA::fetch($usersStmt)) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
||||||
}
|
}
|
||||||
|
DBA::close($usersStmt);
|
||||||
|
|
||||||
info("Relocation started. Could take a while to complete.");
|
info("Relocation started. Could take a while to complete.");
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ class Delegation extends BaseSettings
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$nicknames[] = $contact['nick'];
|
$nicknames[] = $contact['nick'];
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
|
|
||||||
// get user records for all potential page delegates who are not already delegates or managers
|
// get user records for all potential page delegates who are not already delegates or managers
|
||||||
$potentialDelegateUsers = DBA::selectToArray('user', ['uid', 'username', 'nickname'], ['nickname' => $nicknames]);
|
$potentialDelegateUsers = DBA::selectToArray('user', ['uid', 'username', 'nickname'], ['nickname' => $nicknames]);
|
||||||
|
|
|
@ -96,6 +96,7 @@ class Transmitter
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$list[] = $contact['url'];
|
$list[] = $contact['url'];
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
|
|
||||||
if (!empty($list)) {
|
if (!empty($list)) {
|
||||||
$data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
|
$data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
|
||||||
|
@ -145,6 +146,7 @@ class Transmitter
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$list[] = $contact['url'];
|
$list[] = $contact['url'];
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
|
|
||||||
if (!empty($list)) {
|
if (!empty($list)) {
|
||||||
$data['next'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1);
|
$data['next'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1);
|
||||||
|
|
|
@ -122,6 +122,7 @@ class Diaspora
|
||||||
while ($server = DBA::fetch($servers)) {
|
while ($server = DBA::fetch($servers)) {
|
||||||
$serverlist[$server['url']] = $server['url'];
|
$serverlist[$server['url']] = $server['url'];
|
||||||
}
|
}
|
||||||
|
DBA::close($servers);
|
||||||
|
|
||||||
// All tags of the current post
|
// All tags of the current post
|
||||||
$tags = DBA::select('tag-view', ['name'], ['uri-id' => $parent['uri-id'], 'type' => Tag::HASHTAG]);
|
$tags = DBA::select('tag-view', ['name'], ['uri-id' => $parent['uri-id'], 'type' => Tag::HASHTAG]);
|
||||||
|
@ -138,6 +139,7 @@ class Diaspora
|
||||||
while ($server = DBA::fetch($tagserver)) {
|
while ($server = DBA::fetch($tagserver)) {
|
||||||
$tagserverlist[] = $server['gserver-id'];
|
$tagserverlist[] = $server['gserver-id'];
|
||||||
}
|
}
|
||||||
|
DBA::close($tagserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// All adresses with the given id
|
// All adresses with the given id
|
||||||
|
@ -146,6 +148,7 @@ class Diaspora
|
||||||
while ($server = DBA::fetch($servers)) {
|
while ($server = DBA::fetch($servers)) {
|
||||||
$serverlist[$server['url']] = $server['url'];
|
$serverlist[$server['url']] = $server['url'];
|
||||||
}
|
}
|
||||||
|
DBA::close($servers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1718,6 +1721,7 @@ class Diaspora
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
Contact::remove($contact["id"]);
|
Contact::remove($contact["id"]);
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
|
|
||||||
DBA::delete('gcontact', ['addr' => $author]);
|
DBA::delete('gcontact', ['addr' => $author]);
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ class CronJobs
|
||||||
while ($user = DBA::fetch($users)) {
|
while ($user = DBA::fetch($users)) {
|
||||||
User::remove($user['uid']);
|
User::remove($user['uid']);
|
||||||
}
|
}
|
||||||
|
DBA::close($users);
|
||||||
|
|
||||||
// delete user records for recently removed accounts
|
// delete user records for recently removed accounts
|
||||||
$users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() "]);
|
$users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() "]);
|
||||||
|
@ -140,6 +141,7 @@ class CronJobs
|
||||||
|
|
||||||
DBA::delete('user', ['uid' => $user['uid']]);
|
DBA::delete('user', ['uid' => $user['uid']]);
|
||||||
}
|
}
|
||||||
|
DBA::close($users);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -96,5 +96,6 @@ class UpdateGContacts
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,5 +52,6 @@ class UpdateGServers
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBA::close($gservers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue