ׇk/ d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZmZ ddl mZ ddlmZ dd lmZ dd lmZ ddlmZ ej e ZdZd ZdZdZ G d d ZdS )a Processor for WordPress rule disable/enable changelog files. The PHP WordPress plugin writes rule change actions to changelog.php when a user disables or enables protection rules from the WordPress admin panel. This module reads, parses, and applies those actions to the agent database. The changelog.php file uses the same format as incident files: ||k r8t d | dd |j || | ||| rd }| |||| d{V # t $ r%} t d| Y d} ~ d} ~ wt $ r-} t d||j | Y d} ~ 2d} ~ ww xY wt d |j t | | |S )am Parse and apply actions from a changelog file. The file is always deleted after reading, even on parse errors. Actions older than the last sync timestamp are skipped to prevent stale changelog files (e.g. from backup restores) from undoing more recent changes. Returns: True if any DB changes occurred. Ftsr z:Missing or invalid timestamp in changelog action for rule rule_id? on site NzPSkipping stale changelog action for rule %s on site %s (ts=%.0f <= sync_ts=%.0f)Tz$Skipping invalid changelog entry: %sz5Failed to process changelog action %s for site %s: %sz9Processed changelog for site %s: %d action(s), changed=%s)r4 _get_last_sync_tsfloatgetr3 r* r r _process_action_report_actionwarningr( r) r ) r r, r! r actionslast_sync_tschangedaction timestampr- s r r&