public function execute() { // Instance media $this->core->media = new dcMedia($this->core); $this->core->media->chdir(null); $this->core->media->getDir(); // Create zip @set_time_limit(300); $fp = fopen('php://output', 'wb'); $zip = new fileZip($fp); $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); $zip->addDirectory($this->core->media->root . '/', '', true); // Log task execution here as we sent file and stop script $this->log(); // Send zip header('Content-Disposition: attachment;filename=' . date('Y-m-d') . '-' . $this->core->blog->id . '-' . 'media.zip'); header('Content-Type: application/x-zip'); $zip->write(); unset($zip); exit(1); }
public function execute() { // Get theme path $path = $this->core->blog->themes_path; $theme = $this->core->blog->settings->system->theme; $dir = path::real($path . '/' . $theme); if (empty($path) || empty($theme) || !is_dir($dir)) { return false; } // Create zip @set_time_limit(300); $fp = fopen('php://output', 'wb'); $zip = new fileZip($fp); $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); $zip->addDirectory($dir . '/', '', true); // Log task execution here as we sent file and stop script $this->log(); // Send zip header('Content-Disposition: attachment;filename=theme-' . $theme . '.zip'); header('Content-Type: application/x-zip'); $zip->write(); unset($zip); exit(1); }
/** * Make a package of a module * * @param string $id * @return boolean */ public function dowloadModule($id) { $module_path = $full_entry = $this->path . '/' . $id; $filename = 'module-' . $id . '-' . date('Y-m-d-H-i') . '.zip'; if (!is_dir($module_path) || !is_readable($module_path) || !file_exists($full_entry . '/_define.php')) { return false; } try { set_time_limit(0); $fp = fopen('php://output', 'wb'); $zip = new fileZip($fp); $zip->addExclusion('#(^|/).svn$#'); $zip->addDirectory($module_path, '', true); header('Content-Disposition: attachment;filename=' . $filename); header('Content-Type: application/x-zip'); $zip->write(); unset($zip); exit; } catch (Exception $e) { $this->error->set($e->getMessage()); return false; } }
/** * Make a package of a template * * @param string $sId * @return boolean */ protected function dowloadTemplate($sId) { $aTemplatesInfos = $this->getTplInfos(); $aTplInfos = $aTemplatesInfos[$sId]; $sFilename = $aTplInfos['id'] . '.zip'; if (!is_dir($aTplInfos['dir']) || !is_readable($aTplInfos['dir'])) { return false; } try { set_time_limit(0); $fp = fopen('php://output', 'wb'); $zip = new fileZip($fp); $zip->addExclusion('#(^|/).svn$#'); $zip->addDirectory($aTplInfos['dir'], '', true); header('Content-Disposition: attachment;filename=' . $sFilename); header('Content-Type: application/x-zip'); $zip->write(); unset($zip); exit; } catch (Exception $e) { $this->okt->error->set($e->getMessage()); return false; } }
$okt->error->set(__('c_a_tools_backup_unable_write_file')); } try { // @ini_set('memory_limit',-1); set_time_limit(0); $zip = new fileZip($fp); //$zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); $zip->addExclusion('#(^|/)_notes$#'); $zip->addExclusion('#(^|/)_old$#'); $zip->addExclusion('#(^|/)_source$#'); $zip->addExclusion('#(^|/)_sources$#'); $zip->addExclusion('#(^|/).svn$#'); $zip->addExclusion('#(^|/)oktCache$#'); $zip->addExclusion('#(^|/)stats$#'); $zip->addExclusion('#(^|/)' . preg_quote($sBackupFilenameBase, '#') . '(.*?).zip$#'); $zip->addDirectory(OKT_ROOT_PATH, $sBackupFilenameBase, true); $zip->write(); fclose($fp); $zip->close(); $okt->redirect('configuration.php?action=tools&bakcup_done=1'); } catch (Exception $e) { $okt->error->set($e->getMessage()); } } # création d'un fichier de backup de la base de données if (!empty($_GET['make_db_backup'])) { $return = ''; $tables = $okt->db->getTables(); foreach ($tables as $table) { $return .= 'DROP TABLE IF EXISTS ' . $table . ';'; $row2 = $okt->db->fetchRow($okt->db->query('SHOW CREATE TABLE ' . $table));
// Move current dir at the top of list unset($last_dirs[array_search($recent_dir, $last_dirs)]); array_unshift($last_dirs, $recent_dir); } // Store new list $core->auth->user_prefs->interface->put('media_last_dirs', serialize($last_dirs)); } } # Zip download if (!empty($_GET['zipdl']) && $core->auth->check('media_admin', $core->blog->id)) { try { @set_time_limit(300); $fp = fopen('php://output', 'wb'); $zip = new fileZip($fp); $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); $zip->addDirectory($core->media->root . '/' . $d, '', true); header('Content-Disposition: attachment;filename=' . date('Y-m-d') . '-' . $core->blog->id . '-' . ($d ? $d : 'media') . '.zip'); header('Content-Type: application/x-zip'); $zip->write(); unset($zip); exit; } catch (Exception $e) { $core->error->add($e->getMessage()); } } # New directory if ($dir && !empty($_POST['newdir'])) { try { $core->media->makeDir($_POST['newdir']); dcPage::addSuccessNotice(sprintf(__('Directory "%s" has been successfully created.'), html::escapeHTML($_POST['newdir']))); $core->adminurl->redirect('admin.media', $page_url_params);