Files
cacti/scripts/sql.php
T
netniV 89f0a06216 Resolving issue #2304 and #2311
This commit corrects a previous unseen issue where the PHP environment at command line level is being populated with environment variables normally only seen when called from a web server.

issue#2304: Installation progress stays at 0%
issue#2311: Unable to update PHP location during installation due to incorrect CLI environment

The new check uses the php_sapi_name() function to verify that we are indeed at 'cli' level.  All other values returned by php_sapi_name are considered non-cli including 'cli-server' which is for client/server scenarios.

Most checks have now been replaced by a single defintion ('CACTI_CLI') to define whether in CLI mode.  If a script is only to be called from CLI it must either defined 'CACTI_CLI_ONLY' or include include/cli_check.php instead of include/global.php.
2019-01-15 13:57:50 +00:00

18 lines
431 B
PHP

<?
/* do NOT run this script through a web browser */
$no_http_headers = true;
error_reporting(0);
include(dirname(__FILE__) . '/../include/cli_check.php');
if ($database_password == '') {
$sql = `mysqladmin -h $database_hostname -u $database_username status | awk '{print $6 }'`;
} else {
$sql = `mysqladmin -h $database_hostname -u $database_username -p$database_password status | awk '{print $6 }'`;
}
print trim($sql);