Exemple #1
0
 } else {
     $context['text'] .= '<p>' . sprintf(i18n::s('Meta data have been saved in %s'), $context['path_to_reference'] . 'footprints.php') . "</p>\n";
     // also put the file in the archive
     $references[] = array('', 'footprints.php');
 }
 // also update our own version
 Safe::file_put_contents($context['path_to_root'] . 'footprints.php', $content);
 // splash message
 $context['text'] .= '<p>' . i18n::s('On-going archive preparation...') . "\n";
 $file_path = $context['path_to_reference'];
 $file_name = 'temporary/' . gmdate("Ymd") . '_yacs_' . trim($_REQUEST['version']);
 // start the zip file
 include_once '../shared/zipfile.php';
 $zipfile = new zipfile();
 // place all files into a single directory --fixed time to allow cacheability
 $zipfile->store('yacs/', 0);
 // process every reference file
 $all_files = array();
 $index = 0;
 foreach ($references as $reference) {
     // let's go
     list($path, $file) = $reference;
     if (strlen(trim($path)) > 0) {
         $file = $path . '/' . $file;
     }
     // read file content
     if (($content = Safe::file_get_contents($file_path . $file)) !== FALSE) {
         // compress textual content
         if ($content && preg_match('/\\.(css|htc|htm|html|include|js|mo|php|po|pot|sql|txt|xml)$/i', $file)) {
             $zipfile->deflate('yacs/' . $file, Safe::filemtime($file_path . $file), $content);
         } else {
Exemple #2
0
 include_once '../shared/zipfile.php';
 $zipfile = new zipfile();
 // process every skin/current_skin/ file
 $index = 0;
 foreach ($datafiles as $datafile) {
     // let's go
     list($path, $filename) = $datafile;
     if ($path) {
         $file = $path . '/' . $filename;
     } else {
         $file = $filename;
     }
     // read file content
     if (($content = Safe::file_get_contents($file_prefix . $file)) !== FALSE) {
         // store binary data
         $zipfile->store($file, Safe::filemtime($file_prefix . $file), $content);
         // avoid timeouts
         if (!($index++ % 50)) {
             Safe::set_time_limit(30);
             SQL::ping();
         }
     }
 }
 // suggest a download
 Safe::header('Content-Type: application/zip');
 Safe::header('Content-Disposition: attachment; filename="backup_' . $context['skin'] . '.zip"');
 // send the archive content
 echo $zipfile->get();
 // do not allow for regular rendering
 return;
 // no file