HEX
Server: Apache/2.4.67 (Debian)
System: Linux hosting103 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User: muzikaecom (1013)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/local/share/hostingplatform/scripts/restoreMySQLDatabases
#!/usr/bin/env php
<?php
require_once("/usr/local/share/hostingplatform/esrpc.php");

$server = new ESRPCConnection();
$worker = new Worker($server->get());
$server->setTarget($worker);
$server->connect();
$server->serve();

class Worker {
	var $api;

	function __construct($api) {
		$this->api = $api;
	}

	function restoreMySQLDatabases($packagename, $version, $password) {
		if ($handle = opendir("/var/local/hostingplatform/snapshots/" . $packagename . "/" . $version . "/databases/mysql/")) {
		    while (false !== ($database = readdir($handle))) {

			if ($database != "." && $database != "..") {
			    shell_exec("cat /var/local/hostingplatform/snapshots/" . escapeshellcmd($packagename) . "/" . escapeshellcmd($version) . "/databases/mysql/" . escapeshellcmd($database) . "/*.sql | mysql -u" . escapeshellcmd($packagename) . " -p" . escapeshellcmd($password) . " " . escapeshellcmd($database));
			}
		    }
		    closedir($handle);
		}
		return true;
	}
}