This is a common use-case for Horde applications (i.e. it allows direct
manipulation of filedata uploaded from the browser without needing to
read the file into memory), and allows us to take advantage of these VFS
features in combination with the cleanup and simplicity features of
HashTable.
/** * Saves metadata. */ protected function _saveMetadata() { if (empty($this->_md)) { $this->_vfs->deleteFile($this->_vfspath, self::METADATA_NAME); } else { $this->_vfs->writeData($this->_vfspath, self::METADATA_NAME, json_encode($this->_md), true); } }
/** */ public function set($key, $val, array $opts = array()) { global $session; if (!parent::set($key, $val, $opts)) { return false; } $data_keys = $this->_getKeys(); if (empty($data_keys)) { $logout = new Horde_Registry_Logout(); $logout->add($this); } $data_keys[] = $key; $session->set('horde', self::SESS_KEY, $data_keys); return true; }