3 // This file is part of Moodle - http://moodle.org/
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.
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/>.
19 * File handling related exceptions.
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();
30 * Basic file related exception class
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);
44 * Can not create file exception
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) {
54 $a->contextid
= $contextid;
55 $a->component
= $component;
56 $a->filearea
= $filearea;
58 $a->filepath
= $filepath;
59 $a->filename
= $filename;
60 parent
::__construct('storedfilenotcreated', $a, $debuginfo);
65 * No file access exception.
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);
79 * Hash file content problem exception.
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);