From 41f234fd02eb025fd22a42d87e323d8e2b3e38cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20L=C3=BCscher?= Date: Sun, 15 Jan 2017 19:32:00 +0100 Subject: [PATCH] Remove unnecessary pg_free_result and pg_close calls. (#76) ah, never knew you did not Have to have them! --- api-more.php | 2 -- api.php | 3 --- cleanup.php | 2 -- db/add.php | 3 --- db/edit.php | 2 -- db/gettoken.php | 4 ---- db/kill.php | 3 --- db/pull.php | 3 --- db/saverating.php | 3 --- go.php | 2 -- rate.php | 2 -- show.php | 2 -- showfull.php | 2 -- showstats.php | 2 -- 14 files changed, 35 deletions(-) diff --git a/api-more.php b/api-more.php index b5902ee..fb5e5d8 100644 --- a/api-more.php +++ b/api-more.php @@ -32,5 +32,3 @@ while ($row = pg_fetch_array($result)) { echo 'Longitude: ' . $row['long'] . '
'; } } -pg_free_result($result); -pg_close($dbh); diff --git a/api.php b/api.php index afdeabc..102f04b 100644 --- a/api.php +++ b/api.php @@ -90,6 +90,3 @@ EOF; ); } } - -pg_free_result($result); -pg_close($dbh); diff --git a/cleanup.php b/cleanup.php index 2df43cf..d72ddad 100644 --- a/cleanup.php +++ b/cleanup.php @@ -97,8 +97,6 @@ $numrows = pg_num_rows($result); '; } - pg_free_result($result); - pg_close($dbh); ?> diff --git a/db/add.php b/db/add.php index b664cd2..f07e932 100644 --- a/db/add.php +++ b/db/add.php @@ -80,9 +80,6 @@ if (stristr($outputssl, 'nodeName')) { echo 'Data successfully inserted! Your pod will be reviewed and live on the list in a few hours!'; - pg_free_result($result); - - pg_close($dbh); } else { $log->lwrite('Could not validate your pod, check your setup! ' . $_domain); echo 'Could not validate your pod, check your setup!
Take a look at your /nodeinfo'; diff --git a/db/edit.php b/db/edit.php index 5723043..d93bf25 100644 --- a/db/edit.php +++ b/db/edit.php @@ -49,8 +49,6 @@ while ($row = pg_fetch_array($result)) { $message = 'Data for ' . $_domain . " Updated. If it was not you reply and let me know! \n\n"; $headers = "From: " . $adminemail . "\r\nCc:" . $adminemail . "," . $_oldemail . "\r\n"; @mail($to, $subject, $message, $headers); - pg_free_result($result); - pg_close($dbh); die('Data saved. Will go into effect on next hourly change'); } diff --git a/db/gettoken.php b/db/gettoken.php index b4e93c9..16a5c31 100644 --- a/db/gettoken.php +++ b/db/gettoken.php @@ -49,8 +49,4 @@ while ($row = pg_fetch_array($result)) { @mail($to, $subject, $message, $headers); echo 'Link sent to administrator to review and verify, if approved they will forward the edit key to you.'; } - - pg_free_result($result); } - -pg_close($dbh); diff --git a/db/kill.php b/db/kill.php index 6d3da4e..242f65b 100644 --- a/db/kill.php +++ b/db/kill.php @@ -33,7 +33,6 @@ while ($row = pg_fetch_array($result)) { $headers = "From: " . $adminemail ."\r\nCc:" . $adminemail . "," . $row['email'] . "\r\n"; @mail($to, $subject, $message, $headers); } - pg_free_result($result); } elseif ($_action === 'warn') { if ($row['email']) { $to = $row['email']; @@ -46,5 +45,3 @@ while ($row = pg_fetch_array($result)) { echo $result; } - -pg_close($dbh); diff --git a/db/pull.php b/db/pull.php index 2b0fdff..96b4b78 100644 --- a/db/pull.php +++ b/db/pull.php @@ -89,7 +89,6 @@ while ($row = pg_fetch_all($result)) { if ($admindb == - 1) { $admin_rating = - 1; } - pg_free_result($ratings); unset($name); unset($total_users); unset($active_users_halfyear); @@ -289,5 +288,3 @@ while ($row = pg_fetch_all($result)) { //end foreach } } -pg_free_result($result); -pg_close($dbh); diff --git a/db/saverating.php b/db/saverating.php index a207cc1..caa1a37 100644 --- a/db/saverating.php +++ b/db/saverating.php @@ -25,6 +25,3 @@ $message = 'Pod:' . $_domain . $_domain . $_username . $_userurl . $_comment . $ $headers = 'From: ' . $_email . "\r\n"; @mail($to, $subject, $message, $headers); echo 'Comment posted!'; - -pg_free_result($result); -pg_close($dbh); diff --git a/go.php b/go.php index 063a556..5e21db0 100644 --- a/go.php +++ b/go.php @@ -35,5 +35,3 @@ if ($_url) { header('Location:https://' . $row[0]['domain'] . '/users/sign_up'); } - pg_free_result($result); - pg_close($dbh); diff --git a/rate.php b/rate.php index ea240ac..9451b01 100644 --- a/rate.php +++ b/rate.php @@ -90,5 +90,3 @@ XMPP chat server'; echo ''; } - pg_free_result($result); - pg_close($dbh); ?> diff --git a/showfull.php b/showfull.php index 6256fb1..a7df179 100644 --- a/showfull.php +++ b/showfull.php @@ -93,8 +93,6 @@ $numrows = pg_num_rows($result); $row['service_xmpp'] === 't' && print ''; echo ''; } - pg_free_result($result); - pg_close($dbh); ?> diff --git a/showstats.php b/showstats.php index 8ccc080..f140b3b 100644 --- a/showstats.php +++ b/showstats.php @@ -48,5 +48,3 @@ if ($uptr->monitors[0]->status == 9) { $live = 'Down'; } echo 'Status: ' . $live; -pg_free_result($result); -pg_close($dbh); -- GitLab