feat: 實作機台日誌核心功能與 IoT 高併發處理架構
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 36s
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 36s
This commit is contained in:
34
refactor_tests2.php
Normal file
34
refactor_tests2.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$dirs = ['tests', 'database', 'app'];
|
||||
$files = [];
|
||||
|
||||
foreach ($dirs as $dirName) {
|
||||
// Note: sail runs in /var/www/html
|
||||
if (!is_dir(__DIR__ . '/' . $dirName)) continue;
|
||||
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/' . $dirName));
|
||||
foreach ($dir as $file) {
|
||||
if ($file->isFile() && $file->getExtension() === 'php') {
|
||||
$files[] = $file->getPathname();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$replacements = [
|
||||
'App\Models\User' => 'App\Models\System\User',
|
||||
];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$content = file_get_contents($file);
|
||||
$original = $content;
|
||||
|
||||
foreach ($replacements as $old => $new) {
|
||||
$content = str_replace($old, $new, $content);
|
||||
}
|
||||
|
||||
if ($content !== $original) {
|
||||
file_put_contents($file, $content);
|
||||
echo "Updated: $file\n";
|
||||
}
|
||||
}
|
||||
echo "Done.\n";
|
||||
Reference in New Issue
Block a user