38 lines
911 B
PHP
38 lines
911 B
PHP
<?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;
|
|
|
|
case NULL:
|
|
$newRoleValue = "admin";
|
|
break;
|
|
}
|
|
|
|
if (isset($newRoleValue)) {
|
|
$data['role'] = $newRoleValue;
|
|
$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";
|
|
}
|
|
|
|
} else {
|
|
echo "Fichier ignoré ou format inattendu : $filePath\n";
|
|
}
|
|
}
|
|
|
|
echo "Modification terminée.\n";
|