commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / packages / ezc / Base / src / exceptions / file_permission.php
1 <?php
2 /**
3 * File containing the ezcBaseFilePermissionException class
4 *
5 * @package Base
6 * @version 1.7
7 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
8 * @license http://ez.no/licenses/new_bsd New BSD License
9 */
10 /**
11 * ezcBaseFilePermissionException is thrown whenever a permission problem with
12 * a file, directory or stream occurred.
13 *
14 * @package Base
15 * @version 1.7
16 */
17 class ezcBaseFilePermissionException extends ezcBaseFileException
18 {
19 /**
20 * Constructs a new ezcPropertyPermissionException for the property $name.
21 *
22 * @param string $path The name of the file.
23 * @param int $mode The mode of the property that is allowed
24 * (ezcBaseFileException::READ, ezcBaseFileException::WRITE,
25 * ezcBaseFileException::EXECUTE,
26 * ezcBaseFileException::CHANGE or
27 * ezcBaseFileException::REMOVE).
28 * @param string $message A string with extra information.
29 */
30 function __construct( $path, $mode, $message = null )
31 {
32 switch ( $mode )
33 {
34 case ezcBaseFileException::READ:
35 $operation = "The file '{$path}' can not be opened for reading";
36 break;
37 case ezcBaseFileException::WRITE:
38 $operation = "The file '{$path}' can not be opened for writing";
39 break;
40 case ezcBaseFileException::EXECUTE:
41 $operation = "The file '{$path}' can not be executed";
42 break;
43 case ezcBaseFileException::CHANGE:
44 $operation = "The permissions for '{$path}' can not be changed";
45 break;
46 case ezcBaseFileException::REMOVE:
47 $operation = "The file '{$path}' can not be removed";
48 break;
49 case ( ezcBaseFileException::READ || ezcBaseFileException::WRITE ):
50 $operation = "The file '{$path}' can not be opened for reading and writing";
51 break;
52 }
53
54 $messagePart = '';
55 if ( $message )
56 {
57 $messagePart = " ($message)";
58 }
59
60 parent::__construct( "$operation.$messagePart" );
61 }
62 }
63 ?>