Cron on multisite install
On a Drupal 6 multisite install, whats the best way to have cron run for the requested site only? Going to http://www.mysi开发者_如何学JAVAte.com/cron.php results in a 404.
cron.php
is the right way, even in multisite installs: Drupal checks HTTP_HOST to see which site to bootstrap into. You mentioned in a comment that it was renamed: besides either renaming or running a cron job on the renamed file, you could also run it from the Status Report page or via Drush:
/usr/bin/php /path/to/drush.php -v -l http://example.com -r /path/to/drupal/ cron
Or simply
drush -l http://example.com cron
if you have your paths set up right for cron.
I think you answer is to do something with the hook_cron() hook. You can specify the site in the database query.
This is some code implementing it:
<?php
function hook_cron() {
$result = db_query('SELECT * FROM {site} WHERE checked = 0 OR checked
+ refresh < %d', time());
while ($site = db_fetch_array($result)) {
cloud_update($site);
}
}
?>
stolen from http://api.drupal.org/api/function/hook_cron
I know this isn't the answer that you were looking for but I think it is in the right direction. I'm a week into drupal. I think I like it ;)
精彩评论