[aur-dev] [PATCH 5/5] Remove unneeded database connection calls

canyonknight canyonknight at gmail.com
Sun Feb 3 11:26:32 EST 2013


Since all database related functions will establish a connection
when needed, there is no need to pre-emptively try and establish
a database connection.

Signed-off-by: canyonknight <canyonknight at gmail.com>
---
 web/html/account.php   | 1 -
 web/html/home.php      | 2 --
 web/html/logout.php    | 1 -
 web/html/pkgsubmit.php | 1 -
 4 files changed, 5 deletions(-)

diff --git a/web/html/account.php b/web/html/account.php
index 7cd0263..c367914 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -20,7 +20,6 @@ $action = in_request("Action");
 if (isset($_COOKIE["AURSID"])) {
 	# visitor is logged in
 	#
-	$dbh = DB::connect();
 	$atype = account_from_sid($_COOKIE["AURSID"]);
 
 	if ($action == "SearchAccounts") {
diff --git a/web/html/home.php b/web/html/home.php
index 8fccc7f..e4439d9 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -10,8 +10,6 @@ include_once('stats.inc.php');
 
 html_header( __("Home") );
 
-$dbh = DB::connect();
-
 ?>
 
 <div id="content-left-wrapper">
diff --git a/web/html/logout.php b/web/html/logout.php
index 3958c25..5e8e8f4 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -10,7 +10,6 @@ include_once("acctfuncs.inc.php");         # access AUR common functions
 # sending any HTML output.
 #
 if (isset($_COOKIE["AURSID"])) {
-	$dbh = DB::connect();
 	delete_session_id($_COOKIE["AURSID"]);
 	# setting expiration to 1 means '1 second after midnight January 1, 1970'
 	setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true);
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 12203c4..fefb31e 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -356,7 +356,6 @@ if ($uid):
 
 		# Update the backend database
 		if (!$error) {
-			$dbh = DB::connect();
 			begin_atomic_commit();
 
 			$pdata = pkgdetails_by_pkgname($new_pkgbuild['pkgname']);
-- 
1.8.1.2



More information about the aur-dev mailing list