Test only index pages for recent changes

This commit is contained in:
litemotiv 2024-12-08 10:44:40 +01:00
parent b45ec60cc2
commit 3cdd5d6cb2
1 changed files with 52 additions and 48 deletions

View File

@ -201,18 +201,21 @@ if (isset($_GET['notice'])) {
"385212d5ea557a21b77af992ea1b3c1ea71d22c9",
"b51a889545b5f065fd1ac2b8760cab0088a9dc22"
];
$oneMonthAgo = strtotime('-1 month');
foreach (glob("/home/*") as $user) {
// Check if user has a default index page
foreach (glob("/home/*") as $user) {
// Look for index files with common extensions
$indexFiles = glob("$user/public_html/index.{html,htm,php}", GLOB_BRACE);
$index = count($indexFiles) > 0 ? $indexFiles[0] : null;
if (!$index || in_array(sha1_file($index), $page_shas)) continue;
// Check for any recent changes in the public_html directory
// Check if the index pages were updated in the last month
$recentChange = false;
foreach (glob("$user/public_html/*") as $file) {
foreach ($indexFiles as $file) {
if (filemtime($file) > $oneMonthAgo) {
$recentChange = true;
break;
@ -221,9 +224,10 @@ foreach (glob("/home/*") as $user) {
$user = basename($user);
$class = $recentChange ? 'recently-updated' : '';
echo '<li class="'.$class.'"><a href="/~'.$user.'/">~'.$user.'</a></li>';
}
?>
<li class="<?= $class ?>"><a href="/~<?=$user?>/">~<?=$user?></a></li>
<?php } ?>
</ul>
</div>
</div>