Пример #1
0
 /**
  * Constructor
  *
  * @param   io.Folder folder
  * @throws  lang.IllegalArgumentException if the given folder does not exist
  */
 public function __construct(Folder $folder)
 {
     if (!$folder->exists()) {
         throw new IllegalArgumentException('Folder "' . $folder->getURI() . '" does not exist!');
     }
     $this->folder = $folder;
 }
 public static function cleanupSessionSavePath()
 {
     $f = new Folder(session_save_path());
     while ($e = $f->getEntry()) {
         if (0 === strncmp('sess_', $e, 5)) {
             unlink($f->getURI() . $e);
         }
     }
 }
Пример #3
0
 /**
  * Opens a subfolder of the current folder and returns
  * an object of that mailbox.
  *
  * @param   string foldername
  * @return  peer.mail.MailFolder folder;
  */
 public function getFolder($name)
 {
     $f = new Folder($this->_folder->getURI() . DIRECTORY_SEPARATOR . $name);
     if (!$f->exists()) {
         throw new MessagingException('Maildir does not exist: ' . $f->getURI());
     }
     $mf = new MailFolder($this, $name);
     return $mf;
 }
Пример #4
0
 /**
  * Gets base folder
  *
  * @param   io.Folder
  */
 public function setBase(Folder $base)
 {
     $this->base = new Folder($base, '..');
     // Scan base path. FIXME: Refactor this to use lang.ClassLoader
     // instead of duplication its sourcecode here
     foreach (array_filter(explode(PATH_SEPARATOR, scanpath(array($base->getURI()), getenv('HOME')))) as $element) {
         $resolved = realpath($element);
         if (is_dir($resolved)) {
             $this->cl[] = FileSystemClassLoader::instanceFor($resolved, FALSE);
         } else {
             if (is_file($resolved)) {
                 $this->cl[] = ArchiveClassLoader::instanceFor($resolved, FALSE);
             }
         }
     }
 }
Пример #5
0
 public function pathClassCanBeUsedAsArg()
 {
     $f = new Folder(new Path($this->temp));
     $this->assertEquals($this->temp, $f->getURI());
 }
Пример #6
0
 public function parentDirectory()
 {
     $f = new Folder('..');
     $this->assertEquals($this->normalize(realpath('..')), $f->getURI());
 }
Пример #7
0
 public function rooted_folder()
 {
     $rooted = new Folder('/rooted');
     $this->assertEquals(substr($rooted->getURI(), 0, -1), (new Path($rooted))->toString());
 }