Merge pull request 'Default to null 'rv' for plugin update check.' (#17) from wn/tt-rss:inaccurate-available-plugin-updates into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/17
This commit is contained in:
commit
9b2267510b
|
@ -1057,7 +1057,7 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
|
|
||||||
private static function _plugin_needs_update($root_dir, $plugin_name) {
|
private static function _plugin_needs_update($root_dir, $plugin_name) {
|
||||||
$plugin_dir = "$root_dir/plugins.local/" . basename($plugin_name);
|
$plugin_dir = "$root_dir/plugins.local/" . basename($plugin_name);
|
||||||
$rv = [];
|
$rv = null;
|
||||||
|
|
||||||
if (is_dir($plugin_dir) && is_dir("$plugin_dir/.git")) {
|
if (is_dir($plugin_dir) && is_dir("$plugin_dir/.git")) {
|
||||||
$pipes = [];
|
$pipes = [];
|
||||||
|
@ -1071,9 +1071,11 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
$proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
|
$proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
|
||||||
|
|
||||||
if (is_resource($proc)) {
|
if (is_resource($proc)) {
|
||||||
$rv["stdout"] = stream_get_contents($pipes[1]);
|
$rv = [
|
||||||
$rv["stderr"] = stream_get_contents($pipes[2]);
|
"stdout" => stream_get_contents($pipes[1]),
|
||||||
$rv["git_status"] = proc_close($proc);
|
"stderr" => stream_get_contents($pipes[2]),
|
||||||
|
"git_status" => proc_close($proc),
|
||||||
|
];
|
||||||
$rv["need_update"] = !empty($rv["stdout"]);
|
$rv["need_update"] = !empty($rv["stdout"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,28 +697,30 @@ const Helpers = {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
reply.forEach((p) => {
|
reply.forEach((p) => {
|
||||||
if (p.rv.need_update) {
|
if (p.rv) {
|
||||||
dialog.plugins_to_update.push(p.plugin);
|
if (p.rv.need_update) {
|
||||||
|
dialog.plugins_to_update.push(p.plugin);
|
||||||
|
|
||||||
const update_button = dijit.getEnclosingWidget(
|
const update_button = dijit.getEnclosingWidget(
|
||||||
App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
|
App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
|
||||||
|
|
||||||
if (update_button)
|
if (update_button)
|
||||||
update_button.domNode.show();
|
update_button.domNode.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.rv.need_update || p.rv.git_status != 0) {
|
if (p.rv.need_update || p.rv.git_status != 0) {
|
||||||
container.innerHTML +=
|
container.innerHTML +=
|
||||||
`
|
`
|
||||||
<li><h3>${p.plugin}</h3>
|
<li><h3>${p.plugin}</h3>
|
||||||
${p.rv.stderr ? `<pre class="small text-error pre-wrap">${p.rv.stderr}</pre>` : ''}
|
${p.rv.stderr ? `<pre class="small text-error pre-wrap">${p.rv.stderr}</pre>` : ''}
|
||||||
${p.rv.stdout ? `<pre class="small text-success pre-wrap">${p.rv.stdout}</pre>` : ''}
|
${p.rv.stdout ? `<pre class="small text-success pre-wrap">${p.rv.stdout}</pre>` : ''}
|
||||||
<div class="small">
|
<div class="small">
|
||||||
${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) :
|
${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) :
|
||||||
App.FormFields.icon("check") + " " + __("Ready to update")}
|
App.FormFields.icon("check") + " " + __("Ready to update")}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
`
|
`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dialog.checkNextPlugin();
|
dialog.checkNextPlugin();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue