Skip to content

logs cron.en_US

YanQS edited this page Dec 13, 2025 · 1 revision

Logs & Cron Maintenance

Configuration options

  • pcn_log_table_max: maximum number of rows to keep in the DB table (default 1000). Set to 0 for no limit.
  • pcn_logs_option_limit: when falling back to wp_options for log storage, the maximum number of entries to keep (default 200) to avoid oversized options.

Implementation details

  • The plugin will attempt to create and write to the {$wpdb->prefix}pcn_email_logs table when sending emails; if table creation or write fails it will fall back to pcn_email_logs option.
  • To prevent unbounded growth, PCN_Settings::enforce_log_limits() performs:
    • Truncate the pcn_email_logs option, keeping only the latest N entries (pcn_logs_option_limit).
    • Delete oldest rows from the DB table to ensure the row count does not exceed pcn_log_table_max.

Scheduling

  • The plugin schedules a daily event pcn_daily_maintenance on activation; that event calls PCN_Settings::enforce_log_limits().
  • Manual run (WP-CLI):

wp eval 'PCN_Settings::enforce_log_limits();'

Cleanup & export

  • Admin UI offers clear logs and export CSV operations; export supports filtering by number of days (0 for all).
  • Recommendation: export and archive logs for long-term retention, then set a reasonable pcn_log_table_max.

主页 (Home)中文English

安装与升级 (Installation and Upgrade)中文English

模板与样式 (Templates and Style)中文English

日志与Cron (logs&cron)中文English

国际化 (Localization)中文English

变更日志 (Changelog)中文English

Clone this wiki locally