Files

18 lines
1011 B
PHP

<?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";