Ejemplo n.º 1
0
Archivo: Table.php Proyecto: xolf/io-db
 /**
  * Gives the table name
  *
  * @return string
  */
 public function getName()
 {
     $name = $this->dir->getPath();
     $name = explode(DIRECTORY_SEPARATOR, $name);
     $name = $name[count($name) - 1];
     return $name;
 }
Ejemplo n.º 2
0
 /**
  * Remove directory
  *
  * @param boolean $recursive (empty directory contents and remove)
  * @return boolean
  */
 public function remove($recursive = false)
 {
     if (!$this->__isDir()) {
         return false;
     }
     if (!$recursive) {
         if (!@rmdir($this->_path)) {
             $this->error = parent::_getLastError();
             return false;
         }
         return true;
     }
     // recursive remove
     foreach ($this->read(false, true) as $asset) {
         if ($asset['type'] === 'dir') {
             $dir = new Directory($this->_path . $asset['name'], false);
             if (!$dir->remove(true)) {
                 $this->error = 'Failed to remove subdirectory \'' . $dir->getPath() . '\' (' . $dir->error . '), try elevated chmod';
                 return false;
             }
         } else {
             $file = new File($this->_path . $asset['name'], false);
             if (!$file->remove()) {
                 $this->error = 'Failed to remove file \'' . $file->getPath() . '\' (' . $file->error . '), try elevated chmod';
                 return false;
             }
         }
     }
     return $this->remove();
     // finally remove base directory
 }
Ejemplo n.º 3
0
 /**
  * @return string The full path to this file.
  */
 public function getPath()
 {
     return $this->directory->getPath($this->path);
 }
Ejemplo n.º 4
0
 public function moveInto($destination, $overwrite = false)
 {
     $dir = new Directory($destination, true);
     $this->move($dir->getPath() . DS . $this->getName(), $overwrite);
 }
Ejemplo n.º 5
0
 /**
  *
  * @param \Documentor\Directory $directory
  *
  * @return Project
  */
 public function add(Directory $directory)
 {
     $this->directories[$directory->getPath()] = $directory;
     return $this;
 }
Ejemplo n.º 6
0
 /**
  * @param Directory $directory
  */
 public function addDirectory(Directory $directory)
 {
     $this->directories[$directory->getPath()] = $directory;
 }