Allow running accountmgr and maintenance without changing to spoolnews dir first.

This commit is contained in:
Retro_Guy 2024-07-01 02:12:12 -07:00
parent b517d3ce71
commit 14cc77bfed
3 changed files with 27 additions and 2 deletions

View File

@ -1,7 +1,15 @@
<?php
include ("paths.inc.php");
chdir($spoolnews_path);
include "config.inc.php";
$processUser = posix_getpwuid(posix_geteuid());
if ($processUser['name'] != $CONFIG['webserver_user']) {
echo "You are running as: " . $processUser['name'] . "\n";
echo 'Please run this scripts as: ' . $CONFIG['webserver_user'] . "\n";
exit();
}
$keyfile = $spooldir . '/keys.dat';
$keys = unserialize(file_get_contents($keyfile));
$email_registry = $spooldir . '/email_registry.dat';
@ -86,7 +94,7 @@ function create_new($username, $password, $user_email)
chmod($userFilename, 0666);
}
echo "User: " . $username . " Created\r\n";
echo "Password: " . $password ."\n";
echo "Password: " . $password . "\n";
echo "Email: " . $user_email . "\n";
exit(0);
}

View File

@ -53,6 +53,14 @@ if (isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) {
}
}
}
// Create paths in $config_dir/scripts path file
$config_path_file = $config_dir . '/scripts/paths.inc.php';
if(!file_exists($config_path_file)) {
file_put_contents($config_path_file, '<?php' ."\n");
file_put_contents($config_path_file, '$spoolnews_path = "' . getcwd() . '";', FILE_APPEND);
}
# Generate user count file (must be root)
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/count_users.php");
echo "Updated user count\n";

View File

@ -17,9 +17,18 @@
* it to appear:
* $config_dir/<section>/groups.txt
*/
include ("paths.inc.php");
chdir($spoolnews_path);
include "config.inc.php";
include ("$file_newsportal");
$processUser = posix_getpwuid(posix_geteuid());
if ($processUser['name'] != $CONFIG['webserver_user']) {
echo "You are running as: " . $processUser['name'] . "\n";
echo 'Please run this scripts as: ' . $CONFIG['webserver_user'] . "\n";
exit();
}
$logfile = $logdir . '/import.log';
$lockfile = $lockdir . '/' . $config_name . '-spoolnews.lock';