Esempio n. 1
0
 /**
  * Renames all child paths.
  *
  * @param string $path  The path of the folder to rename.
  * @param string $name  The foldername to use.
  *
  * @throws Horde_Vfs_Exception
  */
 protected function _recursiveRename($oldpath, $oldname, $newpath, $newname)
 {
     $oldpath = $this->_convertPath($oldpath);
     $newpath = $this->_convertPath($newpath);
     $sql = sprintf('SELECT vfs_name FROM %s WHERE vfs_type = ? AND vfs_path = ?', $this->_params['table']);
     $values = array(self::FOLDER, $this->_getNativePath($oldpath, $oldname));
     try {
         $folderList = $this->_db->selectValues($sql, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Horde_Vfs_Exception($e);
     }
     foreach ($folderList as $folder) {
         $this->_recursiveRename($this->_getNativePath($oldpath, $oldname), $folder, $this->_getNativePath($newpath, $newname), $folder);
     }
     $sql = sprintf('UPDATE %s SET vfs_path = ? WHERE vfs_path = ?', $this->_params['table']);
     $values = array($this->_getNativePath($newpath, $newname), $this->_getNativePath($oldpath, $oldname));
     try {
         $this->_db->update($sql, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Horde_Vfs_Exception($e);
     }
 }