Files
siti-ai-product-content-gen…/includes/Core/class-groq-ai-log-scheduler.php
Roberto Guagliardo 6cff0b6f58 Add core classes and tests for Groq AI compatibility, logging, and model services
- Implement Groq_AI_Compatibility_Service to manage WooCommerce dependency and admin notices.
- Create Groq_AI_Log_Scheduler for scheduled log cleanup based on settings.
- Develop Groq_AI_Model_Service for model selection and caching.
- Add language translations in POT file for Dutch.
- Set up PHPUnit configuration and bootstrap for testing.
- Implement unit tests for model exclusions, provider request building, settings management, and term saving functionality.
2026-01-31 17:48:46 +00:00

29 lines
791 B
PHP

<?php
class Groq_AI_Log_Scheduler {
/** @var Groq_AI_Settings_Manager */
private $settings_manager;
/** @var Groq_AI_Generation_Logger */
private $logger;
public function __construct( Groq_AI_Settings_Manager $settings_manager, Groq_AI_Generation_Logger $logger ) {
$this->settings_manager = $settings_manager;
$this->logger = $logger;
}
public function ensure_logs_cleanup_schedule() {
if ( wp_next_scheduled( 'groq_ai_cleanup_logs' ) ) {
return;
}
wp_schedule_event( time() + HOUR_IN_SECONDS, 'daily', 'groq_ai_cleanup_logs' );
}
public function cleanup_logs() {
$settings = $this->settings_manager->all();
$retention_days = $this->settings_manager->get_logs_retention_days( $settings );
$this->logger->cleanup_old_logs( $retention_days );
}
}