/** * Trigger the log rotation. */ function logrotate_archive_cron($hook, $entity_type, $returnvalue, $params) { $resulttext = elgg_echo("logrotate:logrotated"); $period = elgg_get_plugin_setting('period', 'logrotate'); $offset = logrotate_get_seconds_in_period($period); if (!archive_log($offset)) { $resulttext = elgg_echo("logrotate:lognotrotated"); } return $returnvalue . $resulttext; }
/** * Trigger the log rotation. */ function logrotate_archive_cron($hook, $entity_type, $returnvalue, $params) { $resulttext = elgg_echo("logrotate:logrotated"); $day = 86400; $offset = 0; $period = elgg_get_plugin_setting('period', 'logrotate'); switch ($period) { case 'weekly': $offset = $day * 7; break; case 'yearly': $offset = $day * 365; break; case 'monthly': default: // assume 28 days even if a month is longer. Won't cause data loss. $offset = $day * 28; } if (!archive_log($offset)) { $resulttext = elgg_echo("logrotate:lognotrotated"); } return $returnvalue . $resulttext; }