XF 1.4 Run Feeder cron job manually?

I have a news system on my site using WordPress and would like to run Feeder manually to collect news when it's posted. I have a WordPress plugin that automatically runs a script whenever a post is made, and it would be easy to hook in a command to run all RSS feeds right away if I knew how the !@$^*! that could be done. I suspect this is easy but I've searched the forums a few times and looked at the cron jobs page and can't figure it out. This would be much more efficient than having a dozen cron jobs running every 10-30 minutes "just in case" and would also get the news out faster (as in, instantly).

I tried looking into deferred.php but can't figure out where the “feeder” script is.

Is this something as easy as I suspect it is?
 
Which feed are you referring to?

Is this for content being imported into your forum or your forum RSS feeds being displayed on other pages/sites?
 
Content being imported in via RSS. I tried to find a way to do it via WordPress plugin but did not. At first I just did the main feed but now I have news coming in by category (each category has its own RSS feed) to individual forums. TMI? and thanks for the quick reply. Gosh, I'm not in InvisionLand any more!
 
How would you know when to run the import based on an external feed being updated with new content?

That's why it is done via a cron task.
 
Oh, I see. I can run /directory/library/XenForo/CronEntry/Feeder.php from shell…, right?

Edit: it looks as though I can run that from shell but not from a browser. I am using the Webhooks plugin for WordPress and will see if that works even if I can't do it from a browser (it can essentially hit a URL). If that fails I will see if I can trigger the running of the Feeder.php file from the existing php file I run when a news item is posted.
 
Last edited:
No. The code in question can only be run within the XF framework (once it's started up). You would need to custom develop a script to call the necessary part of the API. (You could base the start up code on deferred.php and then call the necessary method to start the feed import.)
 
Gosh, this deferred.php is a small script (to your credit). But I can't figure out what part to hardcode and what part to ignore.

I am guessing I need to hardcode the second line to initialize($fileDir.'./library/Feeder/',$filedir); ?

XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
 
Custom development is really beyond the scope of our official support. If you have any further questions, I'd recommend posting in the development forum.

However, I will say that if you're putting the file in the root XF directory, you can use the code up until (and including):
Code:
$dependencies->preLoadData();
Then after it just call:
Code:
XenForo_Model::create('XenForo_Model_Feed')->scheduledImportTimeLimited(15);
 
In a similar vein, is it possible to code a cron job to import the contents of an .xls file from an external website into the database?

I've got something working locally which takes a copy of an .xls file stored on someone else's website (using .php fopen/fwrite) , and then read/display the contents (using PHPExcel - Home) but ideally I would have thought it would be better to use XenForo built in code? My code does not seem to work when added into XenForo for some reason.
 
Back
Top Bottom