本文整理汇总了PHP中mysql::test_mysql_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::test_mysql_connection方法的具体用法?PHP mysql::test_mysql_connection怎么用?PHP mysql::test_mysql_connection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::test_mysql_connection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StartBubble
function StartBubble()
{
$q = new mysql();
if (!$q->test_mysql_connection()) {
echo "Starting......: " . date("H:i:s") . " Postfix Bubble Mysql is not ready aborting...\n";
return;
}
$ip = new iptables_exec();
$ip->buildrules();
}
示例2: BuildPatterns
}
if ($argv[1] == "--patterns") {
BuildPatterns();
echo "\n";
die;
}
if ($argv[1] == "--clean-db") {
CleanDB();
echo "\n";
die;
}
//exec.dansguardian.compile.php --patterns
echo "\n";
echo "Starting......: Dansguardian reconfigure settings\n";
$q = new mysql();
if (!$q->test_mysql_connection()) {
echo "Starting......: Dansguardian Mysql error\n";
die;
}
$q->CheckTable_dansguardian();
LoadGlobal_exceptionsitelist();
$dans = new dansguardian();
$dans->SaveSettings();
$cmd = LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.web-community-filter.php --patterns{$GLOBALS["cmdlineadd"]}";
events("MAIN:: {$cmd}");
system($cmd);
HtmlTemplate();
BuildPersonalCategories();
bannedsitelist_userdefined();
weightedphraselist_userdefined();
BuildRules();
示例3: metaevents_client_scan
function metaevents_client_scan($uuid)
{
$unix = new unix();
$sock = new sockets();
$q = new mysql();
if (!$q->test_mysql_connection()) {
return;
}
$ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage");
if ($ArticaMetaStorage == null) {
$ArticaMetaStorage = "/home/artica-meta";
}
$destdir = "{$ArticaMetaStorage}/{$uuid}/META_EVENTS";
$files = $unix->DirFiles($destdir);
if (!$q->FIELD_EXISTS("meta_admin_mysql", "zmd5", "artica_events")) {
meta_events("Patching meta_admin_mysql");
$meta = new mysql_meta();
$q->QUERY_SQL("DROP TABLE `meta_admin_mysql`", "artica_events");
$meta->create_table_meta_admin_mysql();
}
while (list($filename, $ARRAY) = each($files)) {
$sourcefile = "{$destdir}/{$filename}";
$destfile = "{$destdir}/{$filename}.sql";
meta_events("{$uuid}: Uncompress {$sourcefile}...");
$unix->uncompress($sourcefile, $destfile);
if (!is_file($destfile)) {
continue;
}
$q->QUERY_SQL(@file_get_contents($destfile), "artica_events");
if (!$q->ok) {
meta_events("{$uuid}:{$q->mysql_error}");
@unlink($destfile);
continue;
}
@unlink($sourcefile);
@unlink($destfile);
}
}
示例4: vsftpd_admin_mysql_check
function vsftpd_admin_mysql_check($nopid = false)
{
$f = array();
$unix = new unix();
if ($nopid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
writelogs("Already running pid {$pid}", __FUNCTION__, __FILE__, __LINE__);
return;
}
$t = 0;
}
$sock = new sockets();
$users = new usersMenus();
$hostname = $unix->hostname_g();
$BaseWorkDir = "{$GLOBALS["ARTICALOGDIR"]}/vsftpd_admin_mysql";
if (!is_dir($BaseWorkDir)) {
return;
}
if (!($handle = opendir($BaseWorkDir))) {
echo "Failed open {$BaseWorkDir}\n";
return;
}
$hostname = $unix->hostname_g();
$q = new mysql();
if (!$q->test_mysql_connection()) {
return;
}
$sql = "CREATE TABLE IF NOT EXISTS `artica_events`.`vsftpd_admin_mysql` (\n\t\t`ID` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`zDate` TIMESTAMP NOT NULL ,\n\t\t`content` MEDIUMTEXT NOT NULL ,\n\t\t`hostname` VARCHAR( 255 ),\n\t\t`subject` VARCHAR( 255 ) NOT NULL ,\n\t\t`function` VARCHAR( 60 ) NOT NULL ,\n\t\t`filename` VARCHAR( 50 ) NOT NULL ,\n\t\t`line` INT( 10 ) NOT NULL ,\n\t\t`severity` smallint( 1 ) NOT NULL ,\n\t\t`TASKID` BIGINT UNSIGNED ,\n\t\tPRIMARY KEY (`ID`),\n\t\t KEY `zDate` (`zDate`),\n\t\t KEY `subject` (`subject`),\n\t\t KEY `hostname` (`hostname`),\n\t\t KEY `function` (`function`),\n\t\t KEY `filename` (`filename`),\n\t\t KEY `severity` (`severity`)\n\t\t) ENGINE=MYISAM;";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo $q->mysql_error . "\n";
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$BaseWorkDir}/{$filename}";
if ($unix->file_time_min($targetFile) > 240) {
@unlink($targetFile);
continue;
}
$array = unserialize(@file_get_contents($targetFile));
if (!is_array($array)) {
@unlink($targetFile);
continue;
}
if (!is_numeric($array["TASKID"])) {
$array["TASKID"] = 0;
}
$content = mysql_escape_string2($array["text"]);
$subject = mysql_escape_string2($array["subject"]);
$zdate = $array["zdate"];
$function = $array["function"];
$file = $array["file"];
$line = $array["line"];
$TASKID = $array["TASKID"];
$severity = $array["severity"];
$q->QUERY_SQL("INSERT IGNORE INTO `vsftpd_admin_mysql`\n\t\t\t\t(`zDate`,`content`,`subject`,`function`,`filename`,`line`,`severity`,`hostname`) VALUES\n\t\t\t\t('{$zdate}','{$content}','{$subject}','{$function}','{$file}','{$line}','{$severity}','{$hostname}')", "artica_events");
if (!$q->ok) {
return;
}
@unlink($targetFile);
}
}
示例5: mysql_status
function mysql_status()
{
$q = new mysql();
if (!$q->test_mysql_connection()) {
echo " ********* FAILED **************\n";
echo $q->mysql_error . "\n";
echo "\n\nType Enter key to exit.\n";
$answer = trim(strtolower(fgets(STDIN)));
menu();
}
echo "Connecting to MySQL server success\n";
echo "MySQL Paramaters:\n*******************************\n";
echo "MySQL username..: {$q->mysql_admin}\n";
echo "MySQL Password..: {$q->mysql_password}\n";
echo "MySQL server....: {$q->mysql_server}\n";
echo "MySQL Port......: {$q->mysql_port}\n";
echo "MySQL SocketName: {$q->SocketName}\n";
echo "\n\nType Enter key to continue.\n";
$answer = trim(strtolower(fgets(STDIN)));
$GLOBALS["VERBOSE"] = true;
$q->BuildTables();
$GLOBALS["VERBOSE"] = false;
echo "\n\nType Enter key to exit.\n";
$answer = trim(strtolower(fgets(STDIN)));
menu();
}