本文整理汇总了PHP中mysql::DATABASE_EXISTS方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::DATABASE_EXISTS方法的具体用法?PHP mysql::DATABASE_EXISTS怎么用?PHP mysql::DATABASE_EXISTS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::DATABASE_EXISTS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MysqlCheck
function MysqlCheck(){
$db_file = "/usr/share/ocsinventory-reports/ocsreports/files/ocsbase.sql";
if(!is_file($db_file)){
echo "Starting......: OCS web Engine unable to stat $db_file\n";
return;
}
$q=new mysql();
if(!$q->DATABASE_EXISTS("ocsweb")){
echo "Starting......: OCS web Engine creating ocsweb\n";
$q->CREATE_DATABASE("ocsweb");
if(!$q->DATABASE_EXISTS("ocsweb")){
echo "Starting......: OCS web Engine unable to create ocsweb mysql database\n";
return;
}
}
if(CheckTables()){
$sock=new sockets();
$users=new usersMenus();
$q=new mysql();
$ocswebservername=$sock->GET_INFO("ocswebservername");
$OCSWebPort=$sock->GET_INFO("OCSWebPort");
if($OCSWebPort==null){$OCSWebPort=9080;}
if($OCSWebPortSSL==null){$OCSWebPortSSL=$OCSWebPort+50;}
if($ocswebservername==null){$ocswebservername=$users->hostname;}
$sql="UPDATE config SET IVALUE=1 WHERE NAME='DOWNLOAD'";
$q->QUERY_SQL($sql,"ocsweb");
$sql="UPDATE config SET IVALUE=1 WHERE NAME='REGISTRY'";
$q->QUERY_SQL($sql,"ocsweb");
$sql="UPDATE config SET IVALUE='http://$ocswebservername:$OCSWebPort' WHERE NAME='LOCAL_SERVER'";
$q->QUERY_SQL($sql,"ocsweb");
return;
}
if($dbf_handle = @fopen($db_file, "r")) {
$sql_query = fread($dbf_handle, filesize($db_file));
fclose($dbf_handle);
}
$array_commands=explode(";", "$sql_query");
while (list ($num, $sql) = each ($array_commands) ){
if(trim($sql)==null){continue;}
$q->QUERY_SQL($sql,"ocsweb");
if(!$q->ok){
echo "Starting......: OCS web Engine $q->mysql_error $sql\n";
}
}
}
示例2: initialize
function initialize()
{
$q = new mysql();
if (!$q->DATABASE_EXISTS("drupal")) {
$q->CREATE_DATABASE("drupal");
if (!$q->DATABASE_EXISTS("drupal")) {
echo "Failed to create \"drupal\" database with error {$q->mysql_error}\n";
}
}
}
示例3: MysqlCheck
function MysqlCheck()
{
$db_file = "/usr/share/ocsinventory-reports/ocsreports/files/ocsbase.sql";
if (!is_file($db_file)) {
die;
}
if (CheckTables()) {
die;
}
if ($dbf_handle = @fopen($db_file, "r")) {
$sql_query = fread($dbf_handle, filesize($db_file));
fclose($dbf_handle);
}
$q = new mysql();
if (!$q->DATABASE_EXISTS("ocsweb")) {
$q->CREATE_DATABASE("ocsweb");
}
$array_commands = explode(";", "{$sql_query}");
while (list($num, $sql) = each($array_commands)) {
if (trim($sql) == null) {
continue;
}
$q->QUERY_SQL($sql, "ocsweb");
}
}
示例4: TestDatabase
function TestDatabase()
{
$sql = new mysql();
if (!$sql->DATABASE_EXISTS("zabbix")) {
echo "Starting......: Zabbix server daemon creating database\n";
$sql->CREATE_DATABASE("zabbix");
CreateTables();
}
if (!$sql->DATABASE_EXISTS("zabbix")) {
echo "Starting......: Zabbix server daemon creating database FAILED\n";
die;
}
if (TablesCount() < 73) {
CreateTables();
}
echo "Starting......: Zabbix server daemon database success\n";
UpdateAdmin();
}
示例5: build
function build()
{
echo "Starting......: " . date("H:i:s") . " GreenSQL checking Database....\n";
$q = new mysql();
if (!$q->DATABASE_EXISTS("greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating database greensql\n";
$q->CREATE_DATABASE("greensql");
}
checkGreenTables();
buildconfig();
}
示例6: TestDatabase
function TestDatabase()
{
$sql = new mysql();
if (!$sql->DATABASE_EXISTS("zabbix")) {
echo "Starting......: " . date("H:i:s") . " Zabbix server daemon creating database\n";
$sql->CREATE_DATABASE("zabbix");
CreateTables();
}
if (!$sql->DATABASE_EXISTS("zabbix")) {
echo "Starting......: " . date("H:i:s") . " Zabbix server daemon creating database FAILED\n";
die;
}
$TablesCount = TablesCount();
echo "Starting......: " . date("H:i:s") . " Zabbix server {$TablesCount} tables\n";
if ($TablesCount < 66) {
CreateTables();
}
echo "Starting......: " . date("H:i:s") . " Zabbix server daemon database success\n";
UpdateAdmin();
}
示例7: SaveAdminPassword
function SaveAdminPassword()
{
$password = $this->params["CONF"]["joomlaadminpassword"];
if ($password == null) {
return null;
}
$q = new mysql();
if (!$q->DATABASE_EXISTS($this->sql_db)) {
return null;
}
$sql = "SELECT id FROM jos_users WHERE username=\"admin\"";
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, $this->sql_db));
if (trim($ligne["id"] == null)) {
return null;
}
$newpass = $this->GenPassword($password);
$sql = "UPDATE jos_users SET password='{$newpass}' WHERE id={$ligne["id"]}";
$q->QUERY_SQL($sql, $this->sql_db);
}
示例8: SAVE_FREEWEB_MYSQL
function SAVE_FREEWEB_MYSQL()
{
$servername = trim(strtolower($_POST["servername"]));
if (substr($servername, 0, 1) == '.') {
echo $servername . " FAILED\n";
return;
}
$users = new usersMenus();
$sock = new sockets();
$FreewebsStorageDirectory = $sock->GET_INFO("FreewebsStorageDirectory");
if (!$users->AsWebMaster) {
return "FALSE";
}
$uid = $_POST["uid"];
$mysql_database = format_mysql_table($_POST["mysql_database"]);
$mysql_password = $_POST["mysql_password"];
$mysql_username = $_POST["mysql_username"];
$lvm_vg = $_POST["lvm_vg"];
$vg_size = $_POST["vg_size"];
$ServerIP = $_POST["ServerIP"];
$ServerPort = 0;
if (preg_match("#(.+?):([0-9]+)#", $ServerIP, $re)) {
$ServerIP = $re[1];
$ServerPort = $re[2];
}
if (!is_numeric($vg_size)) {
$vg_size = 5000;
}
$ftpuser = $_POST["ftpuser"];
$ftppassword = $_POST["ftppassword"];
$useSSL = $_POST["useSSL"];
if (!$users->PUREFTP_INSTALLED) {
$_POST["useFTP"] = 0;
$ftpuser = null;
$ftppassword = null;
}
if ($_POST["useFTP"] == 1) {
if ($ftpuser == null) {
$_POST["useFTP"] = 0;
$ftpuser = null;
$ftppassword = null;
}
}
$sql = "SELECT servername FROM freeweb WHERE servername='{$_POST["servername"]}'";
$q = new mysql();
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
if ($ligne["servername"] != null) {
if ($uid != null) {
$u = new user($uid);
$ou = $u->ou;
}
if (!$users->AsSystemAdministrator) {
$ou = $_SESSION["ou"];
}
$sql = "UPDATE freeweb SET \n\t\t\tmysql_password='{$mysql_password}',\n\t\t\tmysql_username='{$mysql_username}',\n\t\t\tmysql_database='{$mysql_database}',\n\t\t\tmysql_instance_id='{$_POST["mysql_instance_id"]}',\n\t\t\tftpuser='{$ftpuser}',\n\t\t\tftppassword='{$ftppassword}',\n\t\t\tuseMysql='{$_POST["useMysql"]}',\n\t\t\tuseFTP='{$_POST["useFTP"]}'\n\t\t\tWHERE servername='{$servername}'\n\t\t";
}
writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
$q = new mysql();
$q->BuildTables();
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
if (preg_match("#Unknown column#i", $q->mysql_error)) {
$q->BuildTables();
$q->QUERY_SQL($sql, "artica_backup");
}
}
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock = new sockets();
if ($_POST["useFTP"] == 1) {
if ($users->PUREFTP_INSTALLED) {
if (trim($ftpuser) != null) {
if (trim($ftppassword) != null) {
$pure = new pureftpd_user();
if (!$pure->CreateUser($ftpuser, $ftppassword, $servername)) {
echo "FTP: Failed\n";
return;
}
$sock->getFrameWork("services.php?reload-pure-ftpd=yes");
}
}
}
}
if ($_POST["useMysql"] == 1) {
if (!$q->DATABASE_EXISTS($mysql_database)) {
$q->CREATE_DATABASE("{$mysql_database}");
}
if (!$q->PRIVILEGES($mysql_username, $mysql_password, $mysql_database)) {
echo "GRANT {$mysql_database} FAILED FOR {$mysql_username}\n{$q->mysql_error}";
}
}
if (isset($_POST["ADD_DNS_ENTRY"])) {
$dnsDOM = explode(".", $_POST["servername"]);
$netbiosname = $dnsDOM[0];
unset($dnsDOM[0]);
$domainname = implode(".", $dnsDOM);
include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
$pdns = new pdns($domainname);
//.........这里部分代码省略.........
示例9: backup_mysql_powerdns
function backup_mysql_powerdns($BaseWorkDir)
{
$unix = new unix();
$sock = new sockets();
$password = null;
$mysqldump = $unix->find_program("mysqldump");
$gzip = $unix->find_program("gzip");
if (!is_file($gzip)) {
system_admin_events("Error, gzip, no such binary", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if (!is_file($mysqldump)) {
system_admin_events("Error, mysqldump, no such binary", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if (!$unix->is_socket("/var/run/mysqld/mysqld.sock")) {
system_admin_events("Error,/var/run/mysqld/mysqld.sock no such socket", __FUNCTION__, __FILE__, __LINE__);
return false;
}
$q = new mysql();
if (!$q->DATABASE_EXISTS("powerdns")) {
backupevents("Database PowerDNS doesn't exists...");
return true;
}
$nice = $unix->EXEC_NICE();
$LIST_TABLES_POWERDNS = $q->LIST_TABLES_POWERDNS();
backupevents(count($LIST_TABLES_POWERDNS) . " tables to backup...");
if ($q->mysql_password != null) {
$password = " -p" . $unix->shellEscapeChars($q->mysql_password);
}
$prefix = trim("{$nice} {$mysqldump} --add-drop-table --single-transaction --force --insert-ignore -S /var/run/mysqld/mysqld.sock -u {$q->mysql_admin}{$password} powerdns");
@mkdir("{$BaseWorkDir}/powerdns", 0755, true);
$c = 0;
while (list($table_name, $val) = each($LIST_TABLES_POWERDNS)) {
$cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/powerdns/{$table_name}.gz";
backupevents("{$cmd}");
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
shell_exec($cmd);
$c++;
}
system_admin_events("PowerDNS Databases {$c} tables done\n", __FUNCTION__, __FILE__, __LINE__);
}
示例10: OBM2_INSTALL
function OBM2_INSTALL($servername, $root, $hash = array())
{
$GLOBALS["ADDLOG"] = "{$GLOBALS["ARTICALOGDIR"]}/{$servername}.log";
if ($root == null) {
events("Starting install OBM2 Unable to stat root dir");
return false;
}
if (!is_dir("/opt/artica/install/sources/obm")) {
events("Starting install OBM2 Unable to stat /opt/artica/install/sources/obm");
return false;
}
$sqlfiles = array("create_obmdb_2.3.mysql.sql", "obmdb_prefs_values_2.3.sql", "obmdb_default_values_2.3.sql", "obmdb_test_values_2.3.sql", "data-fr/obmdb_nafcode_2.3.sql", "data-fr/obmdb_ref_2.3.sql", "data-en/obmdb_nafcode_2.3.sql", "data-en/obmdb_ref_2.3.sql");
$user = $hash["wwwmysqluser"][0];
$mysql_password = $hash[strtolower("WWWMysqlPassword")][0];
$appli_user = $hash["wwwappliuser"];
$appli_password = $hash["wwwapplipassword"];
if ($user == null) {
events("Starting install OBM2 Unable to stat Mysql username");
return false;
}
if ($mysql_password == null) {
events("Starting install OBM2 Unable to stat Mysql password");
return false;
}
@mkdir($root, 0755, true);
$server_database = str_replace(".", "_", $servername);
$server_database = str_replace("-", "_", $server_database);
$q = new mysql();
if (!$q->DATABASE_EXISTS($server_database)) {
events("Starting install OBM2 sub-system mysql database {$server_database}...");
$q->CREATE_DATABASE($server_database);
if (!$q->DATABASE_EXISTS($server_database)) {
events("Starting install OBM2 unable to create MYSQL Database");
return false;
}
}
events("Starting install OBM2 installing source code in {$root}");
shell_exec("/bin/cp -rf /opt/artica/install/sources/obm/* {$root}/");
if ($q->mysql_password != null) {
$password = " --password={$q->mysql_password} ";
} else {
events("Starting install OBM2 installing tables datas with null password");
}
$unix = new unix();
//<$sql_file
$cmd = $unix->find_program("mysql") . " --port={$q->mysql_port} --skip-column-names --database={$server_database} --silent --xml ";
$cmd = $cmd . " --user={$q->mysql_admin}{$password}";
if (!OBM2_CheckObmTables($server_database)) {
while (list($num, $filesql) = each($sqlfiles)) {
if (is_file("/opt/artica/install/sources/obm/scripts/2.3/{$filesql}")) {
events("installing {$filesql} SQL commands");
shell_exec($cmd . " </opt/artica/install/sources/obm/scripts/2.3/{$filesql}");
}
}
}
$version = OBM2_VERSION($root);
if ($version == null) {
events("Starting install unable to stat version");
return false;
}
events("Starting install OBM2 version {$version}");
if (is_file("{$root}/scripts/2.3/updates/update-2.3.1-{$version}.mysql.sql")) {
events("Starting updating OBM2 version 2.3.1-{$version}");
shell_exec($cmd . " <{$root}/scripts/2.3/updates/update-2.3.1-{$version}.mysql.sql");
} else {
events("Starting updating unable to stat {$root}/scripts/2.3/updates/update-2.3.1-{$version}.mysql.sql");
}
//scripts/2.3/updates/update-2.3.1-2.3.2.mysql.sql
$q->PRIVILEGES($user, $mysql_password, $server_database);
OBM2_INSTALL_SCRIPTS($root, $servername, $server_database, $user, $mysql_password);
}
示例11: testsDatabase
function testsDatabase()
{
$f[] = "access_control";
$f[] = "amavis_rules";
$f[] = "checkhelo";
$f[] = "checkhelo_blacklist";
$f[] = "checkhelo_tracking";
$f[] = "checkhelo_whitelist";
$f[] = "checkspf";
$f[] = "greylisting";
$f[] = "greylisting_autoblacklist";
$f[] = "greylisting_autowhitelist";
$f[] = "greylisting_tracking";
$f[] = "greylisting_whitelist";
$f[] = "policies";
$f[] = "policy_group_members";
$f[] = "policy_groups";
$f[] = "policy_members";
$f[] = "quotas";
$f[] = "quotas_limits";
$f[] = "quotas_tracking";
$f[] = "session_tracking";
$rebuild = false;
$q = new mysql();
$unix = new unix();
$dbfile = "/usr/share/artica-postfix/bin/install/cluebringer/policyd.mysql";
if (!$q->DATABASE_EXISTS("policyd")) {
$q->CREATE_DATABASE("policyd");
$rebuild = true;
}
if (!$rebuild) {
while (list($num, $val) = each($f)) {
if ($q->TABLE_EXISTS($val, "policyd")) {
echo "Starting......: cluebringer mysql table {$val} OK\n";
} else {
echo "Starting......: cluebringer mysql table {$val} FAILED\n";
$rebuild = true;
break;
}
}
}
if ($rebuild) {
$mysqlbin = $unix->find_program("mysql");
if (!is_file("{$mysqlbin}")) {
echo "Starting......: cluebringer mysql binary no such file\n";
return;
}
$cmd = "{$mysqlbin} --batch --host={$q->mysql_server} --port={$q->mysql_port} --user={$q->mysql_admin} --password={$q->mysql_password} --database=policyd";
$cmd = $cmd . " <{$dbfile}";
if ($GLOBALS["VERBOSE"]) {
echo $cmd . "\n";
}
shell_exec($cmd);
}
}
示例12: execute_database_exists
function execute_database_exists($database)
{
$q = new mysql();
if (!$q->DATABASE_EXISTS($database)) {
echo "FALSE\n";
die;
}
echo "TRUE\n";
}
示例13: xstart
//.........这里部分代码省略.........
}
while (list($num, $table) = each($_not_cached)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($members)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($family)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($proto)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($_cacheperfs)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($UserSizeD)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($blocked_days)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($squidmemory)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($squidmemoryM)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($blocked_week)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($hours1)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($hours2)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($hours3)) {
$squidlogs[$num] = true;
}
while (list($num, $table) = each($visited)) {
$squidlogs[$num] = true;
}
$q = new mysql_squid_builder();
while (list($tablename, $none) = each($squidlogs)) {
if (!$q->TABLE_EXISTS($tablename)) {
continue;
}
if ($q->COUNT_ROWS($table) == 0) {
$q->QUERY_SQL("DROP TABLE `{$tablename}`");
continue;
}
build_progress("Backup table/remove {$tablename}", 25);
echo "Backup {$tablename}\n";
if (!backup_squidlogs($tablename)) {
continue;
}
$q->QUERY_SQL("DROP TABLE `{$tablename}`");
}
while (list($filename, $none) = each($toDelete)) {
if (is_file("/share/artica-postfix/{$filename}")) {
build_progress("Removing {$filename}", 50);
@unlink("/usr/share/artica-postfix/{$filename}");
}
}
$q = new mysql();
while (list($tablename, $none) = each($artica_events_delete)) {
if (!$q->TABLE_EXISTS($tablename, "artica_events")) {
continue;
}
build_progress("Backup table {$tablename}", 60);
if ($q->COUNT_ROWS($table, "artica_events") == 0) {
$q->QUERY_SQL("DROP TABLE `{$tablename}`", "artica_events");
continue;
}
$q->QUERY_SQL("DROP TABLE `{$tablename}`", "artica_events");
}
$users = new usersMenus();
if ($users->POSTFIX_INSTALLED) {
$q = new mysql();
if ($q->DATABASE_EXISTS("postfixlog")) {
$q->DELETE_DATABASE("postfixlog");
}
if ($q->DATABASE_EXISTS("syslogstore")) {
$q->DELETE_DATABASE("syslogstore");
}
}
build_progress("{reconfigure_proxy_service}", 70);
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
build_progress("{restarting} BigData Database", 80);
system("/etc/init.d/influx-db restart --force");
build_progress("{restarting} Watchdog", 90);
system("/etc/init.d/artica-status restart --force");
build_progress("{restarting} Watchdog", 95);
system("/etc/init.d/squid-tail restart");
build_progress("{restarting} Watchdog", 98);
system("/etc/init.d/cache-tail restart");
@file_put_contents("/etc/artica-postfix/settings/Daemons/UpgradeTov10", 1);
build_progress("{done}", 100);
}
示例14: loadavg_logs
function loadavg_logs()
{
include_once dirname(__FILE__) . '/ressources/class.mysql.inc';
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
echo "Already running pid {$pid}\n";
return;
}
$q = new mysql();
if (!$q->DATABASE_EXISTS("artica_events")) {
if ($GLOBALS["VERBOSE"]) {
echo "Stop !\n";
}
events_Loadavg("loadavg_logs:: artica_events database does not exists... try to build one" . __LINE__);
$q->BuildTables();
}
if (!$q->DATABASE_EXISTS("artica_events")) {
if ($GLOBALS["VERBOSE"]) {
echo "Stop !\n";
}
events_Loadavg("loadavg_logs:: artica_events database cannot continue" . __LINE__);
return;
}
if ($GLOBALS["VERBOSE"]) {
echo "Scan {$GLOBALS["ARTICALOGDIR"]}/loadavg/*\n";
}
$COUNT = $unix->COUNT_FILES("{$GLOBALS["ARTICALOGDIR"]}/loadavg");
if ($COUNT > 5000) {
if (!($handle = opendir("{$GLOBALS["ARTICALOGDIR"]}/loadavg"))) {
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$filename = "{$GLOBALS["ARTICALOGDIR"]}/loadavg/{$filename}";
@unlink($filename);
}
return;
}
if (!($handle = opendir("{$GLOBALS["ARTICALOGDIR"]}/loadavg"))) {
@mkdir("{$GLOBALS["ARTICALOGDIR"]}/loadavg", 0755, true);
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$filename = "{$GLOBALS["ARTICALOGDIR"]}/loadavg/{$filename}";
if ($unix->file_time_min($filename) > 240) {
@unlink($filename);
continue;
}
$time = basename($filename);
$load = @file_get_contents($filename);
$date = date('Y-m-d H:i:s', $time);
$sql = "INSERT IGNORE INTO loadavg (`stime`,`load`) VALUES ('{$date}','{$load}');";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
events_Loadavg("loadavg_logs:: {$q->mysql_error} line:" . __LINE__);
continue;
}
events_Loadavg("loadavg_logs:: success {$filename}" . __LINE__);
@unlink($filename);
}
}
示例15: checkdb
function checkdb()
{
$createtable = false;
$q = new mysql();
if (!$q->DATABASE_EXISTS("greyhole")) {
$createtable = true;
echo "Starting......: " . date("H:i:s") . " greyhole creating mysql database \"greyhole\"\n";
$q->CREATE_DATABASE("greyhole");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " greyhole {$q->mysql_error}\n";
return false;
}
}
if (!$q->TABLE_EXISTS("settings", "greyhole")) {
echo "Starting......: " . date("H:i:s") . " greyhole create table \"settings\"\n";
$sql = "CREATE TABLE `settings` (\n\t\t`name` TINYTEXT NOT NULL,\n\t\t`value` TEXT NOT NULL,\n\t\tPRIMARY KEY ( `name`(255) )\n\t\t) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "greyhole");
$sql = "INSERT INTO `settings` (`name`, `value`) VALUES ('last_read_log_smbd_line', '0');";
$q->QUERY_SQL($sql, "greyhole");
$sql = "INSERT INTO `settings` (`name`, `value`) VALUES ('last_OOS_notification', '0');";
$q->QUERY_SQL($sql, "greyhole");
}
if (!$q->TABLE_EXISTS("tasks", "greyhole")) {
echo "Starting......: " . date("H:i:s") . " greyhole create table \"tasks\"\n";
$sql = "CREATE TABLE `tasks` (\n\t\t`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t`action` VARCHAR( 10 ) NOT NULL,\n\t\t`share` TINYTEXT NOT NULL,\n\t\t`full_path` TINYTEXT NULL,\n\t\t`additional_info` TINYTEXT NULL,\n\t\t`complete` ENUM( 'yes', 'no', 'frozen', 'thawed', 'idle') NOT NULL,\n\t\t`event_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n\t\t) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "greyhole");
$sql = "ALTER TABLE `tasks` ADD INDEX `find_next_task` ( `complete` , `share` (64) , `id` );";
$q->QUERY_SQL($sql, "greyhole");
}
if (!$q->TABLE_EXISTS("tasks_completed", "greyhole")) {
echo "Starting......: " . date("H:i:s") . " greyhole create table \"tasks_completed\"\n";
$sql = "CREATE TABLE `tasks_completed` (\n\t\t`id` BIGINT UNSIGNED NOT NULL,\n\t\t`action` VARCHAR( 10 ) NOT NULL,\n\t\t`share` TINYTEXT NOT NULL,\n\t\t`full_path` TINYTEXT NULL,\n\t\t`additional_info` TINYTEXT NULL,\n\t\t`complete` ENUM( 'yes', 'no' ) NOT NULL,\n\t\t`event_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n\t\t) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "greyhole");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " greyhole {$q->mysql_error}\n";
}
}
echo "Starting......: " . date("H:i:s") . " greyhole checking database and table done\n";
return true;
}