}
     $sqldump = $db->Dump();
     if ($sqldump === false) {
         throw new FbX($db->MyDyingMessage());
     } else {
         /*
          * And make sure we 'position' the .sql file just right for a subsequent
          * restore through our installer/wizard: to make that happen it has to live
          * in the /_docs/ directory.
          */
         $createZip->addDirectory('media');
         $createZip->addDirectory('media/files');
         $createZip->addDirectory('media/files/ccms-restore');
         $createZip->addFile($sqldump, 'media/files/ccms-restore/compactcms-sqldump.sql');
     }
     $out = $createZip->saveZipFile();
     if ($out === false) {
         throw new FbX($ccms['lang']['system']['error_write'] . ": " . $fileName);
     }
     fclose($fd);
     $fd = false;
 }
 @file_put_contents($listfile, str_replace('","', "\",\n  \"", json_encode($file_collection)));
 /*
  * To facilitate the auto-upgrade path we copy the current config.inc.php
  * and write the SQL dump to another location:
  *   /media/files/ccms-restore/config.inc.php
  *   /media/files/ccms-restore/compactcms-sqldump.sql
  * These files will be picked up by the installer/wizard to perform an
  * automated upgrade when the admin so desires.
  *