summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2011-08-04 00:10:23 -0400
committerPaul Arthur <paul.arthur@flowerysong.com>2011-08-04 00:10:23 -0400
commit9ecedf3ec811c758e26cd51ee3af715a88542ac1 (patch)
tree2b1e34c84048ebfd804a9cf6f9b4dfb4ffe64f44
parent3a1bf0c8fc6e02f0c5e7b967f3439256b5356837 (diff)
downloadampache-9ecedf3ec811c758e26cd51ee3af715a88542ac1.tar.gz
ampache-9ecedf3ec811c758e26cd51ee3af715a88542ac1.tar.bz2
ampache-9ecedf3ec811c758e26cd51ee3af715a88542ac1.zip
Make the output of catalog_update somewhat readable.
The previous method of mangling the generated HTML was extremely fragile and broke in a non-obvious fashion when the output was changed. Instead, modify our convenience function that updates the text to behave differently when the command line interface is being used.
-rw-r--r--bin/catalog_update.inc7
-rw-r--r--lib/ui.lib.php4
2 files changed, 9 insertions, 2 deletions
diff --git a/bin/catalog_update.inc b/bin/catalog_update.inc
index cc0a2f93..c24c3b97 100644
--- a/bin/catalog_update.inc
+++ b/bin/catalog_update.inc
@@ -26,6 +26,8 @@
*/
define('NO_SESSION','1');
+define('CLI', 1);
+
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
@@ -151,8 +153,9 @@ echo "\n";
function ob_html_strip($string) {
- $string = preg_replace("/update_txt\('.+'\);update_txt\('(.+)','.+'\);/","$1",$string);
- $string = preg_replace("/update_.+/","",$string);
+ //$string = preg_replace("/update_txt\('.+'\);update_txt\('(.+)','.+'\);/","$1",$string);
+ //$string = preg_replace("/update_.+/","",$string);
+ $string = str_replace('<br />', "\n", $string);
$string = strip_tags($string);
$string = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/","\n",$string);
$string = trim($string);
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 8e8b48c6..42003d9f 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -751,6 +751,10 @@ function toggle_visible($element) {
* Convenience function
*/
function update_text($field, $value) {
+ if(defined('CLI')) {
+ echo "$value\n";
+ return;
+ }
echo '<script type="text/javascript">';
echo "updateText('$field', '$value');";
echo "</script>\n";