mirror of https://github.com/tildeclub/site.git
Test only index pages for recent changes
This commit is contained in:
parent
b45ec60cc2
commit
3cdd5d6cb2
12
index.php
12
index.php
|
@ -201,8 +201,10 @@ if (isset($_GET['notice'])) {
|
||||||
"385212d5ea557a21b77af992ea1b3c1ea71d22c9",
|
"385212d5ea557a21b77af992ea1b3c1ea71d22c9",
|
||||||
"b51a889545b5f065fd1ac2b8760cab0088a9dc22"
|
"b51a889545b5f065fd1ac2b8760cab0088a9dc22"
|
||||||
];
|
];
|
||||||
|
|
||||||
$oneMonthAgo = strtotime('-1 month');
|
$oneMonthAgo = strtotime('-1 month');
|
||||||
|
|
||||||
|
// Check if user has a default index page
|
||||||
foreach (glob("/home/*") as $user) {
|
foreach (glob("/home/*") as $user) {
|
||||||
// Look for index files with common extensions
|
// Look for index files with common extensions
|
||||||
$indexFiles = glob("$user/public_html/index.{html,htm,php}", GLOB_BRACE);
|
$indexFiles = glob("$user/public_html/index.{html,htm,php}", GLOB_BRACE);
|
||||||
|
@ -210,9 +212,10 @@ foreach (glob("/home/*") as $user) {
|
||||||
|
|
||||||
if (!$index || in_array(sha1_file($index), $page_shas)) continue;
|
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;
|
$recentChange = false;
|
||||||
foreach (glob("$user/public_html/*") as $file) {
|
|
||||||
|
foreach ($indexFiles as $file) {
|
||||||
if (filemtime($file) > $oneMonthAgo) {
|
if (filemtime($file) > $oneMonthAgo) {
|
||||||
$recentChange = true;
|
$recentChange = true;
|
||||||
break;
|
break;
|
||||||
|
@ -221,9 +224,10 @@ foreach (glob("/home/*") as $user) {
|
||||||
|
|
||||||
$user = basename($user);
|
$user = basename($user);
|
||||||
$class = $recentChange ? 'recently-updated' : '';
|
$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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue