mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-05 21:57:24 +02:00
Drop legacy feed icon storage migration and unused 'Config::ICONS_DIR'.
This commit is contained in:
parent
3783d987e5
commit
25d8655214
@ -62,9 +62,6 @@ class Config {
|
||||
/** base directory for local cache (must be writable) */
|
||||
const CACHE_DIR = "CACHE_DIR";
|
||||
|
||||
/** directory for feed favicons (directory must be writable) */
|
||||
const ICONS_DIR = "ICONS_DIR";
|
||||
|
||||
/** auto create users authenticated via external modules */
|
||||
const AUTH_AUTO_CREATE = "AUTH_AUTO_CREATE";
|
||||
|
||||
@ -199,9 +196,6 @@ class Config {
|
||||
/** scheduled task, value should be valid cron expression */
|
||||
const SCHEDULE_DISABLE_FAILED_FEEDS = "SCHEDULE_DISABLE_FAILED_FEEDS";
|
||||
|
||||
/** scheduled task to migrate feed icons from legacy dir, value should be valid cron expression */
|
||||
const SCHEDULE_MIGRATE_FEED_ICONS = "SCHEDULE_MIGRATE_FEED_ICONS";
|
||||
|
||||
/** scheduled task to cleanup feed icons, value should be valid cron expression */
|
||||
const SCHEDULE_CLEANUP_FEED_ICONS = "SCHEDULE_CLEANUP_FEED_ICONS";
|
||||
|
||||
@ -230,7 +224,6 @@ class Config {
|
||||
Config::PHP_EXECUTABLE => [ "/usr/bin/php", Config::T_STRING ],
|
||||
Config::LOCK_DIRECTORY => [ "lock", Config::T_STRING ],
|
||||
Config::CACHE_DIR => [ "cache", Config::T_STRING ],
|
||||
Config::ICONS_DIR => [ "feed-icons", Config::T_STRING ],
|
||||
Config::AUTH_AUTO_CREATE => [ "true", Config::T_BOOL ],
|
||||
Config::AUTH_AUTO_LOGIN => [ "true", Config::T_BOOL ],
|
||||
Config::FORCE_ARTICLE_PURGE => [ 0, Config::T_INT ],
|
||||
@ -277,7 +270,6 @@ class Config {
|
||||
Config::SCHEDULE_PURGE_ORPHANS => ["@daily", Config::T_STRING],
|
||||
Config::SCHEDULE_DISK_CACHE_EXPIRE_ALL => ["@daily", Config::T_STRING],
|
||||
Config::SCHEDULE_DISABLE_FAILED_FEEDS => ["@daily", Config::T_STRING],
|
||||
Config::SCHEDULE_MIGRATE_FEED_ICONS => ["@daily", Config::T_STRING],
|
||||
Config::SCHEDULE_CLEANUP_FEED_ICONS => ["@daily", Config::T_STRING],
|
||||
Config::SCHEDULE_LOG_DAEMON_UPDATE_LOGIN_LIMIT_USERS =>
|
||||
["@daily", Config::T_STRING],
|
||||
@ -592,10 +584,6 @@ class Config {
|
||||
array_push($errors, "Data export cache is not writable (chmod -R 777 ".self::get(Config::CACHE_DIR)."/export)");
|
||||
}
|
||||
|
||||
if (!is_writable(self::get(Config::ICONS_DIR))) {
|
||||
array_push($errors, "ICONS_DIR defined in config.php is not writable (chmod -R 777 ".self::get(Config::ICONS_DIR).").\n");
|
||||
}
|
||||
|
||||
if (!is_writable(self::get(Config::LOCK_DIRECTORY))) {
|
||||
array_push($errors, "LOCK_DIRECTORY is not writable (chmod -R 777 ".self::get(Config::LOCK_DIRECTORY).").\n");
|
||||
}
|
||||
|
@ -1656,33 +1656,6 @@ class RSSUtils {
|
||||
$tmph->run_hooks(PluginHost::HOOK_HOUSE_KEEPING);
|
||||
}
|
||||
|
||||
/**
|
||||
* migrates favicons from legacy storage in feed-icons/ to cache/feed-icons/using new naming (sans .ico suffix)
|
||||
* @todo Remove this and Config::ICONS_DIR at some point
|
||||
*/
|
||||
static function migrate_feed_icons() : void {
|
||||
$old_dir = Config::get(Config::ICONS_DIR);
|
||||
|
||||
$dh = opendir($old_dir);
|
||||
|
||||
$cache = DiskCache::instance('feed-icons');
|
||||
|
||||
if ($dh) {
|
||||
while (($old_filename = readdir($dh)) !== false) {
|
||||
if (str_ends_with($old_filename, ".ico")) {
|
||||
$new_filename = str_replace(".ico", "", $old_filename);
|
||||
$old_full_path = "$old_dir/$old_filename";
|
||||
|
||||
if (is_file($old_full_path) && $cache->put($new_filename, file_get_contents($old_full_path))) {
|
||||
unlink($old_full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
/** Init all system tasks which are run periodically by updater in housekeeping_common() */
|
||||
static function init_housekeeping_tasks() : void {
|
||||
Debug::log('Registering scheduled tasks for housekeeping...');
|
||||
@ -1714,14 +1687,6 @@ class RSSUtils {
|
||||
}
|
||||
);
|
||||
|
||||
$scheduler->add_scheduled_task('migrate_feed_icons', Config::get(Config::SCHEDULE_MIGRATE_FEED_ICONS),
|
||||
function() {
|
||||
self::migrate_feed_icons();
|
||||
|
||||
return 0;
|
||||
}
|
||||
);
|
||||
|
||||
$scheduler->add_scheduled_task('cleanup_feed_icons', Config::get(Config::SCHEDULE_CLEANUP_FEED_ICONS),
|
||||
function() {
|
||||
self::cleanup_feed_icons();
|
||||
|
Loading…
Reference in New Issue
Block a user