Dotclear

source: plugins/maintenance/inc/tasks/class.dc.maintenance.ziptheme.php @ 1984:0b0cb9cd7da7

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

Revamp plugin maintenance, step 4 bis, better place for settings according to boss and some typo, 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 $blog = true;
17     protected $tab = 'backup';
18     protected $group = 'zipblog';
19
20     protected function init()
21     {
22          $this->task = __('Download active theme of current blog');
23     }
24
25     public function execute()
26     {
27          // Get theme path
28          $path = $this->core->blog->themes_path;
29          $theme =$this->core->blog->settings->system->theme;
30          $dir = path::real($path.'/'.$theme);
31          if (empty($path) || empty($theme) || !is_dir($dir)) {
32               return false;
33          }
34
35          // Create zip
36          @set_time_limit(300);
37          $fp = fopen('php://output', 'wb');
38          $zip = new fileZip($fp);
39          $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
40          $zip->addDirectory($dir.'/', '', true);
41
42          // Log task execution here as we sent file and stop script
43          $this->log();
44
45          // Send zip
46          header('Content-Disposition: attachment;filename=theme-'.$theme.'.zip');
47          header('Content-Type: application/x-zip');
48          $zip->write();
49          unset($zip);
50          exit(1);
51     }
52}
Note: See TracBrowser for help on using the repository browser.

Sites map