Attempt to create database when there is no connection
This commit is contained in:
@ -4,6 +4,7 @@ Add language setting to profile
|
|||||||
Add checks for required extensions
|
Add checks for required extensions
|
||||||
Move some more settings to the database
|
Move some more settings to the database
|
||||||
Add CSS to limit list of chatters hight
|
Add CSS to limit list of chatters hight
|
||||||
|
Attempt to create database when there is no connection
|
||||||
|
|
||||||
Version 1.15.3 - Mar. 6, 2016
|
Version 1.15.3 - Mar. 6, 2016
|
||||||
Allow using html tags in linkfilter without breaking dereferrer or image embed
|
Allow using html tags in linkfilter without breaking dereferrer or image embed
|
||||||
|
2
README
2
README
@ -43,7 +43,7 @@ Optionally, you can install:
|
|||||||
- a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit.
|
- a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit.
|
||||||
- a MySQL or PostgreSQL server to use as an external database instead of SQLite
|
- a MySQL or PostgreSQL server to use as an external database instead of SQLite
|
||||||
- the openssl extension for encryption of messages and notes in the database
|
- the openssl extension for encryption of messages and notes in the database
|
||||||
When you have everything installed, you'll have to create a database and a user for the chat in mysql.
|
When you have everything installed and use MySQL or PostgreSQL, you'll have to create a database and a user for the chat.
|
||||||
Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them.
|
Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them.
|
||||||
Then copy the script to your web-server directory and call the script in your browser with a parameter like this:
|
Then copy the script to your web-server directory and call the script in your browser with a parameter like this:
|
||||||
http://(server)/(script-name).php?action=setup
|
http://(server)/(script-name).php?action=setup
|
||||||
|
@ -46,7 +46,7 @@ Optionally, you can install:
|
|||||||
- a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit.
|
- a memcached server and the memcached extension and change the configuaration to use memcached. This will lessen the database load a bit.
|
||||||
- a MySQL or PostgreSQL server to use as an external database instead of SQLite
|
- a MySQL or PostgreSQL server to use as an external database instead of SQLite
|
||||||
- the openssl extension for encryption of messages and notes in the database
|
- the openssl extension for encryption of messages and notes in the database
|
||||||
When you have everything installed, you'll have to create a database and a user for the chat in mysql.
|
When you have everything installed and use MySQL or PostgreSQL, you'll have to create a database and a user for the chat.
|
||||||
Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them.
|
Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them.
|
||||||
Then copy the script to your web-server directory and call the script in your browser with a parameter like this:
|
Then copy the script to your web-server directory and call the script in your browser with a parameter like this:
|
||||||
http://(server)/(script-name).php?action=setup
|
http://(server)/(script-name).php?action=setup
|
||||||
|
22
chat.php
22
chat.php
@ -3240,7 +3240,7 @@ function update_db(){
|
|||||||
$memcached->delete(DBNAME . '-' . PREFIX . 'members');
|
$memcached->delete(DBNAME . '-' . PREFIX . 'members');
|
||||||
$memcached->delete(DBNAME . '-' . PREFIX . 'ignored');
|
$memcached->delete(DBNAME . '-' . PREFIX . 'ignored');
|
||||||
}
|
}
|
||||||
if(DBDRIVER===0){//MySQL
|
if(DBDRIVER===0){//MySQL - previously had a wrong SQL syntax and the captcha table was not created.
|
||||||
$db->exec('CREATE TABLE IF NOT EXISTS ' . PREFIX . 'captcha (id int(10) unsigned NOT NULL AUTO_INCREMENT, time int(10) unsigned NOT NULL, code char(5) NOT NULL, PRIMARY KEY (id) USING BTREE) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_bin;');
|
$db->exec('CREATE TABLE IF NOT EXISTS ' . PREFIX . 'captcha (id int(10) unsigned NOT NULL AUTO_INCREMENT, time int(10) unsigned NOT NULL, code char(5) NOT NULL, PRIMARY KEY (id) USING BTREE) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_bin;');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3323,6 +3323,25 @@ function check_db(){
|
|||||||
}
|
}
|
||||||
$db=new PDO('sqlite:' . SQLITEDBFILE, NULL, NULL, $options);
|
$db=new PDO('sqlite:' . SQLITEDBFILE, NULL, NULL, $options);
|
||||||
}
|
}
|
||||||
|
}catch(PDOException $e){
|
||||||
|
try{
|
||||||
|
//Attempt to create database
|
||||||
|
if(DBDRIVER===0){
|
||||||
|
$db=new PDO('mysql:host=' . DBHOST, DBUSER, DBPASS, $options);
|
||||||
|
if(false!==$db->exec('CREATE DATABASE ' . DBNAME)){
|
||||||
|
$db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS, $options);
|
||||||
|
}else{
|
||||||
|
die($I['nodbsetup']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif(DBDRIVER===1){
|
||||||
|
$db=new PDO('pgsql:host=' . DBHOST, DBUSER, DBPASS, $options);
|
||||||
|
if(false!==$db->exec('CREATE DATABASE ' . DBNAME)){
|
||||||
|
$db=new PDO('pgsql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS, $options);
|
||||||
|
}else{
|
||||||
|
die($I['nodbsetup']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}catch(PDOException $e){
|
}catch(PDOException $e){
|
||||||
if(isSet($_REQUEST['action']) && $_REQUEST['action']==='setup'){
|
if(isSet($_REQUEST['action']) && $_REQUEST['action']==='setup'){
|
||||||
die($I['nodbsetup']);
|
die($I['nodbsetup']);
|
||||||
@ -3330,6 +3349,7 @@ function check_db(){
|
|||||||
die($I['nodb']);
|
die($I['nodb']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(MEMCACHED){
|
if(MEMCACHED){
|
||||||
if(!extension_loaded('memcached')){
|
if(!extension_loaded('memcached')){
|
||||||
die($I['memcachedextrequired']);
|
die($I['memcachedextrequired']);
|
||||||
|
Reference in New Issue
Block a user