A site has a monthly event list, event.january.html, etc, for the naming convention. The current month needs to be linked at event.html. Right now it's done with Global Redirect module and must be updated manually. I can set up a cron, no problem there.
What is the best practice method to automatically updated a primary menu link, or update the Global Redirect?
Also, I suspect the cache for the menu will need to be cleared. I have drush installed and drush cache menu works from the command line, and I can cron that. I'd prefer to build it into the Redirect update. And it would be good to then force a cache rebuild, so the next visitor does not have any slowness. wget domain.com/ should work for that.
So, what is the best practice method to clear cache in this case? And best practice to rebuild cache?
Comments
Path Redirect and drush cc [type]
When Path Redirect module is installed, Pathauto exposes a new setting that will allow you to update the path alias and create a redirect from the old path. Does this answer your question?
Caches get rebuilt as soon as they are cleared. You can tell Drush which caches to clear with a
drush cc [type]command.Looking for PHP cron type automation solution
Hi Christefano,
Thanks for the response. I should have stressed 'automatic' in my post more. The methods you mentioned are currently in use, at the first of each month, or mostly the first. And that "mostly" is the issue. At 1 minute past midnight, a cron job could run on the web server, invoking a script, that invokes a PHP script with Drupal API calls to do the same as the manual operations, or does SQL UPDATES directly to the needed tables. I was wondering if there are API calls for changing Global Redirects, a module that likely has no API for that purpose, or if there is a Drupal supplied API function (I've had trouble finding low level API functions in the past, lots of trouble, like for inserting span tags into links - see other chat), or is there a particular "issue" when doing the SQL UPDATE into the 'routing tables', just how many tables need to be changed? Just one? Turned out this issue was more complex than I was willing to spend time searching and searching, and I thought to ask, to see if anyone has done this before, as I now have 2 web sites needing this functionality, identical functionality, so that it is a "common" thing, I thought someone would have the answer, off the top of their head. I'll escalate this and post on IRC later this week.
Regarding clearing the cache, I can do the drush cc call from a PHP exec function, or shell script, no doubt about that. But first I need to do the first part of the solution, before doing the second. And I was thinking there must be a "Best Practice" for automatically clearing cache via a cron job, perhaps invoke a Drupal API call via a PHP script, instead of a script with a drush call, and including the working path to the web root folder as an option. Or would it be better to change the working directory of the cron script?
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE