HEX
Server: Apache/2.2.22 (Debian)
System: Linux martin 3.2.0-6-amd64 #1 SMP Debian 3.2.102-1 x86_64
User: otzyv-tut.ru (515)
PHP: 7.1.20
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Upload Files
File: //usr/share/wwwconfig-common/pgsql-ifnot-exec.sh
#!/bin/sh
# File:		pgsql-ifnot-exec.sh
# Changes:
#	20010322 Ola Lundqvist <[email protected]>
#	20011022 Luca De Vitis <[email protected]>
#		Introduced the error variable.
#	        Added the -d flag to $pgsqlcmd (not really needed but clearer)
#	20020116 Ola Lundqvist <[email protected]>
#		Documented the error variable.
#	20020125 Ola Lundqvist <[email protected]>
#		Added new status code.
#	20020126 Ola Lundqvist <[email protected]>
#		Removed need for $dbadmin.
#	20051009 Ola Lundqvist <[email protected]>
#		Use dbuser=false on check and then set it to true when exec.
#		Thanks to Christoph Martin <[email protected]>.
# Needs:	$dbname    - the database that user should have access to (optional)
#		$dbserver  - the server to connect to.
#		$dbadmin   - the administrator name.
#		$dbadmpass - the administrator password (not supported).
#		$statement - the statement to test if it can get data.
#		which
#		psql
#		/usr/share/wwwconfig-common/pgsql.get
# Description:	First checks a statement. If that statement is not ok it executes the
#		script.
# Sets:		$status = {error, nothing, exec, execerror}
#		$error = error message (if $status = error)

status=error
error=""

. /usr/share/wwwconfig-common/pgsql.get

use_dbuser=false

if [ -z "$dbserver" ] ; then
    error="No database server specified."
elif [ ! -x $(which pgsql) ] ; then
    error="No pgsql client to execute, install the pgsql client package and
    run 'dpkg-reconfigure -plow packagename'."
elif ! eval $pgsqlcmd -d $systemdb -c "\"select usename from pg_shadow;\"" >/dev/null 2>&1 ; then
    error="Error when trying to connect to the pgsql database.
    This error can occur if you have no database to connect to, or
    if the password was incorrect.
	use: dpkg-reconfigure -plow packagename to reconfigure."
elif ! $pgsqlcmd -d $dbname -c "\"$statement\"" >/dev/null 2>&1 ; then
    log="${log}Executing command to pgsql."

    use_dbuser=true

    if $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then
	status=exec
    else
	status=execerror
	error="Unable to run the sql script ($sqlfile)."
    fi
else
    status=nothing
fi