HEX
Server: LiteSpeed
System: Linux srv1.dhviews.com 5.14.0-570.23.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 24 11:27:16 EDT 2025 x86_64
User: bdedition (1723)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //proc/thread-self/root/opt/cpvendor/bin/db_info
#!/usr/local/emps/bin/php
<?php

$ret['data']['mysql'] = [];
$ret['metadata']['result'] = 'ok';

include_once(__DIR__.'/inc.php');

// Get the MySQL root details
$access['login'] = 'root';
$access['password'] = trim(file_get_contents('/var/webuzo/my.conf'));
$access['host'] = 'localhost';
$access['port'] = 3306;

$ret['data']['mysql']['access'] = $access;

// Get the mapping i.e. the users list
$users = cl_user_list();
//print_r($users);

foreach($users as $user => $v){
	$mysql = @json_decode(file_get_contents($globals['users_path'].'/'.$user.'/mysql'), true);
	//echo $globals['users_path'].'/'.$user.'/mysql'."\n";
	
	if(empty($mysql['localhost']['dbusers'])){
		continue;
	}
	
	$ret['data']['mysql']['mapping'][$user] = array_keys($mysql['localhost']['dbusers']);
	
}

// CL needs this to be {} when the array is empty
if(empty($ret['data']['mysql']['mapping'])){
	$ret['data']['mysql']['mapping'] = (object) [];
}

echo json_encode($ret, JSON_PRETTY_PRINT)."\n";