#100 - create change user roles script

This commit is contained in:
isUnknown 2025-01-20 14:40:33 +01:00
parent dbecda87bd
commit e19d57648c
3 changed files with 28 additions and 32 deletions

View file

@ -0,0 +1,28 @@
<?php
$directory = __DIR__ . '/../../site/accounts';
foreach (glob($directory . '/*/index.php') as $filePath) {
$data = include $filePath;
if (is_array($data) && array_key_exists('role', $data)) {
switch ($data["role"]) {
case "client":
$newRoleValue = "0_client";
break;
case "pochet":
$newRoleValue = "1_pochet";
break;
}
$exportedData = "<?php\n\nreturn " . var_export($data, true) . ";\n";
file_put_contents($filePath, $exportedData);
echo "Fichier modifié : $filePath\n";
} else {
echo "Fichier ignoré ou format inattendu : $filePath\n";
}
}
echo "Modification terminée.\n";