Skip to content

Commit

Permalink
Merge pull request #907 from BarryCarlyon/fix-904
Browse files Browse the repository at this point in the history
Fix for: ignores backend settings #904
  • Loading branch information
miguelbalparda committed Aug 28, 2015
2 parents aa8d26f + b6d3972 commit bc4c3eb
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ static public function getFromSocket( $socket ) {
return null;
}
switch( $version ) {
case '4.0':
return Mage::getModel(
'turpentine/varnish_configurator_version4',
array( 'socket' => $socket ) );
case '4.0':
return Mage::getModel(
'turpentine/varnish_configurator_version4',
array( 'socket' => $socket ) );

case '3.0':
return Mage::getModel(
Expand Down Expand Up @@ -209,17 +209,17 @@ protected function _getNormalizeHostTarget() {
* @return string
*/
public function getAllowedHostsRegex() {
$hosts = array();
foreach( Mage::app()->getStores() as $store ) {
$hosts[] = parse_url( $store->getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB , false ), PHP_URL_HOST );
}
$hosts = array_values(array_unique( $hosts ));
$hosts = array();
foreach( Mage::app()->getStores() as $store ) {
$hosts[] = parse_url( $store->getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB , false ), PHP_URL_HOST );
}

$hosts = array_values(array_unique( $hosts ));

$pattern = '('.implode('|', array_map("preg_quote", $hosts)).')';
return $pattern;
return $pattern;
}

/**
* Get the base url path regex
*
Expand Down Expand Up @@ -292,7 +292,7 @@ protected function _getDefaultBackend() {
'first_byte_timeout' => $timeout . 's',
'between_bytes_timeout' => $timeout . 's',
);
if ( Mage::getStoreConfigFlag( 'turpentine_vcl/backend/load_balancing' ) ) {
if ( Mage::getStoreConfigFlag( 'turpentine_vcl/backend/load_balancing' ) != 'no' ) {
return $this->_vcl_director( 'default', $default_options );
} else {
return $this->_vcl_backend( 'default',
Expand All @@ -313,7 +313,7 @@ protected function _getAdminBackend() {
'first_byte_timeout' => $timeout . 's',
'between_bytes_timeout' => $timeout . 's',
);
if ( Mage::getStoreConfigFlag( 'turpentine_vcl/backend/load_balancing' ) ) {
if ( Mage::getStoreConfigFlag( 'turpentine_vcl/backend/load_balancing' ) != 'no' ) {
return $this->_vcl_director( 'admin', $admin_options );
} else {
return $this->_vcl_backend( 'admin',
Expand Down Expand Up @@ -821,7 +821,7 @@ protected function _getTemplateVars() {
'admin_frontname' => $this->_getAdminFrontname(),
'normalize_host_target' => $this->_getNormalizeHostTarget(),
'url_base_regex' => $this->getBaseUrlPathRegex(),
'allowed_hosts_regex' => $this->getAllowedHostsRegex(),
'allowed_hosts_regex' => $this->getAllowedHostsRegex(),
'url_excludes' => $this->_getUrlExcludes(),
'get_param_excludes' => $this->_getGetParamExcludes(),
'get_param_ignored' => $this->_getIgnoreGetParameters(),
Expand Down Expand Up @@ -872,7 +872,7 @@ protected function _getTemplateVars() {
if( Mage::getStoreConfig( 'turpentine_vcl/normalization/cookie_target' ) ) {
$vars['normalize_cookie_target'] = $this->_getNormalizeCookieTarget();
}

$customIncludeFile = $this->_getCustomIncludeFilename();
if( is_readable( $customIncludeFile ) ) {
$vars['custom_vcl_include'] = file_get_contents( $customIncludeFile );
Expand Down

0 comments on commit bc4c3eb

Please sign in to comment.