]> git.wh0rd.org Git - tt-rss.git/commitdiff
better feed debugger ui for f D
authorAndrew Dolgov <noreply@fakecake.org>
Fri, 12 Jun 2015 10:06:36 +0000 (13:06 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Fri, 12 Jun 2015 10:06:36 +0000 (13:06 +0300)
classes/feeds.php
css/utility.css
js/tt-rss.js

index 261538cd3ee73cd0ff51c5313700221c6dca4d59..37a7cc89f671e7fe7b64f8f0b61e8cb0f8cb3308 100644 (file)
@@ -150,9 +150,6 @@ class Feeds extends Handler_Protected {
                                        $next_unread_feed, $offset, $vgr_last_feed = false,
                                        $override_order = false, $include_children = false) {
 
-               if (isset($_REQUEST["DevForceUpdate"]))
-                       header("Content-Type: text/plain; charset=utf-8");
-
                $disable_cache = false;
 
                $reply = array();
@@ -179,7 +176,7 @@ class Feeds extends Handler_Protected {
                                        $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
                                        $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
 
-                                       if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
+                                       if (!$cache_images && time() - $last_updated > 120) {
                                                include "rssfuncs.php";
                                                update_rss_feed($feed, true, true);
                                        } else {
@@ -1167,6 +1164,52 @@ class Feeds extends Handler_Protected {
                </div>";
        }
 
+       function update_debugger() {
+               header("Content-type: text/html");
+
+               $feed_id = (int)$_REQUEST["feed_id"];
+               @$do_update = $_REQUEST["action"] == "do_update";
+               $csrf_token = $_REQUEST["csrf_token"];
+
+               $refetch_checked = isset($_REQUEST["force_refetch"]) ? "checked" : "";
+               $rehash_checked = isset($_REQUEST["force_rehash"]) ? "checked" : "";
+
+               ?>
+               <html>
+               <head>
+                       <link rel="stylesheet" type="text/css" href="css/utility.css">
+                       <title>Feed Debugger</title>
+               </head>
+               <body class="small_margins">
+               <h1>Feed Debugger: <?php echo "$feed_id: " . getFeedTitle($feed_id) ?></h1>
+               <form method="GET" action="">
+                       <input type="hidden" name="op" value="feeds">
+                       <input type="hidden" name="method" value="update_debugger">
+                       <input type="hidden" name="xdebug" value="1">
+                       <input type="hidden" name="csrf_token" value="<?php echo $csrf_token ?>">
+                       <input type="hidden" name="action" value="do_update">
+                       <input type="hidden" name="feed_id" value="<?php echo $feed_id ?>">
+                       <input type="checkbox" name="force_refetch" value="1" <?php echo $refetch_checked ?>> Force refetch<br/>
+                       <input type="checkbox" name="force_rehash" value="1" <?php echo $rehash_checked ?>> Force rehash<br/>
+
+                       <p/><button type="submit">Continue</button>
+               </form>
+
+               <hr>
+
+               <pre><?php
+
+               if ($do_update) {
+                       include "rssfuncs.php";
+                       update_rss_feed($feed_id, true, true);
+               }
+
+               ?></pre>
 
+               </body>
+               </html>
+               <?php
+
+       }
 }
 ?>
index 85f136ad9e900e7e755a55178acfb26c512a4d97..77452a9a5b994ed699a655a98f0c73612ddf6603 100644 (file)
@@ -9,6 +9,11 @@ body {
        max-width : 800px;
 }
 
+body.small_margins {
+       margin : 1em;
+       max-width : none;
+}
+
 form {
        margin : 10px 0px 0px 0px;
        padding : 0px;
index 08602c8e5ffacbae176b8bf476c3beffae147b13..602c953b1ed0f0955cf29902ddbe2ef9f6161040 100644 (file)
@@ -422,10 +422,12 @@ function init() {
                                quickAddFeed();
                };
                hotkey_actions["feed_debug_update"] = function() {
-                               window.open("backend.php?op=feeds&method=view&feed=" + getActiveFeedId() +
-                                       "&view_mode=adaptive&order_by=default&update=&m=ForceUpdate&cat=" +
-                                       activeFeedIsCat() + "&DevForceUpdate=1&debug=1&xdebug=1&csrf_token=" +
-                                       getInitParam("csrf_token"));
+                       if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
+                               window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
+                               "&csrf_token=" + getInitParam("csrf_token"));
+                       } else {
+                               alert("You can't debug this kind of feed.");
+                       }
                };
                hotkey_actions["feed_edit"] = function() {
                                if (activeFeedIsCat())