diff options
Diffstat (limited to 'app/Controllers')
| -rw-r--r-- | app/Controllers/updateController.php | 20 | ||||
| -rw-r--r-- | app/Controllers/userController.php | 16 |
2 files changed, 27 insertions, 9 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; diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 6afc91b4e..7ce6b298a 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -248,7 +248,21 @@ class FreshRSS_user_Controller extends Minz_ActionController { } if ($ok) { $newUserDAO = FreshRSS_Factory::createUserDao($new_user_name); - $ok &= $newUserDAO->createUser($insertDefaultFeeds); + $ok &= $newUserDAO->createUser(); + + if ($ok && $insertDefaultFeeds) { + $opmlPath = DATA_PATH . '/opml.xml'; + if (!file_exists($opmlPath)) { + $opmlPath = FRESHRSS_PATH . '/opml.default.xml'; + } + $importController = new FreshRSS_importExport_Controller(); + try { + $importController->importFile($opmlPath, $opmlPath, $new_user_name); + } catch (Exception $e) { + Minz_Log::error('Error while importing default OPML for user ' . $new_user_name . ': ' . $e->getMessage()); + } + } + $ok &= self::updateUser($new_user_name, $email, $passwordPlain, $apiPasswordPlain); } return $ok; |
