updater: add basic support for migrating feed icons

This commit is contained in:
Andrew Dolgov 2013-03-25 18:25:43 +04:00
parent 2a457e8433
commit aff02f89c1

View file

@ -240,6 +240,26 @@ class Updater extends Plugin {
chmod($dir, 0777); 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, "Upgrade completed.");
array_push($log, "Your old tt-rss directory is saved at $old_dir. ". array_push($log, "Your old tt-rss directory is saved at $old_dir. ".
"Please migrate locally modified files (if any) and remove it."); "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("Please backup your tt-rss directory before continuing. Your database will not be modified.");
_debug("Type 'yes' to continue."); _debug("Type 'yes' to continue.");
if (read_stdin() != 'yes') $input = read_stdin();
if ($input != 'yes' && $input != 'force')
exit; exit;
$this->update_self_cli($link, in_array("-force", $args)); $this->update_self_cli($link, $input == 'force');
} }
function get_prefs_js() { function get_prefs_js() {