From: Andrew Dolgov Date: Mon, 25 Mar 2013 14:25:43 +0000 (+0400) Subject: updater: add basic support for migrating feed icons X-Git-Tag: 1.7.6~295 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=aff02f89c112dc147213a877d582c873ae981514;p=tt-rss.git updater: add basic support for migrating feed icons --- 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() {