Dotclear

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

Revision 1955:b0bef03695c0, 1.2 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 dcMaintenanceZipmedia extends dcMaintenanceTask
15{
16     protected $tab = 'backup';
17     protected $group = 'zipblog';
18
19     protected function init()
20     {
21          $this->task = __('Download media folder of current blog');
22     }
23
24     public function execute()
25     {
26          // Instance media
27          $this->core->media = new dcMedia($this->core);
28          $this->core->media->chdir(null);
29          $this->core->media->getDir();
30
31          // Create zip
32          @set_time_limit(300);
33          $fp = fopen('php://output', 'wb');
34          $zip = new fileZip($fp);
35          $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
36          $zip->addDirectory($this->core->media->root.'/', '', true);
37
38          // Log task execution here as we sent file and stop script
39          $this->log();
40
41          // Send zip
42          header('Content-Disposition: attachment;filename=media.zip');
43          header('Content-Type: application/x-zip');
44          $zip->write();
45          unset($zip);
46          exit(1);
47     }
48}
Note: See TracBrowser for help on using the repository browser.

Sites map