Changeset 5230
- Timestamp:
- Mar 21, 2010, 10:15:54 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/common.inc.php
r5215 r5230 106 106 // Database connection 107 107 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 108 $conf['db_password'], $conf['db_base']) 109 or my_error('pwg_db_connect', true);108 $conf['db_password'], $conf['db_base']); 109 pwg_select_db($conf['db_base'], $pwg_db_link); 110 110 111 111 pwg_db_check_charset(); -
trunk/include/dblayer/functions_mysql.inc.php
r5196 r5230 33 33 */ 34 34 35 function pwg_db_connect($host, $user, $password, $database )35 function pwg_db_connect($host, $user, $password, $database=null, $die=true) 36 36 { 37 $link = mysql_connect($host, $user, $password) or my_error('mysql_connect', false); 38 mysql_select_db($database, $link) or my_error('mysql_select_db', false); 37 $link = @mysql_connect($host, $user, $password) or my_error('mysql_connect', $die); 39 38 40 39 return $link; 40 } 41 42 function pwg_select_db($database, $link, $die=true) 43 { 44 return @mysql_select_db($database, $link) or my_error('mysql_select_db', $die); 41 45 } 42 46 -
trunk/include/dblayer/functions_pdo-sqlite.inc.php
r5196 r5230 34 34 */ 35 35 36 function pwg_db_connect($host, $user, $password, $database )36 function pwg_db_connect($host, $user, $password, $database, $die=true) 37 37 { 38 38 global $conf; … … 43 43 $link = new PDO($db_file); 44 44 } catch (Exception $e) { 45 my_error('sqlite::open', true);45 my_error('sqlite::open', $die); 46 46 } 47 47 … … 55 55 56 56 return $link; 57 } 58 59 function pwg_select_db($database=null, $link=null, $die=null) 60 { 61 return true; 57 62 } 58 63 -
trunk/include/dblayer/functions_pgsql.inc.php
r5196 r5230 34 34 */ 35 35 36 function pwg_db_connect($host, $user, $password, $database )36 function pwg_db_connect($host, $user, $password, $database, $die=true) 37 37 { 38 38 $connection_string = ''; … … 50 50 $password, 51 51 $database); 52 $link = pg_connect($connection_string) or my_error('pg_connect', false);52 $link = pg_connect($connection_string) or my_error('pg_connect', $die); 53 53 54 54 return $link; 55 } 56 57 function pwg_select_db($database=null, $link=null, $die=null) 58 { 59 return true; 55 60 } 56 61 -
trunk/include/dblayer/functions_sqlite.inc.php
r5196 r5230 34 34 */ 35 35 36 function pwg_db_connect($host, $user, $password, $database )36 function pwg_db_connect($host, $user, $password, $database, $die=true) 37 37 { 38 38 global $conf; … … 51 51 $link = new SQLite3($db_file, $sqlite_open_mode); 52 52 } catch (Exception $e) { 53 my_error('sqlite::open', true);53 my_error('sqlite::open', $die); 54 54 } 55 55 … … 63 63 64 64 return $link; 65 } 66 67 function pwg_select_db($database=null, $link=null, $die=null) 68 { 69 return true; 65 70 } 66 71 -
trunk/install.php
r5220 r5230 228 228 if ( isset( $_POST['install'] )) 229 229 { 230 ob_start(); 230 231 if (($pwg_db_link = pwg_db_connect($_POST['dbhost'], $_POST['dbuser'], 231 $_POST['dbpasswd'], $_POST['dbname']))!==false) 232 { 233 234 array_push( $infos, l10n('Parameters are correct') ); 232 $_POST['dbpasswd'], $_POST['dbname'], false))!==false) 233 { 234 if (pwg_select_db($_POST['dbname'], $pwg_db_link, false)!==false) 235 { 236 array_push( $infos, l10n('Parameters are correct') ); 237 } 238 else 239 { 240 array_push( $errors, 241 l10n('Connection to server succeed, but it was impossible to connect to database') ); 242 } 243 ob_end_clean(); 235 244 236 245 $required_version = constant('REQUIRED_'.strtoupper($dblayer).'_VERSION'); … … 262 271 { 263 272 array_push( $errors, l10n('Can\'t connect to server') ); 264 }265 273 ob_end_clean(); 274 } 266 275 $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); 267 276 if ( empty($webmaster)) -
trunk/upgrade.php
r5215 r5230 53 53 // Database connection 54 54 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 55 $conf['db_password'], $conf['db_base']) 56 or my_error('pwg_db_connect', true);55 $conf['db_password'], $conf['db_base']); 56 pwg_select_db($conf['db_base'], $pwg_db_link); 57 57 58 58 pwg_db_check_charset(); -
trunk/upgrade_feed.php
r5215 r5230 57 57 58 58 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 59 $conf['db_password'], $conf['db_base']) 60 or my_error('pwg_db_connect', true);59 $conf['db_password'], $conf['db_base']); 60 pwg_select_db($conf['db_base'], $pwg_db_link); 61 61 62 62 pwg_db_check_charset();
Note: See TracChangeset
for help on using the changeset viewer.