Site setup fixes

This commit is contained in:
Deon George
2011-12-30 18:10:02 +11:00
parent 125407656d
commit acd1bf116c
16 changed files with 231 additions and 29 deletions

View File

@@ -104,8 +104,25 @@ abstract class ORMOSB extends ORM {
$model->$field = serialize($value);
}
public function save(Validation $validation = NULL) {
// Find any fields that have changed, and that are blobs, and encode them.
if ($this->_changed)
foreach ($this->_changed as $c)
if ($this->_table_columns[$c]['data_type'] == 'blob')
$this->$c = $this->blob($this->$c,TRUE);
return parent::save($validation);
}
public function changed() {
return $this->_changed;
}
/**
* Retrieve and Store DB BLOB data.
*/
protected function blob($data,$set=FALSE) {
return $set ? gzcompress(serialize($data)) : unserialize(gzuncompress($data));
}
}
?>