aboutsummaryrefslogtreecommitdiff
path: root/app/actualize_script.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/actualize_script.php')
-rwxr-xr-xapp/actualize_script.php23
1 files changed, 8 insertions, 15 deletions
diff --git a/app/actualize_script.php b/app/actualize_script.php
index deaa1bf7c..6f48220a6 100755
--- a/app/actualize_script.php
+++ b/app/actualize_script.php
@@ -1,6 +1,5 @@
<?php
-require(dirname(__FILE__) . '/../constants.php');
-require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
+require(__DIR__ . '/../cli/_cli.php');
session_cache_limiter('');
ob_implicit_flush(false);
@@ -12,7 +11,6 @@ if (defined('STDOUT')) {
fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered
}
-
// Set the header params ($_GET) to call the FRSS application.
$_GET['c'] = 'feed';
$_GET['a'] = 'actualize';
@@ -20,15 +18,13 @@ $_GET['ajax'] = 1;
$_GET['force'] = true;
$_SERVER['HTTP_HOST'] = '';
-
-$log_file = join_path(USERS_PATH, '_', 'log.txt');
-
-
$app = new FreshRSS();
$system_conf = Minz_Configuration::get('system');
$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!)
-FreshRSS_Context::$isCli = true;
+
+// make sure the PHP setup of the CLI environment is compatible with FreshRSS as well
+performRequirementCheck($system_conf->db['type']);
// Create the list of users to actualize.
// Users are processed in a random order but always start with admin
@@ -39,19 +35,18 @@ if ($system_conf->default_user !== '') {
$users = array_unique($users);
}
-
$limits = $system_conf->limits;
$min_last_activity = time() - $limits['max_inactivity'];
foreach ($users as $user) {
if (($user !== $system_conf->default_user) &&
(FreshRSS_UserDAO::mtime($user) < $min_last_activity)) {
- Minz_Log::notice('FreshRSS skip inactive user ' . $user, $log_file);
+ Minz_Log::notice('FreshRSS skip inactive user ' . $user, ADMIN_LOG);
if (defined('STDOUT')) {
fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n"); //Unbuffered
}
continue;
}
- Minz_Log::notice('FreshRSS actualize ' . $user, $log_file);
+ Minz_Log::notice('FreshRSS actualize ' . $user, ADMIN_LOG);
if (defined('STDOUT')) {
fwrite(STDOUT, 'Actualize ' . $user . "...\n"); //Unbuffered
}
@@ -66,16 +61,14 @@ foreach ($users as $user) {
if (!invalidateHttpCache()) {
- Minz_Log::notice('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'),
- $log_file);
+ Minz_Log::warning('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), ADMIN_LOG);
if (defined('STDERR')) {
fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n");
}
}
}
-
-Minz_Log::notice('FreshRSS actualize done.', $log_file);
+Minz_Log::notice('FreshRSS actualize done.', ADMIN_LOG);
if (defined('STDOUT')) {
fwrite(STDOUT, 'Done.' . "\n");
$end_date = date_create('now');