Legend:
- Unmodified
- Added
- Removed
-
plugins/maintenance/inc/tasks/class.dc.maintenance.ziptheme.php
r2044 r3730 10 10 # 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 if (!defined('DC_RC_PATH')) { return;}12 if (!defined('DC_RC_PATH')) {return;} 13 13 14 14 class dcMaintenanceZiptheme extends dcMaintenanceTask 15 15 { 16 protected $perm= 'admin';17 protected $blog= true;18 protected $tab= 'backup';19 16 protected $perm = 'admin'; 17 protected $blog = true; 18 protected $tab = 'backup'; 19 protected $group = 'zipblog'; 20 20 21 22 23 21 protected function init() 22 { 23 $this->task = __('Download active theme of current blog'); 24 24 25 26 25 $this->description = __('It may be useful to backup the active theme before any change or update. This compress theme folder into a single zip file.'); 26 } 27 27 28 29 30 31 $path= $this->core->blog->themes_path;32 $theme =$this->core->blog->settings->system->theme;33 $dir = path::real($path.'/'.$theme);34 35 36 28 public function execute() 29 { 30 // Get theme path 31 $path = $this->core->blog->themes_path; 32 $theme = $this->core->blog->settings->system->theme; 33 $dir = path::real($path . '/' . $theme); 34 if (empty($path) || empty($theme) || !is_dir($dir)) { 35 return false; 36 } 37 37 38 39 40 $fp= fopen('php://output', 'wb');41 42 43 $zip->addDirectory($dir.'/', '', true);38 // Create zip 39 @set_time_limit(300); 40 $fp = fopen('php://output', 'wb'); 41 $zip = new fileZip($fp); 42 $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); 43 $zip->addDirectory($dir . '/', '', true); 44 44 45 46 45 // Log task execution here as we sent file and stop script 46 $this->log(); 47 47 48 49 header('Content-Disposition: attachment;filename=theme-'.$theme.'.zip');50 51 52 53 54 48 // Send zip 49 header('Content-Disposition: attachment;filename=theme-' . $theme . '.zip'); 50 header('Content-Type: application/x-zip'); 51 $zip->write(); 52 unset($zip); 53 exit(1); 54 } 55 55 }
Note: See TracChangeset
for help on using the changeset viewer.