You are here:  » Automation job - fail unzip


Automation job - fail unzip

Submitted by tisbris on Sat, 2013-04-13 08:57 in

Hello David

Whenever i run a job where a feed unzip is required, then this error occur:

Warning: exec() has been disabled for security reasons in {code saved} on line 166

If this job run without unzip, then a .xml.gz feed is uploaded and I can manually unzip this feed and import without problems.

I got this:
Safe mode : Off
gzip: availible
unzip: availible

Is there a work arround for this?

//Brian

PS. I am still running the default installation - not the mod for 'Hot products'.

Submitted by support on Sat, 2013-04-13 10:52

Hello Brian,

Sure - where exec / gzip is not an option due to server restrictions PHP's internal gzip functions can be used instead. In includes/automation.php look for the automation_unzip_gzip function (it's the last function in the file) and REPLACE with the following version:

  function automation_unzip_gzip($tmp)
  {
    $gfp = gzopen($tmp,"r");
    if (!$gfp) return FALSE;
    $fp = fopen($tmp.".ungzipped","w");
    if (!$fp) return FALSE;
    while(!gzeof($gfp)) fwrite($fp,gzread($gfp,2048));
    fclose($fp);
    gzclose($gfp);
    unlink($tmp);
    rename($tmp.".ungzipped",$tmp);
    return TRUE;
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by tisbris on Sat, 2013-04-13 17:08

Perfect.

Thank you :o)

//Brian