summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.docker/app/startup.sh2
-rw-r--r--classes/Pref_Prefs.php33
2 files changed, 29 insertions, 6 deletions
diff --git a/.docker/app/startup.sh b/.docker/app/startup.sh
index 1174e8fae..fd0569e21 100644
--- a/.docker/app/startup.sh
+++ b/.docker/app/startup.sh
@@ -86,7 +86,7 @@ if [ -z "$TTRSS_NO_STARTUP_PLUGIN_UPDATES" ]; then
cd $PLUGIN && \
sudo -u app git config core.filemode false && \
sudo -u app git config pull.rebase false && \
- sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed.
+ sudo -u app git pull origin main || sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed.
fi
done
else
diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php
index 97a6940b5..2697ed6e9 100644
--- a/classes/Pref_Prefs.php
+++ b/classes/Pref_Prefs.php
@@ -1087,7 +1087,8 @@ class Pref_Prefs extends Handler_Protected {
2 => ["pipe", "w"], // STDERR
];
- $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
+ // TODO: clean up handling main+master
+ $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/main --oneline", $descriptorspec, $pipes, $plugin_dir);
if (is_resource($proc)) {
$rv = [
@@ -1096,6 +1097,15 @@ class Pref_Prefs extends Handler_Protected {
"git_status" => proc_close($proc),
];
$rv["need_update"] = !empty($rv["stdout"]);
+ } else {
+ $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
+
+ $rv = [
+ "stdout" => stream_get_contents($pipes[1]),
+ "stderr" => stream_get_contents($pipes[2]),
+ "git_status" => proc_close($proc),
+ ];
+ $rv["need_update"] = !empty($rv["stdout"]);
}
}
@@ -1119,12 +1129,25 @@ class Pref_Prefs extends Handler_Protected {
2 => ["pipe", "w"], // STDERR
];
- $proc = proc_open("git fetch origin -a && git log HEAD..origin/master --oneline && git pull --ff-only origin master", $descriptorspec, $pipes, $plugin_dir);
+ // TODO: clean up handling main+master
+ $proc = proc_open("git fetch origin -a && git log HEAD..origin/main --oneline && git pull --ff-only origin main", $descriptorspec, $pipes, $plugin_dir);
if (is_resource($proc)) {
- $rv["stdout"] = stream_get_contents($pipes[1]);
- $rv["stderr"] = stream_get_contents($pipes[2]);
- $rv["git_status"] = proc_close($proc);
+ $rv = [
+ 'stdout' => stream_get_contents($pipes[1]),
+ 'stderr' => stream_get_contents($pipes[2]),
+ 'git_status' => proc_close($proc),
+ ];
+ } else {
+ $proc = proc_open("git fetch origin -a && git log HEAD..origin/master --oneline && git pull --ff-only origin master", $descriptorspec, $pipes, $plugin_dir);
+
+ if (is_resource($proc)) {
+ $rv = [
+ 'stdout' => stream_get_contents($pipes[1]),
+ 'stderr' => stream_get_contents($pipes[2]),
+ 'git_status' => proc_close($proc),
+ ];
+ }
}
}