@@ 169-194 (lines=26) @@ | ||
166 | * @param array $options extra options for backend |
|
167 | * @return string |
|
168 | */ |
|
169 | protected function _vcl_director_backend($host, $port, $descriptor, $probeUrl = '', $options = array()) { |
|
170 | $tpl = <<<EOS |
|
171 | backend web{$descriptor} { |
|
172 | .host = "{{host}}"; |
|
173 | .port = "{{port}}"; |
|
174 | {{probe}} |
|
175 | ||
176 | EOS; |
|
177 | $vars = array( |
|
178 | 'host' => $host, |
|
179 | 'port' => $port, |
|
180 | 'probe' => '' |
|
181 | ); |
|
182 | if ( ! empty($probeUrl)) { |
|
183 | $vars['probe'] = $this->_vcl_get_probe($probeUrl); |
|
184 | } |
|
185 | $str = $this->_formatTemplate($tpl, $vars); |
|
186 | foreach ($options as $key => $value) { |
|
187 | $str .= sprintf(' .%s = %s;', $key, $value).PHP_EOL; |
|
188 | } |
|
189 | $str .= <<<EOS |
|
190 | } |
|
191 | ||
192 | EOS; |
|
193 | return $str; |
|
194 | } |
|
195 | } |
|
196 |
@@ 705-731 (lines=27) @@ | ||
702 | * @param array $options extra options for backend |
|
703 | * @return string |
|
704 | */ |
|
705 | protected function _vcl_director_backend($host, $port, $probeUrl = '', $options = array()) { |
|
706 | $tpl = <<<EOS |
|
707 | { |
|
708 | .backend = { |
|
709 | .host = "{{host}}"; |
|
710 | .port = "{{port}}"; |
|
711 | {{probe}} |
|
712 | ||
713 | EOS; |
|
714 | $vars = array( |
|
715 | 'host' => $host, |
|
716 | 'port' => $port, |
|
717 | 'probe' => '' |
|
718 | ); |
|
719 | if ( ! empty($probeUrl)) { |
|
720 | $vars['probe'] = $this->_vcl_get_probe($probeUrl); |
|
721 | } |
|
722 | $str = $this->_formatTemplate($tpl, $vars); |
|
723 | foreach ($options as $key => $value) { |
|
724 | $str .= sprintf(' .%s = %s;', $key, $value).PHP_EOL; |
|
725 | } |
|
726 | $str .= <<<EOS |
|
727 | } |
|
728 | } |
|
729 | EOS; |
|
730 | return $str; |
|
731 | } |
|
732 | ||
733 | /** |
|
734 | * Format a VCL probe declaration to put in backend which is in director |