diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2012-03-06 16:34:27 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2012-03-06 16:42:04 -0500 |
commit | ca60de30bc8608b1028a7b865785edb1911f9b89 (patch) | |
tree | d5facb36ca79b01616f59ad4ad4aa71e942beb58 /lib/class/update.class.php | |
parent | 798318250390d983bc82df5efa37414da128e0ae (diff) | |
download | ampache-ca60de30bc8608b1028a7b865785edb1911f9b89.tar.gz ampache-ca60de30bc8608b1028a7b865785edb1911f9b89.tar.bz2 ampache-ca60de30bc8608b1028a7b865785edb1911f9b89.zip |
Add CLI tool for running database updates
Diffstat (limited to 'lib/class/update.class.php')
-rw-r--r-- | lib/class/update.class.php | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php index a8d6d5e5..76e8bd3c 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -390,22 +390,38 @@ class Update { if (!is_array(self::$versions)) { self::$versions = self::populate_version(); } + $update_needed = false; - echo "<ul>\n"; + if (!defined('CLI')) { echo "<ul>\n"; } - foreach (self::$versions as $version) { + foreach (self::$versions as $update) { - if ($version['version'] > $current_version) { - $updated = true; - echo "<li><b>Version: " . self::format_version($version['version']) . "</b><br />"; - echo $version['description'] . "<br /></li>\n"; + if ($update['version'] > $current_version) { + $update_needed = true; + if (!defined('CLI')) { echo '<li><b>'; } + echo 'Version: ', self::format_version($update['version']); + if (defined('CLI')) { + echo "\n", str_replace('<br />', "\n", $update['description']), "\n"; + } + else { + echo '</b><br />', $update['description'], "<br /></li>\n"; + } } // if newer } // foreach versions - echo "</ul>\n"; + if (!defined('CLI')) { echo "</ul>\n"; } - if (!isset($updated)) { echo "<p align=\"center\">No Updates Needed [<a href=\"" . Config::get('web_path') . "\">Return</a>]</p>"; } + if (!$update_needed) { + if (!defined('CLI')) { echo '<p align="center">'; } + echo _('No updates needed.'); + if (!defined('CLI')) { + echo '[<a href="', Config::get('web_path'), '">Return</a>]</p>'; + } + else { + echo "\n"; + } + } } // display_update /** |