X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;ds=sidebyside;f=utf8%2Finstall.php;fp=utf8%2Finstall.php;h=7060b23f0a00478685801a36a149b55f2b2f3b52;hb=b5f3f1bf515d9979f70fd0043dc562d6c6ca3a4b;hp=19b5eb574f6f702a47b12e21edee0d82a0aa825c;hpb=9133cfc6678513cdd7a9f9571d5027c1b719e962;p=nucleus-jp%2Fnucleus-jp-ancient.git diff --git a/utf8/install.php b/utf8/install.php index 19b5eb5..7060b23 100755 --- a/utf8/install.php +++ b/utf8/install.php @@ -70,9 +70,17 @@ if (phpversion() >= '4.1.0') { include_once('nucleus/libs/vars4.0.6.php'); } -include_once('nucleus/libs/mysql.php'); +// include core classes that are needed for login & plugin handling +// added for 3.5 sql_* wrapper +global $MYSQL_HANDLER; +if (!isset($MYSQL_HANDLER)) + $MYSQL_HANDLER = array('mysql',''); +include_once(str_replace("install.php", "", __FILE__) . 'nucleus/libs/sql/'.$MYSQL_HANDLER[0].'.php'); +// end new for 3.5 sql_* wrapper +include_once(str_replace("install.php", "", __FILE__) . '/nucleus/libs/mysql.php'); // check if mysql support is installed +// this check may not make sense, as is, in a version past 3.5x if (!function_exists('mysql_query') ) { _doError(_ERROR1); } @@ -162,16 +170,16 @@ function showInstallForm() { 0) { - $row = mysql_fetch_array($result); + if ($result != FALSE && @sql_num_rows($result) > 0) { + $row = sql_fetch_array($result); $match = explode('.', $row['version']); } else { - $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); + $result = @sql_query('SHOW VARIABLES LIKE \'version\''); - if ($result != FALSE && @mysql_num_rows($result) > 0) { - $row = mysql_fetch_row($result); + if ($result != FALSE && @sql_num_rows($result) > 0) { + $row = sql_fetch_row($result); $match = explode('.', $row[1]); } else { $output = shell_exec('mysql -V'); @@ -564,11 +572,13 @@ function doInstall() { } // 2-1. try to log in to mySQL + global $MYSQL_CONN; - $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password); + // this will need to be changed if we ever allow + $MYSQL_CONN = @sql_connect_args($mysql_host, $mysql_user, $mysql_password); if ($MYSQL_CONN == false) { - _doError(_ERROR15 . ': ' . mysql_error() ); + _doError(_ERROR15 . ': ' . sql_error() ); } // @@ -577,7 +587,7 @@ function doInstall() { if ($mySqlVer >= '5.0.7' && phpversion() >= '5.2.3') { mysql_set_charset($charset); } elseif ($mySqlVer >= '4.1.0') { - mysql_query("SET NAMES " . $charset); + sql_query("SET NAMES " . $charset); } $collation = ($charset == 'utf8') ? 'utf8_unicode_ci' : 'ujis_japanese_ci'; // */ @@ -594,11 +604,11 @@ function doInstall() { . $collation; } // */ - mysql_query($sql) or _doError(_ERROR16 . ': ' . mysql_error()); + sql_query($sql) or _doError(_ERROR16 . ': ' . sql_error()); } // 4. try to select database - mysql_select_db($mysql_database) or _doError(_ERROR17); + sql_select_db($mysql_database) or _doError(_ERROR17); // 5. execute queries $filename = 'install.sql'; @@ -673,7 +683,7 @@ function doInstall() { } // */ - mysql_query($query) or _doError(_ERROR30 . ' (' . htmlspecialchars($query) . '): ' . mysql_error() ); + sql_query($query) or _doError(_ERROR30 . ' (' . htmlspecialchars($query) . '): ' . sql_error() ); } } @@ -695,7 +705,7 @@ function doInstall() { . " '" . $itm_body . "'," . " '" . $itm_more . "'," . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);"; - mysql_query($newpost) or _doError(_ERROR18 . ' (' . htmlspecialchars($newpost) . '): ' . mysql_error() ); + sql_query($newpost) or _doError(_ERROR18 . ' (' . htmlspecialchars($newpost) . '): ' . sql_error() ); // 6. update global settings updateConfig('IndexURL', $config_indexurl); @@ -722,7 +732,7 @@ function doInstall() { . " WHERE" . " mnumber = 1"; - mysql_query($query) or _doError(_ERROR19 . ': ' . mysql_error() ); + sql_query($query) or _doError(_ERROR19 . ': ' . sql_error() ); // 8. update weblog settings $query = 'UPDATE ' . tableName('nucleus_blog') @@ -732,7 +742,7 @@ function doInstall() { . " WHERE" . " bnumber = 1"; - mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() ); + sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() ); // 8-2. update category settings if ($charset == 'ujis') { @@ -748,14 +758,14 @@ function doInstall() { . " WHERE" . " catid = 1"; - mysql_query($query) or _doError(_ERROR20 . ': ' . mysql_error() ); + sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() ); // 9. update item date $query = 'UPDATE ' . tableName('nucleus_item') . " SET itime = '" . date('Y-m-d H:i:s', time() ) ."'" . " WHERE inumber = 1"; - mysql_query($query) or _doError(_ERROR21 . ': ' . mysql_error() ); + sql_query($query) or _doError(_ERROR21 . ': ' . sql_error() ); global $aConfPlugsToInstall, $aConfSkinsToImport; $aSkinErrors = array(); @@ -781,7 +791,7 @@ function doInstall() { $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; // close database connection (needs to be closed if we want to include globalfunctions.php) - mysql_close(); + sql_close(); $manager = ''; include_once($DIR_LIBS . 'globalfunctions.php'); @@ -811,6 +821,10 @@ function doInstall() { $config_data .= " \$MYSQL_PASSWORD = '" . $mysql_password . "';\n"; $config_data .= " \$MYSQL_DATABASE = '" . $mysql_database . "';\n"; $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1) ? $mysql_prefix : '') . "';\n"; + $config_data .= " // new in 3.50. first element is db handler, the second is the db driver used by the handler\n"; + $config_data .= " // default is \$MYSQL_HANDLER = array('mysql','mysql');\n"; + $config_data .= " \$MYSQL_HANDLER = array('mysql','mysql');\n"; + $config_data .= " //\$MYSQL_HANDLER = array('pdo','mysql');\n"; $config_data .= "\n"; $config_data .= " // main nucleus directory\n"; $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; @@ -929,11 +943,11 @@ function doInstall() {
  • - +

    -

    +