Add and sort by section in grouplist.php. Also update cache from cron.php so no user must wait.
This commit is contained in:
parent
337d4be66a
commit
860dfa61ca
|
@ -5,19 +5,22 @@ include "../spoolnews/newsportal.php";
|
|||
$title .= ' - Available Newsgroups';
|
||||
include "head.inc";
|
||||
|
||||
$cache_filename = $spooldir . '/grouplist-cache.txt';
|
||||
echo '<center>';
|
||||
echo '<h3>List of Available Newsgroups:</h3>';
|
||||
|
||||
// Use cache if new enough
|
||||
// 14400 = 4 hours
|
||||
if (filemtime($cache_filename) > (time() - 14400)) {
|
||||
echo file_get_contents($cache_filename);
|
||||
exit();
|
||||
if (filemtime($grouplist_cache_filename) > (time() - $grouplist_cache_time)) {
|
||||
// Allow refresh from cron.php
|
||||
if($argv[1] != '.RELOAD') {
|
||||
echo file_get_contents($grouplist_cache_filename);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
echo '<table border="1">';
|
||||
echo '<tr>';
|
||||
echo '<th>Section</th>';
|
||||
echo '<th>Group</th>';
|
||||
echo '<th>Description</th>';
|
||||
echo '<th>Messages</th>';
|
||||
|
@ -45,12 +48,11 @@ foreach ($menulist as $menu) {
|
|||
}
|
||||
}
|
||||
}
|
||||
ksort($groups_array);
|
||||
//ksort($groups_array);
|
||||
|
||||
$ns = nntp_open();
|
||||
foreach ($groups_array as $thisgroup) {
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
$section = explode("/", $thisgroup);
|
||||
$group = explode("group=", $thisgroup);
|
||||
if (is_file($spooldir . '/' . urldecode($group[1]) . '-title')) {
|
||||
$title = file_get_contents($spooldir . '/' . urldecode($group[1]) . '-title');
|
||||
|
@ -58,6 +60,9 @@ foreach ($groups_array as $thisgroup) {
|
|||
} else {
|
||||
$title = '';
|
||||
}
|
||||
echo '<tr><td style="text-align: center">';
|
||||
echo ' <font size=4>' . $section[0] . '</font> ';
|
||||
echo '</td><td>';
|
||||
echo '<font size=5><a href="/' . $thisgroup . '">' . urldecode($group[1]) . "</a></font><br />\r\n";
|
||||
echo '</td>';
|
||||
echo '<td>' . $title . '</td>';
|
||||
|
@ -78,5 +83,5 @@ echo '<br />';
|
|||
include "../spoolnews/tail.inc";
|
||||
echo '</center>';
|
||||
echo '</body></html>';
|
||||
file_put_contents($cache_filename, ob_get_contents());
|
||||
ob_end_flush();
|
||||
file_put_contents($grouplist_cache_filename, ob_get_contents());
|
||||
ob_end_flush();
|
||||
|
|
|
@ -48,6 +48,9 @@ $lockdir = $spooldir . '/lock';
|
|||
$ssldir = $spooldir . '/ssl/';
|
||||
$user_ban_file = $config_dir . '/banned_names.conf';
|
||||
|
||||
$grouplist_cache_filename = $spooldir . '/grouplist-cache.txt';
|
||||
$grouplist_cache_time = 14400;
|
||||
|
||||
/* Permanent configuration changes */
|
||||
@mkdir($logdir, 0755, 'recursive');
|
||||
@mkdir($spooldir . '/upload', 0755, 'recursive');
|
||||
|
|
|
@ -59,6 +59,8 @@ echo "Updated user count\n";
|
|||
|
||||
$uinfo = posix_getpwnam($CONFIG['webserver_user']);
|
||||
$cwd = getcwd();
|
||||
|
||||
// Check permissions on some files
|
||||
$webtmp = preg_replace('/spoolnews/', 'tmp/', $cwd);
|
||||
$keydir = preg_replace('/spoolnews/', 'pubkey/', $cwd);
|
||||
|
||||
|
@ -72,6 +74,13 @@ $keydir = preg_replace('/spoolnews/', 'pubkey/', $cwd);
|
|||
@chown($ssldir, $uinfo["uid"]);
|
||||
@chgrp($ssldir, $uinfo["gid"]);
|
||||
|
||||
$alias_file = $config_dir . '/aliases.conf';
|
||||
if(!file_exists($alias_file)) {
|
||||
touch($alias_file);
|
||||
}
|
||||
@chown($alias_file, $uinfo["uid"]);
|
||||
@chgrp($alias_file, $uinfo["gid"]);
|
||||
|
||||
$pemfile = $ssldir . '/server.pem';
|
||||
create_node_ssl_cert($pemfile);
|
||||
|
||||
|
@ -136,6 +145,11 @@ foreach ($menulist as $menu) {
|
|||
# Run RSS Feeds
|
||||
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/rss-feeds.php");
|
||||
echo "RSS Feeds updated\n";
|
||||
# Reload grouplist
|
||||
if ((filemtime($grouplist_cache_filename) < (time() - ($grouplist_cache_time - 600)) || !file_exists($grouplist_cache_filename))) {
|
||||
exec($CONFIG['php_exec'] . " ../common/grouplist.php .RELOAD");
|
||||
echo "Refreshed grouplist\n";
|
||||
}
|
||||
# Rotate log files
|
||||
log_rotate();
|
||||
echo "Log files rotated\n";
|
||||
|
|
Loading…
Reference in New Issue