With using the CraftCMS builtin database export feature, is it possible to specify the export config to have the file in .gzip
instead of just .zip
? If, yes, then how can I do it?
1 Answer
Nope, the UtilitiesController is hard-coded to use .zip
:
$zip = new ZipArchive();
if ($zip->open($zipPath, ZipArchive::CREATE) !== true) {
throw new Exception('Cannot create zip at ' . $zipPath);
}
$filename = pathinfo($backupPath, PATHINFO_BASENAME);
$zip->addFile($backupPath, $filename);
$zip->close();
return Craft::$app->getResponse()->sendFile($zipPath, null, [
'mimeType' => 'application/zip',
]);
-
Thanks for a prompt answer! I am using Sequel Pro for the local development and it does not allow the import of
zip
files but works fine withgzip
. I assume it is a common practice to import gzipped databases. Is there a way to import zipped databases? Commented May 31, 2020 at 6:05 -
@alljamin: Just unzip the file before loading into Sequel Pro. Unlike PHP-based web tools eg phpmyadmin, larger file sizes won't choke on import if that's what you're worried about. Commented May 31, 2020 at 20:05
-
@RitterKnight my concern with
zip
format is an inconvenience of having to unzip in order to import, wherewithgzip
I can import without unzipping. Commented Jun 3, 2020 at 9:30 -