mirror of
https://github.com/retailcrm/legacy.git
synced 2024-11-22 13:26:03 +03:00
add support dump pgsql
This commit is contained in:
parent
5fe9ed3045
commit
1d2ca95216
@ -62,13 +62,30 @@ class Command
|
|||||||
$dbName = $this->container->settings['db']['dbname'];
|
$dbName = $this->container->settings['db']['dbname'];
|
||||||
$dbHost = $this->container->settings['db']['host'];
|
$dbHost = $this->container->settings['db']['host'];
|
||||||
|
|
||||||
$dumpfile = sprintf('%sdbdump.sql.gz', $this->container->saveDir);
|
switch ($this->container->settings['db']['driver']) {
|
||||||
|
case 'mysql':
|
||||||
|
$cmd = sprintf(
|
||||||
|
'mysqldump -u %s --password=%s --host=%s %s',
|
||||||
|
$dbUser, $dbPass, $dbHost, $dbName
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'pgsql':
|
||||||
|
$cmd = sprintf(
|
||||||
|
'PGPASSWORD=\'%s\' pg_dump -U %s -h %s %s',
|
||||||
|
$dbPass, $dbUser, $dbHost, $dbName
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CommandHelper::dumpNotice();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$cmd = sprintf(
|
passthru(
|
||||||
'mysqldump -u %s --password=%s --host=%s %s | gzip --best > %s',
|
sprintf(
|
||||||
$dbUser, $dbPass, $dbHost, $dbName, $dumpfile
|
'%s | gzip --best > %sdbdump.sql.gz',
|
||||||
|
$cmd, $this->container->saveDir
|
||||||
|
)
|
||||||
);
|
);
|
||||||
passthru($cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function runIcml()
|
public function runIcml()
|
||||||
|
@ -25,6 +25,11 @@ class CommandHelper
|
|||||||
echo " -h\t\tHistory type, if type is set only this history will be recieved\n";
|
echo " -h\t\tHistory type, if type is set only this history will be recieved\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dumpNotice()
|
||||||
|
{
|
||||||
|
echo "\033[0;31mUnfortunately for the database can not be used to make the dump\033[0m\n";
|
||||||
|
}
|
||||||
|
|
||||||
public static function updateNotice()
|
public static function updateNotice()
|
||||||
{
|
{
|
||||||
echo "\033[0;31mFull update is not allowed, please select one of the following flags: limit, set of identifiers or a specific id\033[0m\n";
|
echo "\033[0;31mFull update is not allowed, please select one of the following flags: limit, set of identifiers or a specific id\033[0m\n";
|
||||||
|
@ -45,4 +45,4 @@ class DebugHelper
|
|||||||
{
|
{
|
||||||
echo sprintf("%s\t%s\t%s%s", $string, $this->getCpuUsage(), $this->getMemoryUsage(), PHP_EOL);
|
echo sprintf("%s\t%s\t%s%s", $string, $this->getCpuUsage(), $this->getMemoryUsage(), PHP_EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user