improve updating diskSpace entries
parent
d2c8a0240a
commit
b5e59efda5
|
@ -186,7 +186,10 @@ class Event {
|
|||
return( $streamSrc );
|
||||
} // end function getStreamSrc
|
||||
|
||||
function DiskSpace() {
|
||||
function DiskSpace( $new='' ) {
|
||||
if ( $new != '' ) {
|
||||
$this->{'DiskSpace'} = $new;
|
||||
}
|
||||
if ( null === $this->{'DiskSpace'} ) {
|
||||
$this->{'DiskSpace'} = folder_size( $this->Path() );
|
||||
dbQuery( 'UPDATE Events SET DiskSpace=? WHERE Id=?', array( $this->{'DiskSpace'}, $this->{'Id'} ) );
|
||||
|
@ -380,10 +383,11 @@ class Event {
|
|||
}
|
||||
|
||||
public function save( ) {
|
||||
$sql = 'UPDATE Events SET '.implode(' AND', array_map( function($field) {return $field.'=?';}, $fields ) ) . ' WHERE Id=?';
|
||||
$values = array_map( function($field){return $this->{$field};}, $fields );
|
||||
|
||||
$sql = 'UPDATE Events SET '.implode(', ', array_map( function($field) {return $field.'=?';}, $this->fields ) ) . ' WHERE Id=?';
|
||||
$values = array_map( function($field){return $this->{$field};}, $this->fields );
|
||||
$values[] = $this->{'Id'};
|
||||
dbQuery( $sql, NULL, $values );
|
||||
dbQuery( $sql, $values );
|
||||
}
|
||||
|
||||
} # end class
|
||||
|
|
Loading…
Reference in New Issue