Files
advanced-mcp-plugin/scripts/patch-fluentsmtp-label.php

18 lines
1.0 KiB
PHP

<?php
/**
* Idempotent — adds FluentSMTP's guard constant (FLUENTMAIL_PLUGIN_VERSION) to the catalog
* label map so the locked FluentSMTP group reads "FluentSMTP" rather than a humanized fallback.
* Usage: php patch-fluentsmtp-label.php [ABS_PATH_TO/includes]
*/
$base = $argv[1] ?? '/var/www/html/wp-content/plugins/advanced-mcp-plugin/includes';
$admin = $base . '/Core/AdminMenu.php';
$src = file_get_contents($admin);
if ($src === false) { fwrite(STDERR, "cannot read $admin\n"); exit(1); }
if (strpos($src, 'FLUENTMAIL_PLUGIN_VERSION') !== false) { echo "fluentsmtp label already present\n"; exit(0); }
$anchor = "'MOYASAR_WC_VERSION' => ['Moyasar', 'moyasar'],";
if (strpos($src, $anchor) === false) { fwrite(STDERR, "anchor not found (run patch-moyasar-label.php first)\n"); exit(2); }
$add = $anchor . "\n 'FLUENTMAIL_PLUGIN_VERSION' => ['FluentSMTP', 'fluent-smtp'],";
$src = str_replace($anchor, $add, $src);
if (file_put_contents($admin, $src) === false) { fwrite(STDERR, "write failed\n"); exit(3); }
echo "fluentsmtp label added\n";