Example #1
0
File: Block.php Project: jasny/Q
 /**
  * Copy or rename/move this file.
  * 
  * @param callback $fn     copy or rename
  * @param Fs_Dir   $dir
  * @param string   $name
  * @param int      $flags  Fs::% options as binary set
  * @return Fs_Node
  */
 protected function doCopyRename($fn, $dir, $name, $flags = 0)
 {
     if ($fn == 'copy') {
         throw new Fs_Exception("Unable to copy '{$this->_path}': File is a block device");
     }
     return parent::doCopyRename($fn, $dir, $name, $flags);
 }
Example #2
0
File: Socket.php Project: jasny/Q
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     parent::__construct($path);
     if (is_link($path) xor $this instanceof Fs_Symlink) {
         throw new Fs_Exception("File '{$path}' is " . ($this instanceof Fs_Symlink ? 'not ' : '') . "a symlink.");
     }
     if (file_exists($path) && filetype(realpath($path)) != 'socket') {
         throw new Fs_Exception("File '{$path}' is not a socket, but a " . filetype($path) . ".");
     }
 }
Example #3
0
File: File.php Project: jasny/Q
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     parent::__construct($path);
     if (file_exists($path) && !is_file($path)) {
         throw new Fs_Exception("File '{$path}' is not a regular file, but a " . Fs::typeOfNode($path, Fs::DESCRIPTION));
     }
     if (is_link($path) xor $this instanceof Fs_Symlink) {
         throw new Fs_Exception("File '{$path}' is " . ($this instanceof Fs_Symlink ? 'not ' : '') . "a symlink");
     }
 }
Example #4
0
File: Unknown.php Project: jasny/Q
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     parent::__construct($path);
     if (file_exists($path) && filetype(realpath($path)) != 'unknown') {
         throw new Fs_Exception("File '{$path}' is not a file with an unknown type, but a " . Fs::typeOfNode($path, Fs::DESCRIPTION));
     }
     if (is_link($path) xor $this instanceof Fs_Symlink) {
         throw new Fs_Exception("File '{$path}' is " . ($this instanceof Fs_Symlink ? 'not ' : '') . "a symlink.");
     }
 }
Example #5
0
File: Broken.php Project: jasny/Q
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     if (!is_link($path)) {
         throw new Fs_Exception("File '{$path}' is not a symlink");
     }
     if (file_exists($path)) {
         throw new Fs_Exception("File '{$path}' is not a broken link, the target is a " . filetype(realpath($path)));
     }
     parent::__construct($path);
 }