]> git.wh0rd.org - tt-rss.git/commitdiff
updater: add basic support for migrating feed icons
authorAndrew Dolgov <fox@fakecake.org>
Mon, 25 Mar 2013 14:25:43 +0000 (18:25 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Mon, 25 Mar 2013 14:36:41 +0000 (18:36 +0400)
plugins/updater/init.php

index 6c31501ed7bc0fb6ec9618d0434999b772680bdf..63b681e176264719a0f25999d973faf2f7232723 100644 (file)
@@ -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() {