Dotclear

source: plugins/maintenance/inc/tasks/class.dc.maintenance.zipmedia.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 dcMaintenanceZipmedia 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 media folder of current blog');
23     }
24
25     public function execute()
26     {
27          // Instance media
28          $this->core->media = new dcMedia($this->core);
29          $this->core->media->chdir(null);
30          $this->core->media->getDir();
31
32          // Create zip
33          @set_time_limit(300);
34          $fp = fopen('php://output', 'wb');
35          $zip = new fileZip($fp);
36          $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
37          $zip->addDirectory($this->core->media->root.'/', '', true);
38
39          // Log task execution here as we sent file and stop script
40          $this->log();
41
42          // Send zip
43          header('Content-Disposition: attachment;filename=media.zip');
44          header('Content-Type: application/x-zip');
45          $zip->write();
46          unset($zip);
47          exit(1);
48     }
49}
Note: See TracBrowser for help on using the repository browser.

Sites map