You are here:  » prevent import of zero feed

Support Forum



prevent import of zero feed

Submitted by wilkins on Fri, 2007-11-16 10:57 in

Hi david

We import feeds every night, over the last few days it seems there have been some issues with the feeds and when downloaded from the affilaite site via cron it has just been a empty file, when this is then imported it deletes all the existing files and because the new file is empty all the products have gone from the site. some of the feeds are only updated every couple of weeks, which means we are haveing to check and manually do these feeds. The last import lost us 500,000 products becuse of a problem at webgains.

My question is

Is ther any way of preventing the import.php from importing a file that is zero in size, this would at least keep the older feed active until the issue is fixed and the correct feed is downloaded.

I hope this makes sense.

Brent

Submitted by support on Fri, 2007-11-16 12:19

Hi Brent,

Yes - this is easy to fix. In includes/admin.php, look for the admin_import() function, beginning at line 300. At the top of the function (for example just after the line containing global $admin_importCallback;) insert the following to abort the importing of any feed with a zero byte filesize:

  if (!filesize("../feeds/".$filename)) return "";

That should do the trick,
Cheers,
David.

Submitted by webie on Sun, 2008-08-10 20:52

Hi Dave,

Is this the correct place for the code

global $admin_importLimit;
if (!filesize("../feeds/".$filename)) return "";
global $admin_importCallback;

Code line 340 to 342 in admin.php

Regards

Darren

Submitted by support on Mon, 2008-08-11 07:22

Hi Darren,

That would be fine, but for code consistency, I would place it after the last "global" line; so after the last line in the section you posted - but it doesn't matter where it goes in the function at the end of the day...

Cheers,
David.