nexcess / magento-turpentine

A Varnish extension for Magento.
GNU General Public License v2.0
519 stars 253 forks source link

I have problem with new version with nginx #1442

Open andermarchi opened 7 years ago

andermarchi commented 7 years ago

Failed to save the VCL file: Declaration of Nexcessnet_Turpentine_Model_Varnish_Configurator_Version4::_vcl_director_backend() should be compatible with Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_vcl_director_backend($host, $port, $descriptor = '', $probeUrl = '', $options = Array)

miguelbalparda commented 7 years ago

What version of the module are you using? This should be fixed in the latest release.

andermarchi commented 7 years ago

I am using 0.7.10 (stable) with nignx v 1.10.2 with PHP 5.4.16 (fpm-fcgi)

miguelbalparda commented 7 years ago

This is the latest release https://github.com/nexcess/magento-turpentine/releases/tag/release-0.7.3

mikeshield13 commented 7 years ago

Magento connect shows that version number (0.7.10) as the latest stable.

miguelbalparda commented 7 years ago

Weird, if I go to https://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html and then to the M1 Extension Versions tab I can see 0.7.3 there

andermarchi commented 7 years ago

I have same error after update plugin ->

    Failed to save the VCL file: Declaration of Nexcessnet_Turpentine_Model_Varnish_Configurator_Version4::_vcl_director_backend() should be compatible with Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_vcl_director_backend($host, $port, $descriptor = '', $probeUrl = '', $options = Array)
    VCL successfully applied to: 127.0.0.1:6082
    A configuração foi salva.
miguelbalparda commented 7 years ago

Can you open that file and post the declaration of the function in question please?

andermarchi commented 7 years ago

vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; }

sub vcl_recv { } sub vcl_backend_response { }

sub vcl_deliver { }

miguelbalparda commented 7 years ago

Sorry I meant this two Nexcessnet_Turpentine_Model_Varnish_Configurator_Version4::_vcl_director_backend Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_vcl_director_backend

andermarchi commented 7 years ago

I do not have much knowledge where I can find these files

miguelbalparda commented 7 years ago

I strongly recommend hiring a developer for this. If this is not possible for some reason, the files in question should be under app/code/community/Nexcessnet/Turpentine

michbsd commented 6 years ago

Abstract.php :

/**
 * Format a VCL backend declaration to put inside director
 *
 * @param string $host     backend host
 * @param string $port     backend port
 * @param string $probeUrl URL to check if backend is up
 * @param array  $options  extra options for backend
 * @return string
 */
protected function _vcl_director_backend($host, $port, $probeUrl = '', $options = array()) {
    $tpl = <<<EOS
{
    .backend = {
        .host = "{{host}}";
        .port = "{{port}}";

{{probe}}

EOS; $vars = array( 'host' => $host, 'port' => $port, 'probe' => '' ); if ( ! empty($probeUrl)) { $vars['probe'] = $this->_vcl_get_probe($probeUrl); } $str = $this->_formatTemplate($tpl, $vars); foreach ($options as $key => $value) { $str .= sprintf(' .%s = %s;', $key, $value).PHP_EOL; } $str .= <<<EOS } } EOS; return $str; }

Version4.php :

/**
 * Format a VCL backend declaration to put inside director
 *
 * @param string $host       backend host
 * @param string $port       backend port
 * @param string $descriptor backend descriptor
 * @param string $probeUrl   URL to check if backend is up
 * @param array  $options    extra options for backend
 * @return string
 */
protected function _vcl_director_backend($host, $port, $descriptor, $probeUrl = '', $options = array()) {
    $tpl = <<<EOS
    backend web{$descriptor} {
        .host = "{{host}}";
        .port = "{{port}}";

{{probe}}

EOS; $vars = array( 'host' => $host, 'port' => $port, 'probe' => '' ); if ( ! empty($probeUrl)) { $vars['probe'] = $this->_vcl_get_probe($probeUrl); } $str = $this->_formatTemplate($tpl, $vars); foreach ($options as $key => $value) { $str .= sprintf(' .%s = %s;', $key, $value).PHP_EOL; } $str .= <<<EOS }

EOS; return $str; }