From 1108bf7d8679b85b7aa9f829019acf4dc8210dd3 Mon Sep 17 00:00:00 2001 From: Eric Stadtherr Date: Fri, 20 Jul 2018 21:06:09 -0600 Subject: [PATCH] PR review changes --- docs/admin/Faq.md | 2 +- lib/cmd.php | 18 ++++++++++++++++++ utils/setup.php | 17 ----------------- utils/update.php | 23 +++-------------------- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/docs/admin/Faq.md b/docs/admin/Faq.md index 5fb0d9ae..f3ad670a 100644 --- a/docs/admin/Faq.md +++ b/docs/admin/Faq.md @@ -112,7 +112,7 @@ to get the full error message. On CentOS v7 the PostgreSQL server is started with `systemd`. Check if `/usr/lib/systemd/system/httpd.service` contains a line `PrivateTmp=true`. If so then Apache cannot see the `/tmp/.s.PGSQL.5432` file. It's a good security feature, -so use the [[#PostgreSQL_UNIX_Socket_Location_on_CentOS|preferred solution]] +so use the [preferred solution](../appendix/Install-on-Centos-7/#adding-selinux-security-settings). However, you can solve this the quick and dirty way by commenting out that line and then run diff --git a/lib/cmd.php b/lib/cmd.php index 8ccbb036..2fd3c49b 100644 --- a/lib/cmd.php +++ b/lib/cmd.php @@ -196,3 +196,21 @@ function runSQLScript($sScript, $bfatal = true, $bVerbose = false, $bIgnoreError fail("pgsql returned with error code ($iReturn)"); } } + + +function runWithEnv($cmd, $env) +{ + $fds = array(0 => array('pipe', 'r'), + 1 => STDOUT, + 2 => STDERR); + $pipes = null; + $proc = @proc_open($cmd, $fds, $pipes, null, $env); + if (!is_resource($proc)) { + fail('unable to run command:' . $cmd); + } + + fclose($pipes[0]); // no stdin + + $stat = proc_close($proc); + return $stat; +} diff --git a/utils/setup.php b/utils/setup.php index eb18d0f2..106be616 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -916,23 +916,6 @@ function passthruCheckReturn($cmd) passthru($cmd, $result); } -function runWithEnv($cmd, $env) -{ - $fds = array(0 => array('pipe', 'r'), - 1 => STDOUT, - 2 => STDERR); - $pipes = null; - $proc = @proc_open($cmd, $fds, $pipes, null, $env); - if (!is_resource($proc)) { - fail('unable to run command:' . $cmd); - } - - fclose($pipes[0]); // no stdin - - $stat = proc_close($proc); - return $stat; -} - function replace_tablespace($sTemplate, $sTablespace, $sSql) { if ($sTablespace) { diff --git a/utils/update.php b/utils/update.php index 40c72535..c79aef1d 100755 --- a/utils/update.php +++ b/utils/update.php @@ -122,8 +122,8 @@ if ($aResult['init-updates']) { } pg_query($oDB->connection, 'TRUNCATE import_status'); - $sSQL = 'INSERT INTO import_status (lastimportdate, sequence_id, indexed) VALUES('; - $sSQL .= "'".$sDatabaseDate."',".$aOutput[0].', true)'; + $sSQL = "INSERT INTO import_status (lastimportdate, sequence_id, indexed) VALUES('"; + $sSQL .= $sDatabaseDate."',".$aOutput[0].', true)'; if (!pg_query($oDB->connection, $sSQL)) { fail('Could not enter sequence into database.'); } @@ -428,7 +428,7 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { $oDB->query($sSQL); echo date('Y-m-d H:i:s')." Completed index step for $sBatchEnd in ".round((time()-$fCMDStartTime)/60, 2)." minutes\n"; - $sSQL = 'UPDATE import_status SET indexed = true'; + $sSQL = 'update import_status set indexed = true'; $oDB->query($sSQL); } @@ -437,20 +437,3 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { if (!$aResult['import-osmosis-all']) exit(0); } } - -function runWithEnv($cmd, $env) -{ - $fds = array(0 => array('pipe', 'r'), - 1 => STDOUT, - 2 => STDERR); - $pipes = null; - $proc = @proc_open($cmd, $fds, $pipes, null, $env); - if (!is_resource($proc)) { - fail('unable to run command:' . $cmd); - } - - fclose($pipes[0]); // no stdin - - $stat = proc_close($proc); - return $stat; -} -- 2.39.5