Dotclear

source: plugins/maintenance/inc/tasks/class.dc.maintenance.ziptheme.php @ 1955:b0bef03695c0

Revision 1955:b0bef03695c0, 1.3 KB checked in by Denis Jean-Chirstian <contact@…>, 12 years ago (diff)

Revamp plugin maintenance, step 3, add backup tasks, dynamic tabs and plugin importExport, addresses #999

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14class dcMaintenanceZiptheme extends dcMaintenanceTask
15{
16     protected $tab = 'backup';
17     protected $group = 'zipblog';
18
19     protected function init()
20     {
21          $this->task = __('Download active theme of current blog');
22     }
23
24     public function execute()
25     {
26          // Get theme path
27          $path = $this->core->blog->themes_path;
28          $theme =$this->core->blog->settings->system->theme;
29          $dir = path::real($path.'/'.$theme);
30          if (empty($path) || empty($theme) || !is_dir($dir)) {
31               return false;
32          }
33
34          // Create zip
35          @set_time_limit(300);
36          $fp = fopen('php://output', 'wb');
37          $zip = new fileZip($fp);
38          $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
39          $zip->addDirectory($dir.'/', '', true);
40
41          // Log task execution here as we sent file and stop script
42          $this->log();
43
44          // Send zip
45          header('Content-Disposition: attachment;filename=theme-'.$theme.'.zip');
46          header('Content-Type: application/x-zip');
47          $zip->write();
48          unset($zip);
49          exit(1);
50     }
51}
Note: See TracBrowser for help on using the repository browser.

Sites map