$perpage
);
- while($search_result = DBA::fetch($search_stmt)) {
+ while ($search_result = DBA::fetch($search_stmt)) {
$results[] = [
'name' => $search_result['name'],
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
];
}
+ DBA::close($search_stmt);
+
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
echo json_encode($output);
}
}
}
+ DBA::close($entries);
}
/**
/** @var PDO|mysqli */
protected $connection;
protected $driver;
+ private $emulate_prepares = false;
private $error = false;
private $errorno = 0;
private $affected_rows = 0;
return false;
}
+ $this->emulate_prepares = (bool)$this->configCache->get('database', 'emulate_prepares');
+
if (class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
$this->driver = 'pdo';
$connect = "mysql:host=" . $server . ";dbname=" . $db;
{
$offset = 0;
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]);
+ } elseif (is_null($args[$param])) {
+ $replace = 'NULL';
} else {
$replace = "'" . $this->escape($args[$param]) . "'";
}
switch ($this->driver) {
case 'pdo':
// If there are no arguments we use "query"
- if (count($args) == 0) {
- if (!$retval = $this->connection->query($sql)) {
+ if ($this->emulate_prepares || count($args) == 0) {
+ if (!$retval = $this->connection->query($this->replaceParameters($sql, $args))) {
$errorInfo = $this->connection->errorInfo();
$this->error = $errorInfo[2];
$this->errorno = $errorInfo[1];
$can_be_prepared = in_array($command, ['select', 'update', 'insert', 'delete']);
// 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));
if ($this->connection->errno) {
$this->error = $this->connection->error;
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
}
+ DBA::close($duplicates);
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl]);
return true;
}
);
}
}
+ DBA::close($contacts);
}
/**
$gcontacts[] = Contact::getDetailsByURL($result['nurl'], local_user());
}
+ DBA::close($results);
return $gcontacts;
}
PortableContact::loadWorker(0, 0, 0, $base);
}
}
+ DBA::close($contacts);
}
/**
self::deleteByPid($process['pid']);
}
}
-
+ DBA::close($processes);
DBA::commit();
}
}
while ($term = DBA::fetch($termsStmt)) {
$tags[] = trim($term['term'], '#');
}
-
+ DBA::close($termsStmt);
return $tags;
}
}
$statistics['active_users_monthly']++;
}
}
+ DBA::close($userStmt);
return $statistics;
}
return true;
}
}
+ DBA::close($tags);
return false;
}
$failed[] = $upd;
}
}
+ DBA::close($configStmt);
if (!count($failed)) {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
while ($user = DBA::fetch($usersStmt)) {
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
}
+ DBA::close($usersStmt);
info("Relocation started. Could take a while to complete.");
while ($contact = DBA::fetch($contacts)) {
$nicknames[] = $contact['nick'];
}
+ DBA::close($contacts);
// get user records for all potential page delegates who are not already delegates or managers
$potentialDelegateUsers = DBA::selectToArray('user', ['uid', 'username', 'nickname'], ['nickname' => $nicknames]);
while ($contact = DBA::fetch($contacts)) {
$list[] = $contact['url'];
}
+ DBA::close($contacts);
if (!empty($list)) {
$data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
while ($contact = DBA::fetch($contacts)) {
$list[] = $contact['url'];
}
+ DBA::close($contacts);
if (!empty($list)) {
$data['next'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1);
while ($server = DBA::fetch($servers)) {
$serverlist[$server['url']] = $server['url'];
}
+ DBA::close($servers);
// All tags of the current post
$tags = DBA::select('tag-view', ['name'], ['uri-id' => $parent['uri-id'], 'type' => Tag::HASHTAG]);
while ($server = DBA::fetch($tagserver)) {
$tagserverlist[] = $server['gserver-id'];
}
+ DBA::close($tagserver);
}
// All adresses with the given id
while ($server = DBA::fetch($servers)) {
$serverlist[$server['url']] = $server['url'];
}
+ DBA::close($servers);
}
}
while ($contact = DBA::fetch($contacts)) {
Contact::remove($contact["id"]);
}
+ DBA::close($contacts);
DBA::delete('gcontact', ['addr' => $author]);
while ($user = DBA::fetch($users)) {
User::remove($user['uid']);
}
+ DBA::close($users);
// delete user records for recently removed accounts
$users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() "]);
DBA::delete('user', ['uid' => $user['uid']]);
}
+ DBA::close($users);
}
/**
return;
}
}
+ DBA::close($contacts);
}
}
return;
}
}
+ DBA::close($gservers);
}
}