19declare(strict_types=1);
21use Ifsnop\Mysqldump\Mysqldump;
27 public function __construct(
protected ?
string $export_hooks_path)
39 if (!is_null($this->export_hooks_path) && !is_readable($this->export_hooks_path)) {
40 throw new Exception(
"Export hooks file '$this->export_hooks_path' is not readable.");
44 $dumper =
new Mysqldump(
45 "mysql:host=$host;port=$port;dbname=$name",
48 [
'add-drop-table' =>
true]
50 if (!is_null($this->export_hooks_path)) {
51 include $this->export_hooks_path;
53 $dumper->start($target .
"/" . self::FILE_NAME);
54 }
catch (\Exception
$e) {
55 throw new Exception(
"Error during sql dump: " .
$e->getMessage(),
$e->getCode(),
$e);
createDump(string $host, string $user, string $password, string $name, string $port, string $target)
__construct(protected ?string $export_hooks_path)
if(!file_exists('../ilias.ini.php'))