From aff02f89c112dc147213a877d582c873ae981514 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 25 Mar 2013 18:25:43 +0400 Subject: [PATCH] updater: add basic support for migrating feed icons --- plugins/updater/init.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/updater/init.php b/plugins/updater/init.php index 6c31501e..63b681e1 100644 --- a/plugins/updater/init.php +++ b/plugins/updater/init.php @@ -240,6 +240,26 @@ class Updater extends Plugin { chmod($dir, 0777); } + if (ICONS_DIR == "feed-icons") { + array_push($log, "Migrating feed icons..."); + + $icons = glob("$old_dir/feed-icons/*.ico"); + $icons_copied = 0; + + foreach ($icons as $icon) { + $icon = basename($icon); + + if (copy("$old_dir/feed-icons/$icon", "$work_dir/feed-icons/$icon")) { + ++$icons_copied; + } + } + + array_push($log, "Done; $icons_copied files copied"); + + } else { + array_push($log, "Not migrating feed icons, ICONS_DIR modified."); + } + array_push($log, "Upgrade completed."); array_push($log, "Your old tt-rss directory is saved at $old_dir. ". "Please migrate locally modified files (if any) and remove it."); @@ -278,10 +298,12 @@ class Updater extends Plugin { _debug("Please backup your tt-rss directory before continuing. Your database will not be modified."); _debug("Type 'yes' to continue."); - if (read_stdin() != 'yes') + $input = read_stdin(); + + if ($input != 'yes' && $input != 'force') exit; - $this->update_self_cli($link, in_array("-force", $args)); + $this->update_self_cli($link, $input == 'force'); } function get_prefs_js() { -- 2.39.5