cvs: pear /LiveUser/sql install.php

From: Date: Fri, 15 Apr 2005 08:32:28 +0000
Subject: cvs: pear /LiveUser/sql install.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-31180@lists.php.net to get a copy of this message
lsmith Fri Apr 15 04:32:28 2005 EDT Modified files: /pear/LiveUser/sql install.php Log: - fixed installation of DB schemas - made auth fields dynamic (thx dan) - added more infos into the old file names http://cvs.php.net/diff.php/pear/LiveUser/sql/install.php?r1=1.7&r2=1.8&ty=u Index: pear/LiveUser/sql/install.php diff -u pear/LiveUser/sql/install.php:1.7 pear/LiveUser/sql/install.php:1.8 --- pear/LiveUser/sql/install.php:1.7 Thu Apr 14 07:08:49 2005 +++ pear/LiveUser/sql/install.php Fri Apr 15 04:32:27 2005 @@ -35,7 +35,7 @@ * @author Lukas Smith <smith@backendmedia.com> * @copyright 2002-2005 Markus Wolff * @license http://www.gnu.org/licenses/lgpl.txt - * @version CVS: $Id: install.php,v 1.7 2005/04/14 11:08:49 lsmith Exp $ + * @version CVS: $Id: install.php,v 1.8 2005/04/15 08:32:27 lsmith Exp $ * @link http://pear.php.net/LiveUser */ @@ -95,7 +95,7 @@ $dsn = $auth->dbc->dsn; if (is_a($auth->dbc, 'DB_Common')) { - $options['sequence_col_name'] = 'id'; + $options['seqname_col_name'] = 'id'; } else { $dsn['database'] = $auth->dbc->database_name; } @@ -103,13 +103,29 @@ $variables = array('database' => $dsn['database']); $variables['user_table_name'] = $auth->authTable; - $variables['auth_user_id_name'] = $auth->authTableCols['required']['auth_user_id']['name']; - $variables['handle_name'] = $auth->authTableCols['required']['handle']['name']; - $variables['passwd_name'] = $auth->authTableCols['required']['passwd']['name']; - $variables['lastlogin_name'] = $auth->authTableCols['optional']['lastlogin']['name']; - $variables['is_active_name'] = $auth->authTableCols['optional']['is_active']['name']; - $variables['owner_user_id_name'] = $auth->authTableCols['optional']['owner_user_id']['name']; - $variables['owner_group_id_name'] = $auth->authTableCols['optional']['owner_group_id']['name']; + if (isset($auth->authTableCols['required']) && + is_array($auth->authTableCols['required']) + ) { + foreach($auth->authTableCols['required'] as $key => $value) { + $variables[$key.'_name'] = $value['name']; + } + } + + if (isset($auth->authTableCols['optional']) && + is_array($auth->authTableCols['optional']) + ) { + foreach($auth->authTableCols['optional'] as $key => $value) { + $variables[$key.'_name'] = $value['name']; + } + } + + if (isset($auth->authTableCols['custom']) && + is_array($auth->authTableCols['custom']) + ) { + foreach($auth->authTableCols['custom'] as $key => $value) { + $variables[$key.'_name'] = $value['name']; + } + } return $this->installSchema($dsn, $file, $variables, $create, $options); } @@ -123,7 +139,7 @@ $dsn = $perm->dbc->dsn; if (is_a($perm->dbc, 'DB_Common')) { - $options['sequence_col_name'] = 'id'; + $options['seqname_col_name'] = 'id'; } else { $dsn['database'] = $perm->dbc->database_name; } @@ -141,6 +157,7 @@ { $manager =& new MDB2_Schema; + $file_old = $file.'.'.$dsn['hostspec'].'.'.$dsn['database'].'.old'; unset($dsn['database']); $err = $manager->connect($dsn, $options); @@ -149,7 +166,7 @@ } $variables['create'] = (int)$create; - $result = $manager->updateDatabase($file, $file.'.old', $variables); + $result = $manager->updateDatabase($file, $file_old, $variables); $debug = $manager->getOption('debug'); if ($debug && !PEAR::isError($debug)) {

« previous php.pear.cvs (#31180) next »