Merge branch 'MDL-27857-assignment-portfolio_21_STABLE' of git://github.com/mudrd8mz...
[moodle.git] / lib / filestorage / file_exceptions.php
blob49c45a63cfc59c7925732d886d12ccd323acb5cb
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * File handling related exceptions.
21 * @package core
22 * @subpackage filestorage
23 * @copyright 2008 Petr Skoda (http://skodak.org)
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') || die();
29 /**
30 * Basic file related exception class
32 * @package core
33 * @subpackage filestorage
34 * @copyright 2008 Petr Skoda (http://skodak.org)
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37 class file_exception extends moodle_exception {
38 function __construct($errorcode, $a=NULL, $debuginfo = NULL) {
39 parent::__construct($errorcode, '', '', $a, $debuginfo);
43 /**
44 * Can not create file exception
46 * @package core
47 * @subpackage filestorage
48 * @copyright 2008 Petr Skoda (http://skodak.org)
49 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
51 class stored_file_creation_exception extends file_exception {
52 function __construct($contextid, $component, $filearea, $itemid, $filepath, $filename, $debuginfo = NULL) {
53 $a = new stdClass();
54 $a->contextid = $contextid;
55 $a->component = $component;
56 $a->filearea = $filearea;
57 $a->itemid = $itemid;
58 $a->filepath = $filepath;
59 $a->filename = $filename;
60 parent::__construct('storedfilenotcreated', $a, $debuginfo);
64 /**
65 * No file access exception.
67 * @package core
68 * @subpackage filestorage
69 * @copyright 2008 Petr Skoda (http://skodak.org)
70 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
72 class file_access_exception extends file_exception {
73 function __construct($debuginfo = NULL) {
74 parent::__construct('nopermissions', NULL, $debuginfo);
78 /**
79 * Hash file content problem exception.
81 * @package core
82 * @subpackage filestorage
83 * @copyright 2008 Petr Skoda (http://skodak.org)
84 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
86 class file_pool_content_exception extends file_exception {
87 function __construct($contenthash, $debuginfo = NULL) {
88 parent::__construct('hashpoolproblem', $contenthash, $debuginfo);