Merge pull request #8556 from annando/close-db-connection

Added forgotten DBA::close
This commit is contained in:
Hypolite Petovan 2020-04-28 09:27:27 -04:00 committed by GitHub
commit a61f61a051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 26 additions and 3 deletions

View File

@ -68,7 +68,7 @@ function msearch_post(App $a)
$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'],
@ -77,6 +77,8 @@ function msearch_post(App $a)
];
}
DBA::close($search_stmt);
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
echo json_encode($output);

View File

@ -614,6 +614,7 @@ class Worker
}
}
}
DBA::close($entries);
}
/**

View File

@ -2057,6 +2057,7 @@ class Contact
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
}
DBA::close($duplicates);
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl]);
return true;
}
@ -2732,6 +2733,7 @@ class Contact
);
}
}
DBA::close($contacts);
}
/**

View File

@ -113,6 +113,7 @@ class GContact
$gcontacts[] = Contact::getDetailsByURL($result['nurl'], local_user());
}
DBA::close($results);
return $gcontacts;
}
@ -563,6 +564,7 @@ class GContact
PortableContact::loadWorker(0, 0, 0, $base);
}
}
DBA::close($contacts);
}
/**

View File

@ -85,7 +85,7 @@ class Process
self::deleteByPid($process['pid']);
}
}
DBA::close($processes);
DBA::commit();
}
}

View File

@ -44,7 +44,7 @@ class Search
while ($term = DBA::fetch($termsStmt)) {
$tags[] = trim($term['term'], '#');
}
DBA::close($termsStmt);
return $tags;
}
}

View File

@ -1298,6 +1298,7 @@ class User
$statistics['active_users_monthly']++;
}
}
DBA::close($userStmt);
return $statistics;
}

View File

@ -214,6 +214,7 @@ class UserItem
return true;
}
}
DBA::close($tags);
return false;
}

View File

@ -102,6 +102,7 @@ class DBSync extends BaseAdmin
$failed[] = $upd;
}
}
DBA::close($configStmt);
if (!count($failed)) {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [

View File

@ -121,6 +121,7 @@ class Site extends BaseAdmin
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.");

View File

@ -125,6 +125,7 @@ class Delegation extends BaseSettings
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]);

View File

@ -96,6 +96,7 @@ class Transmitter
while ($contact = DBA::fetch($contacts)) {
$list[] = $contact['url'];
}
DBA::close($contacts);
if (!empty($list)) {
$data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
@ -145,6 +146,7 @@ class Transmitter
while ($contact = DBA::fetch($contacts)) {
$list[] = $contact['url'];
}
DBA::close($contacts);
if (!empty($list)) {
$data['next'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1);

View File

@ -124,6 +124,7 @@ class Diaspora
while ($server = DBA::fetch($servers)) {
$serverlist[$server['url']] = $server['url'];
}
DBA::close($servers);
// All tags of the current post
$condition = ['otype' => Term::OBJECT_TYPE_POST, 'type' => Term::HASHTAG, 'oid' => $parent['parent']];
@ -132,6 +133,7 @@ class Diaspora
while ($tag = DBA::fetch($tags)) {
$taglist[] = $tag['term'];
}
DBA::close($tags);
// All servers who wants content with this tag
$tagserverlist = [];
@ -140,6 +142,7 @@ class Diaspora
while ($server = DBA::fetch($tagserver)) {
$tagserverlist[] = $server['gserver-id'];
}
DBA::close($tagserver);
}
// All adresses with the given id
@ -148,6 +151,7 @@ class Diaspora
while ($server = DBA::fetch($servers)) {
$serverlist[$server['url']] = $server['url'];
}
DBA::close($servers);
}
}
@ -1720,6 +1724,7 @@ class Diaspora
while ($contact = DBA::fetch($contacts)) {
Contact::remove($contact["id"]);
}
DBA::close($contacts);
DBA::delete('gcontact', ['addr' => $author]);

View File

@ -128,6 +128,7 @@ class CronJobs
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() "]);
@ -140,6 +141,7 @@ class CronJobs
DBA::delete('user', ['uid' => $user['uid']]);
}
DBA::close($users);
}
/**

View File

@ -96,5 +96,6 @@ class UpdateGContacts
return;
}
}
DBA::close($contacts);
}
}

View File

@ -52,5 +52,6 @@ class UpdateGServers
return;
}
}
DBA::close($gservers);
}
}