Created
January 18, 2024 08:39
-
-
Save divinity76/62f19b4b2bb50b5f19a51ddd1d421d1e to your computer and use it in GitHub Desktop.
file searcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
$dir = realpath(__DIR__ . '/..'); | |
$files = shell_exec("find " . escapeshellarg($dir) . " -print0"); | |
$files = explode("\x00", rtrim($files, "\x00")); | |
$files = array_filter($files, function ($filepath) { | |
if (!preg_match("/page/", $filepath)) { | |
return false; | |
} | |
if (!preg_match("/\.php$/", $filepath)) { | |
return false; | |
} | |
$content = file_get_contents($filepath); | |
if (!preg_match("/getBody/", $content)) { | |
return false; | |
} | |
return true; | |
}); | |
var_dump($files); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment