1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

Add git pull update from web interface

This commit is contained in:
Afterster 2014-05-29 00:22:36 +02:00
parent 222b7b3863
commit 176cf4a380
2 changed files with 37 additions and 12 deletions

View file

@ -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') . ' <a href="https://github.com/ampache/ampache/' . (self::is_develop() ? 'compare/' . self::get_current_version() . '...' . self::get_latest_version() : 'blob/master/docs/CHANGELOG.md') . '" target="_blank">' . T_('changes') . '</a> ';
echo T_('or') . ' <a href="https://github.com/ampache/ampache/archive/' . (self::is_develop() ? 'develop.zip' : self::get_latest_version() . '.zip') . '" target="_blank"><b>' . T_('download') . '</b></a>.';
if (self::is_git_repository()) {
echo ' | <a href="' . AmpConfig::get('web_path') . '/update.php?type=sources&action=update">.:: Update ::.</a>';
}
echo '</div>';
}
public static function update_files()
{
echo T_('Updating Ampache sources with `git pull` ...') . '<br />';
ob_flush();
chdir(AmpConfig::get('prefix'));
exec('git pull https://github.com/ampache/ampache.git');
echo T_('Done') . '<br />';
ob_flush();
}
}

View file

@ -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 '<script language="javascript" type="text/javascript">window.location="' . AmpConfig::get('web_path') . '";</script>';
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'));
<h1><?php echo T_('Ampache Update'); ?></h1>
</div>
<div class="well">
<p><?php printf(T_('This page handles all database updates to Ampache starting with <strong>3.3.3.5</strong>. According to your database your current version is: <strong>%s</strong>.'), Update::format_version($version)); ?></p>
<p><?php echo T_('The following updates need to be performed'); ?></p>
<p><?php printf(T_('This page handles all database updates to Ampache starting with <strong>3.3.3.5</strong>. Your current version is <strong>%s</strong> with database version <strong>%s</strong>.'), AmpConfig::get('version'), $version); ?></p>
<p><?php echo T_('The following updates need to be performed:'); ?></p>
</div>
<?php Error::display('general'); ?>
<div class="content">