Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
The current controller is now only retrieved once.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Glasl committed Feb 25, 2016
1 parent d13ce54 commit 7f52067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/services/MisdirectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function getMapping($URL, $host = null) {

// Enforce any hostname restriction that may have been defined.

if(is_null($host) && Controller::curr()) {
$host = Controller::curr()->getRequest()->getHeader('Host');
if(is_null($host) && ($controller = Controller::curr())) {
$host = $controller->getRequest()->getHeader('Host');
}
$matches = $matches->where("(HostnameRestriction IS NULL) OR (HostnameRestriction = '" . Convert::raw2sql($host) . "')");
$regex = clone $matches;
Expand Down

0 comments on commit 7f52067

Please sign in to comment.