diff options
author | Karl Vollmer <karl.vollmer@dal.ca> | 2011-11-23 10:45:43 -0400 |
---|---|---|
committer | Karl Vollmer <karl.vollmer@dal.ca> | 2011-11-23 10:45:43 -0400 |
commit | d7c65985289d61ba1ef87d55f8df5485b73e5a48 (patch) | |
tree | b784db229e01ed9acb0d4688190d163b7c642c74 /lib/class/update.class.php | |
parent | 806b0c0b85f99a27cc169e9f99f88b6911687f4a (diff) | |
download | ampache-d7c65985289d61ba1ef87d55f8df5485b73e5a48.tar.gz ampache-d7c65985289d61ba1ef87d55f8df5485b73e5a48.tar.bz2 ampache-d7c65985289d61ba1ef87d55f8df5485b73e5a48.zip |
Fix DB updates so catalog remote_username and remote_password are added correctly, also fix catalog creation so they are stored in the database
Diffstat (limited to 'lib/class/update.class.php')
-rw-r--r-- | lib/class/update.class.php | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php index beb0a6c9..a03cb6d1 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -368,6 +368,9 @@ class Update { $update_string = '- Add local auth method to session.type.<br />'; $version[] = array('version' => '360007','description' => $update_string); + $update_string = '- Verify remote_username and remote_password were added correctly to catalog table.<br />'; + $version[] = array('version' => '360008','description' => $update_string); + return $version; } // populate_version @@ -1854,7 +1857,7 @@ class Update { $db_results = Dba::write($sql); // Add in Username / Password for catalog - to be used for remote catalogs - $sql = "ALTER TABLE `catalog` ADD `remote_username` VARCHAR ( 255 ) AFTER `user`"; + $sql = "ALTER TABLE `catalog` ADD `remote_username` VARCHAR ( 255 ) AFTER `catalog_type`"; $db_results = Dba::write($sql); $sql = "ALTER TABLE `catalog` ADD `remote_password` VARCHAR ( 255 ) AFTER `remote_username`"; @@ -2005,5 +2008,40 @@ class Update { self::set_version('db_version','360007'); } + /** + * update_360008 + * Fix bug that caused the remote_username/password fields to not be created + */ + public static function update_360008() { + + $remote_username = false; + $remote_password = false; + + $sql = "DESCRIBE `catalog`"; + $db_results = Dba::read($sql); + + while ($row = Dba::fetch_assoc($db_results)) { + if ($row['Field'] == 'remote_username') { + $remote_username = true; + } + if ($row['Field'] == 'remote_password') { + $remote_password = true; + } + } // end while + + if (!$remote_username) { + // Add in Username / Password for catalog - to be used for remote catalogs + $sql = "ALTER TABLE `catalog` ADD `remote_username` VARCHAR ( 255 ) AFTER `catalog_type`"; + $db_results = Dba::write($sql); + } + if (!$remote_password) { + $sql = "ALTER TABLE `catalog` ADD `remote_password` VARCHAR ( 255 ) AFTER `remote_username`"; + $db_results = Dba::write($sql); + } + + self::set_version('db_version','360008'); + + } // update_360008 + } // end update class ?> |