Skip to content

Commit

Permalink
Merge pull request #5 from lekoala/master
Browse files Browse the repository at this point in the history
dev/build fixes
  • Loading branch information
Mark Guinn committed Sep 18, 2015
2 parents afbab84 + 3b17c6b commit 037c48d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ClockworkControllerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class ClockworkControllerExtension extends Extension
{
public function onBeforeInit() {
if (Director::isDev()) {
if (Director::isDev() && class_exists('Clockwork\\Request\\ClockworkTimeline')) {
Injector::inst()->get('ClockworkTimeline')->startEvent(
get_class($this->owner) . '_init',
get_class($this->owner) . ' initialization'
Expand All @@ -26,7 +26,7 @@ public function onBeforeInit() {
}

public function onAfterInit() {
if (Director::isDev()) {
if (Director::isDev() && class_exists('Clockwork\\Request\\ClockworkTimeline')) {
$injector = Injector::inst();
$injector->get('ClockworkTimeline')->endEvent(get_class($this->owner) . '_init');
$injector->get('ClockworkTimeline')->startEvent(
Expand Down
5 changes: 3 additions & 2 deletions src/RequestFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class RequestFilter implements \RequestFilter
* @return boolean Whether to continue processing other filters. Null or true will continue processing (optional)
*/
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) {
if (Director::isDev()) {
if (Director::isDev() && class_exists('Clockwork\\Clockwork')) {

$this->clockwork = new Clockwork();

// Wrap the current database adapter in a proxy object so we can log queries
Expand All @@ -59,7 +60,7 @@ public function preRequest(SS_HTTPRequest $request, Session $session, DataModel
* @return boolean Whether to continue processing other filters. Null or true will continue processing (optional)
*/
public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model) {
if (Director::isDev()) {
if (isset($this->clockwork)) {
$response->addHeader("X-Clockwork-Id", $this->clockwork->getRequest()->id);
$response->addHeader("X-Clockwork-Version", Clockwork::VERSION);
$response->addHeader('X-Clockwork-Path', Director::baseURL() . '__clockwork/');
Expand Down

0 comments on commit 037c48d

Please sign in to comment.