I wrote a custom component in Joomla! that pulls in content from an XML feed and stores it in the Joomla database. I want the admin URL (/administrator/index?option=com_mycomp) to run via cron once every night to run the component. I can't figure out how to make this work, though, since the component is an administrator task and you have to be logged in to run it.
How do I get by this? I tried including my user/pw in the url (http:admin:[email protected]/joomla/administrator....) but it doesn't work. Is there anyway other way to send login credentials, or any other way to do this?
I know this thread is very old, but here's how I handled a similar task.
The "trick" is to take the custom PHP code you have created, and embed it into an article within your Joomla website.
I did this by using the JUMI extension, that allows custom PHP code to be stored within the Joomla repository and embedded, as required, within an article.
Then, create a CRON task that will activate the appropriate URL for the page containing the code you want to run.
Just put your script in the administrator directory of the component like
/administrator/components/com_yourcomponent/cron.yourcomponent.php
This is how FeedGator handles cron tasks [Sounds very similar to what you're trying to do.] ... you can also write a frontend controller in your component per one of the comments
========== [Update] ============
I created this ultra-simple installable component that could also be used for this purpose. It allows for a frontend menu item to be assigned to a php page (including the route as suggested). So you:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With