if ($format === 'sql'
) { $this->
Response()->headers->
set('content-type: text/plain', ''
);
$this->
Response()->headers->
set('content-disposition', 'attachment; filename="export.sql"'
);
$sql = 'SELECT * FROM s_core_snippets ORDER BY namespace';
$result =
$this->database->
query($sql);
$rows =
[];
echo "REPLACE INTO `s_core_snippets` (`namespace`, `name`, `value`, `localeID`, `shopID`,`created`, `updated`, `dirty`) VALUES \r\n";
foreach ($result->
fetchAll() as $row) { $value =
$this->database->
quote($row['value'
]);
$value =
str_replace("\n", '\\n',
$value);
$rows[] =
sprintf( "(%s, %s, %s, '%s', '%s', '%s', NOW(), %d)",
$this->database->
quote($row['namespace'
]),
$this->database->
quote($row['name'
]),
$value,
(int) $row['localeID'
],
(int) $row['shopID'
],
$row['created'
],
$row['dirty'
] );