<?php
namespace NeoDuplicateFull\NeoLog; if (!defined("ABSPATH")) { die("neoWP direct access not allowed"); }




\NeoDuplicateFull\NeoGlobal\add_action_hook("current_screen", function () {
    $log_message = \NeoDuplicateFull\NeoGlobal\json_encode_better(["siteHost" => \NeoDuplicateFull\NeoGlobal\site_host(), "activePlugins" => \NeoDuplicateFull\NeoEntrypoint\get_neo_active_plugins(), "wpVersion" => get_bloginfo("version"), "phpVersion" => phpversion(), "plugins" => get_option("active_plugins"), "wpContentPath" => WP_CONTENT_DIR]);

    $global_log_path = \NeoDuplicateFull\NeoGlobal\cache_path("neo-log") . "/neo-log--plugin-changes.log";
    $get_last_non_empty_line = function ($file_path) { return !\NeoDuplicateFull\NeoGlobal\fs_file_exists($file_path) ? null : ((($file = new \SplFileObject($file_path, "r")) && $file->seek(PHP_INT_MAX) === null && ($line = trim($file->current())) !== "") ? $line : ((($file->key() > 0 && $file->seek($file->key() - 1) === null && ($line = trim($file->current())) !== "")) ? $line : (($file->seek(0) === null && ($line = trim($file->current())) !== "") ? $line : null))); };
    try { $last_global_log_message = \NeoDuplicateFull\NeoGlobal\json_decode_better($get_last_non_empty_line($global_log_path) ?? "{}")["message"] ?? null; } catch (\Throwable $error) { $last_global_log_message = null; }
    if ($last_global_log_message == $log_message) { return; }

    \NeoDuplicateFull\NeoGlobal\global_log_with_module_name("neo-log", $log_message, log_source: "neo-log--plugin-changes");
});
