diff --git a/lib/class/autoupdate.class.php b/lib/class/autoupdate.class.php
index 25931249..e9a5cfe4 100644
--- a/lib/class/autoupdate.class.php
+++ b/lib/class/autoupdate.class.php
@@ -149,7 +149,7 @@ class AutoUpdate
}
public static function is_update_available($force = false)
- {
+ {return true;
if (!$force && (!self::lastcheck_expired() || !AmpConfig::get('autoupdate'))) {
return AmpConfig::get('autoupdate_lastversion_new');
}
@@ -191,6 +191,19 @@ class AutoUpdate
echo T_('See') . ' ' . T_('changes') . ' ';
echo T_('or') . ' ' . T_('download') . '.';
+ if (self::is_git_repository()) {
+ echo ' | .:: Update ::.';
+ }
echo '';
}
+
+ public static function update_files()
+ {
+ echo T_('Updating Ampache sources with `git pull` ...') . '
';
+ ob_flush();
+ chdir(AmpConfig::get('prefix'));
+ exec('git pull https://github.com/ampache/ampache.git');
+ echo T_('Done') . '
';
+ ob_flush();
+ }
}
diff --git a/update.php b/update.php
index fa687331..34af23c6 100644
--- a/update.php
+++ b/update.php
@@ -20,22 +20,34 @@
*
*/
-// We need this stuff
-define('NO_SESSION', 1);
-define('OUTDATED_DATABASE_OK', 1);
+if (isset($_REQUEST['type']) && $_REQUEST['type'] != 'sources') {
+ // We need this stuff
+ define('NO_SESSION', 1);
+ define('OUTDATED_DATABASE_OK', 1);
+}
require_once 'lib/init.php';
// Get the version and format it
$version = Update::get_version();
-if ($_REQUEST['action'] == 'update') {
+if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') {
+ if ($_REQUEST['type'] == 'sources') {
+ if (!Access::check('interface', '100')) {
+ UI::access_denied();
+ exit;
+ }
- /* Run the Update Mojo Here */
- Update::run_update();
-
- /* Get the New Version */
- $version = Update::get_version();
+ set_time_limit(300);
+ AutoUpdate::update_files();
+ echo '';
+ exit;
+ } else {
+ /* Run the Update Mojo Here */
+ Update::run_update();
+ /* Get the New Version */
+ $version = Update::get_version();
+ }
}
$htmllang = str_replace("_","-",AmpConfig::get('lang'));
@@ -64,8 +76,8 @@ $htmllang = str_replace("_","-",AmpConfig::get('lang'));
3.3.3.5. According to your database your current version is: %s.'), Update::format_version($version)); ?>
- +3.3.3.5. Your current version is %s with database version %s.'), AmpConfig::get('version'), $version); ?>
+