1

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?

backup

1

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',
        ]);

4
  • 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 with gzip. I assume it is a common practice to import gzipped databases. Is there a way to import zipped databases?
    – alljamin
    May 31 '20 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. May 31 '20 at 20:05
  • @RitterKnight my concern with zip format is an inconvenience of having to unzip in order to import, wherewith gzip I can import without unzipping.
    – alljamin
    Jun 3 '20 at 9:30
  • You should file a feature request for gzip. Jun 3 '20 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.