diff options
-rw-r--r-- | bin/migrate_config.inc | 84 | ||||
-rw-r--r-- | config/ampache.cfg.php.dist | 9 | ||||
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | templates/show_test_config.inc.php | 8 |
5 files changed, 101 insertions, 4 deletions
diff --git a/bin/migrate_config.inc b/bin/migrate_config.inc new file mode 100644 index 00000000..fe5e907d --- /dev/null +++ b/bin/migrate_config.inc @@ -0,0 +1,84 @@ +<?php +/* + + Copyright 2001 - 2007 Ampache.org + All Rights Reserved + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +define(NO_SESSION,'1'); + +$unmigratable = array('auth_methods'=>'mysql', + 'tag_order'=>'id3v2,id3v1,vorbiscomment,quicktime,ape,asf', + 'album_art_order'=>'db,id3,folder,lastfm,amazon', + 'amazon_base_urls'=>'http://webservices.amazon.com'); + +$translate = array('local_host'=>'database_hostname', + 'local_db'=>'database_name', + 'local_username'=>'database_username', + 'local_pass'=>'database_password', + 'local_length'=>'session_length', + 'sess_name'=>'session_name', + 'sess_cookielife'=>'session_cookielife', + 'sess_cookiesecure'=>'session_cookiesecure'); + +$old_config = file_get_contents('../config/ampache.cfg.php'); + +$data = explode("\n",$old_config); + +echo "Parsing old config file...\n"; + +foreach ($data as $line) { + + // Replace a # with ; + if ($line['0'] == '#') { + $line = substr_replace($line,";",0,1); + } + + foreach ($unmigratable as $option=>$default) { + if (strstr($line,$option) AND !$migrated[$option]) { + $line = $option . " = \"$default\""; + $migrated[$option] = true; + } + elseif (strstr($line,$option)) { + $line = ';' . $line; + } + } + + foreach ($translate as $old=>$new) { + if (strstr($line,$old)) { + $line = str_replace($old,$new,$line); + } + } + + $new_config .= $line . "\n"; + +} // end foreach lines + + +echo "Parse complete, writing\n"; + +$handle = fopen('../config/ampache.cfg.php','w'); + +$worked = fwrite($handle,$new_config); + +if ($worked) { + echo "Write success, config migrated\n"; +} +else { + echo "Access Denied, config migration failed\n"; +} + +?> diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index 91e98847..d660c940 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -7,7 +7,7 @@ ; if this config file is up to date ; this is compared against a value hardcoded ; into the init script -config_version = 2 +config_version = 4 ;################### ; Path Vars # @@ -102,6 +102,13 @@ catalog_file_pattern = "mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|s ; DEFAULT: true require_session = "true" +; Multiple Logins +; Added by Vlet 07/25/07 +; When this setting is enabled a user may only be logged in from a single +; IP address at any one time, this is to prevent sharing of accounts +; DEFAULT: false +;prevent_multiple_logins = "false" + ; Downsample Remote ; If this is set to true and access control is on any users who are not ; coming from a defined localnet will be automatically downsampled diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 2cdf5f7c..b512bfd3 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Alpha1 + - Added Migration script for config file. Also added in sane + redirection on config parse failure - Added initial dyanmic playlist item support, only default and genre work right now. - Added support for Internet Radio Stations diff --git a/lib/init.php b/lib/init.php index b7032e29..ebef623c 100644 --- a/lib/init.php +++ b/lib/init.php @@ -68,7 +68,7 @@ if (!count($results)) { /** This is the version.... fluf nothing more... **/ $results['version'] = '3.4-Alpha1'; -$results['int_config_version'] = '2'; +$results['int_config_version'] = '4'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/templates/show_test_config.inc.php b/templates/show_test_config.inc.php index 6d3220d4..644e1d4b 100644 --- a/templates/show_test_config.inc.php +++ b/templates/show_test_config.inc.php @@ -41,12 +41,16 @@ body { <p>Ampache.cfg.php error detected</p> </div> <div id="content"> +<h3 style="color:red;">Ampache.cfg.php Parse Error</h3> +<p>You've been redirected to this page because your <strong>/config/ampache.cfg.php</strong> was not parsable. +If you are upgrading from 3.3.x please see the directions below.</p> + <h3>Migrating from 3.3.x to 3.4.x</h3> <p>Ampache 3.4 uses a different config parser that is over 10x faster then the previous version. Unfortunately the new parser is -unable to read the old config files. You must run <strong>/bin/generate_config.inc</strong> from the command line to create your +unable to read the old config files. You must run <strong>/bin/migrate_config.inc</strong> from the command line to create your new config file.</p> -<p>The following settings will not be migrated by the <strong>generate_config.inc</strong> script due to major changes between versions. The default +<p>The following settings will not be migrated by the <strong>migrate_config.inc</strong> script due to major changes between versions. The default values from the ampache.cfg.php.dist file will be used.</p> <strong>auth_methods</strong> (<i>mysql</i>)<br /> |