Add MOYASAR_WC_VERSION to catalog label map (idempotent)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q8t9GEyyLZbUQu26na1JQg
This commit is contained in:
2026-10-16 04:53:24 +00:00
parent 7e5776e15f
commit 1afc9393a4
+17
View File
@@ -0,0 +1,17 @@
<?php
/**
* Idempotent — adds the real Moyasar guard constant (MOYASAR_WC_VERSION) to the catalog label map
* so the locked Moyasar group reads "Moyasar" rather than a humanized fallback.
* Usage: php patch-moyasar-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, 'MOYASAR_WC_VERSION') !== false) { echo "moyasar label already present\n"; exit(0); }
$anchor = "'MOYASAR_VERSION' => ['Moyasar', 'moyasar'],";
if (strpos($src, $anchor) === false) { fwrite(STDERR, "moyasar anchor not found\n"); exit(2); }
$add = $anchor . "\n 'MOYASAR_WC_VERSION' => ['Moyasar', 'moyasar'],";
$src = str_replace($anchor, $add, $src);
if (file_put_contents($admin, $src) === false) { fwrite(STDERR, "write failed\n"); exit(3); }
echo "moyasar label added\n";