aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/updateController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-11-06 21:54:13 +0100
committerGravatar GitHub <noreply@github.com> 2019-11-06 21:54:13 +0100
commit91cb165829badde07c42a002215cf52779d891b6 (patch)
treeb8ee6e04e32dcf6c6fc25b7b0b9fe2952d2991ba /app/Controllers/updateController.php
parent3aa66f317b496ccd9a2df914bbc747c52081a7ad (diff)
parent6d596e9e54308297d423b23bf65338d62eebc415 (diff)
Merge pull request #2633 from FreshRSS/dev1.15.1
FreshRSS 1.15.1
Diffstat (limited to 'app/Controllers/updateController.php')
-rw-r--r--app/Controllers/updateController.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index ebe5e4cc8..c0c1ef1c8 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -23,26 +23,28 @@ class FreshRSS_update_Controller extends Minz_ActionController {
}
chdir($cwd);
$line = is_array($output) ? implode('; ', $output) : '' . $output;
- return strpos($line, '[behind') !== false;
+ return strpos($line, '[behind') !== false || strpos($line, '[ahead') !== false;
}
public static function gitPull() {
$cwd = getcwd();
chdir(FRESHRSS_PATH);
- $output = array();
+ $output = '';
$return = 1;
try {
- exec('git clean -f -d -f', $output, $return);
+ exec('git fetch', $output, $return);
if ($return == 0) {
- exec('git pull --ff-only', $output, $return);
- } else {
- $line = is_array($output) ? implode('; ', $output) : '' . $output;
- Minz_Log::warning('git clean warning:' . $line);
+ exec('git reset --hard FETCH_HEAD', $output, $return);
}
} catch (Exception $e) {
- Minz_Log::warning('git pull error:' . $e->getMessage());
+ Minz_Log::warning('Git error:' . $e->getMessage());
+ if ($output == '') {
+ $output = $e->getMessage();
+ }
+ $return = 1;
}
chdir($cwd);
+ deleteInstall();
$line = is_array($output) ? implode('; ', $output) : '' . $output;
return $return == 0 ? true : 'Git error: ' . $line;
}
@@ -52,6 +54,8 @@ class FreshRSS_update_Controller extends Minz_ActionController {
Minz_Error::error(403);
}
+ include_once(LIB_PATH . '/lib_install.php');
+
invalidateHttpCache();
$this->view->update_to_apply = false;