Can't use this->data to avoid another db hit. Must load by id
This commit is contained in:
parent
d579faa291
commit
fa9803d819
|
@ -142,7 +142,7 @@ class EventsController extends AppController {
|
||||||
'event' => $event,
|
'event' => $event,
|
||||||
'_serialize' => array('event')
|
'_serialize' => array('event')
|
||||||
));
|
));
|
||||||
}
|
} // end function view
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,17 +103,17 @@ class Event extends AppModel {
|
||||||
);
|
);
|
||||||
|
|
||||||
public function Relative_Path() {
|
public function Relative_Path() {
|
||||||
$Event = new ZM\Event($this->data);
|
$Event = new ZM\Event($this->id);
|
||||||
return $Event->Relative_Path();
|
return $Event->Relative_Path();
|
||||||
} // end function Relative_Path()
|
} // end function Relative_Path()
|
||||||
|
|
||||||
public function Path() {
|
public function Path() {
|
||||||
$Event = new ZM\Event($this->data);
|
$Event = new ZM\Event($this->id);
|
||||||
return $Event->Path();
|
return $Event->Path();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Link_Path() {
|
public function Link_Path() {
|
||||||
$Event = new ZM\Event($this->data);
|
$Event = new ZM\Event($this->id);
|
||||||
return $Event->Link_Path();
|
return $Event->Link_Path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,20 +123,19 @@ class Event extends AppModel {
|
||||||
$storage = $this->Storage->findById($event['StorageId']);
|
$storage = $this->Storage->findById($event['StorageId']);
|
||||||
|
|
||||||
if ( $event['DefaultVideo'] ) {
|
if ( $event['DefaultVideo'] ) {
|
||||||
if ( file_exists($storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo']) ) {
|
if ( file_exists($this->Path().'/'.$event['DefaultVideo']) ) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
ZM\Logger::Debug("FIle does not exist at " . $storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo'] );
|
ZM\Logger::Debug('File does not exist at ' . $this->Path().'/'.$event['DefaultVideo'] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZM\Logger::Debug("No DefaultVideo in Event" . $this->Event);
|
ZM\Logger::Debug('No DefaultVideo in Event' . $this->Event);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} // end function fileExists($event)
|
} // end function fileExists($event)
|
||||||
|
|
||||||
public function fileSize($event) {
|
public function fileSize($event) {
|
||||||
$storage = $this->Storage->findById($event['StorageId']);
|
return filesize($this->Path().'/'.$event['DefaultVideo']);
|
||||||
return filesize($storage['Storage']['Path'].'/'.$this->Relative_Path($event).'/'.$event['DefaultVideo']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeDelete($cascade=true) {
|
public function beforeDelete($cascade=true) {
|
||||||
|
|
Loading…
Reference in New Issue