You are here:  » Re: Feed Download / Unzipping Issue

Active Forum Topics


Re: Feed Download / Unzipping Issue

Submitted by techdesigns on Wed, 2021-04-21 10:50 in

Hi David

I've been having a few issues importing a feed since moving servers (same spec / different IP)

Essentially all feeds import fine apart from two (both Rakuten / FTP)

The links to the feeds are correct (work fine in the browser) and are of the format ftp://user:pass@aftp.linksynergy.com/file.xml.gz and were working fine yesterday before the server change.

What seems to be happening is they download fine (a tmp file of the correct size is temporarily created in the feeds directory) but the existing feed file is not overwritten, and then the "ERROR - TRANSFER FAILED" message is displayed (and the tmp file deleted).

Even if I delete the existing feed, a new one is not created, so it's not an overwriting issue (and all other feeds overwrite fine)

Any ideas of what could cause this? Possibly an unzipping issue?

and

$config_automationUnzipPrograms["unzip"] = "/bin/unzip";
$config_automationUnzipPrograms["gzip"] = "/bin/gzip";

are my current unzip settings - both of these are correct as per my hosting terminal.

All the PT feed settings are the same as per the installation on the previous server, which worked fine yesterday?

Revision 16/10A Copyright (c) 2005-2016 IAAI Software, All Rights Reserved
PHP Version 7.4.16
MySQL Version 5.7.34

Thanks for any pointers you can give me.

Kind regards

Joey

Submitted by support on Wed, 2021-04-21 11:17

Hello Joey,

Other users have recently reported issues with FTP access to that network / server and it's not immediately obvious where the problem lies - it seems to be resolved by changing the automation handler to "php" to force use of the PHP internal URL wrappers for access to ftp:// URLs etc. instead of the the CURL functions which are used by default, so that's interesting that it stopped working simply as a result of moving servers without anything different in the codebase.

To change to php mode only, edit config.advanced.php and change line 43 as follows;

  $config_automationHandler = "php";

(from the default "auto", which implies "curl" if CURL library available)

If that solves the problem with these particular feeds, double check that all other feeds are still working with "php" as the handler. If it turns out that the change has introduced problems with other feeds, it can be overridden easily on a per domain name basis so if you need to do this, change $config_automationHandler back to "auto", and then edit includes/automation.php and look for the following code at line 36:

      $automation_handler = "automation_handler_".$config_automationHandler;

...and REPLACE with:

      if (strpos($job["url"],"linksynergy.com"))
      {
        $automation_handler = "automation_handler_php";
      }
      else
      {
        $automation_handler = "automation_handler_".$config_automationHandler;
      }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by techdesigns on Wed, 2021-04-21 11:26

Thanks David - it all works fine now (as do the existing feeds) - much appreciated!

Submitted by techdesigns on Thu, 2021-04-22 11:39

Hi David

Sorry to bother you - I'm still having issues with this I'm afraid.

I've tried both solutions, and they both work for clicking "Run" to manually download / extract the feeds, but neither work for when I use a cron job (the rest of the feeds load / process fine) to automatically refresh the feeds?

Thanks in advance

Joey

Submitted by support on Fri, 2021-04-23 07:22

Hello Joey,

That's strange, although Apache module / command line (cli) PHP are essentially separate installations. In this comment there are mods to add a wget handler which is a 3rd option to try..

Cheers,
David.
--
PriceTapestry.com

Submitted by techdesigns on Tue, 2021-04-27 10:09

Hi David

Thanks for this - I seem to have solved it using your advice - if anyone else is having this issue, set in config.advanced.php:

$config_automationHandler = "auto";

(if it's not already set to this value)

Then in includes/automation.php

$automation_handler = "automation_handler_".$config_automationHandler;

REPLACE with:

      if (strpos($job["url"],"linksynergy.com"))
      {
        $automation_handler = "automation_handler_wget";
      }
      else
      {
        $automation_handler = "automation_handler_".$config_automationHandler;
      }

and then add to the bottom of includes/automation.php

 function automation_handler_wget($src,$dst)
  {
    global $config_automationFetchPrograms;
    $cmd = $config_automationFetchPrograms["wget"]." -O ".escapeshellarg($dst)." ".escapeshellarg($src);
    return !exec($cmd);
  }

Using wget seemed to fix the linksynergy feeds, but break others - this works for all my feeds (just uses wget for linksynergy, rest use auto).

Submitted by support on Tue, 2021-04-27 10:21

Thanks Joey,

Just to add that the wget handler requires the following line added to config.advanced.php:

  $config_automationFetchPrograms["wget"] = "/usr/bin/wget";

Cheers,
David.
--
PriceTapestry.com