当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql::CREATE_DATABASE方法代码示例

本文整理汇总了PHP中mysql::CREATE_DATABASE方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::CREATE_DATABASE方法的具体用法?PHP mysql::CREATE_DATABASE怎么用?PHP mysql::CREATE_DATABASE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql的用法示例。


在下文中一共展示了mysql::CREATE_DATABASE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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");
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:25,代码来源:exec.ocsweb.install.php

示例2: 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";	
	}
}

}
开发者ID:rsd,项目名称:artica-1.5,代码行数:59,代码来源:exec.ocsweb.php

示例3: 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";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:10,代码来源:exec.drupal.php

示例4: 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();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:11,代码来源:exec.greensql.php

示例5: 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();
}
开发者ID:brucewu16899,项目名称:artica,代码行数:18,代码来源:exec.zabbix.php

示例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();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:20,代码来源:exec.zabbix.php

示例7: buildMysql

function buildMysql()
{
    $q = new mysql();
    if (!$q->DATABASE_EXISTS("pommo")) {
        $q->CREATE_DATABASE("pommo");
    }
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_config` (\n  `config_name` varchar(64) NOT NULL default '',\n  `config_value` text NOT NULL,\n  `config_description` tinytext NOT NULL,\n  `autoload` enum('on','off') NOT NULL default 'on',\n  `user_change` enum('on','off') NOT NULL default 'on',\n  PRIMARY KEY  (`config_name`)\n) ENGINE=MyISAM;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "INSERT INTO `pommo_config` (`config_name`, `config_value`, `config_description`, `autoload`, `user_change`) VALUES\n('admin_username', 'admin', 'Username', 'off', 'on'),\n('admin_password', '9dd3ba637ec2fcaf383415617d39e002', 'Password', 'off', 'on'),\n('admin_email', 'root@localhost.localdomain', 'Administrator Email', 'on', 'on'),\n('site_name', 'Artica For poMMo', 'Website Name', 'on', 'on'),\n('site_url', 'http://www.pommo-rocks.com', 'Website URL', 'on', 'on'),\n('site_success', '', 'Signup Success URL', 'off', 'on'),\n('site_confirm', '', '', 'off', 'on'),\n('list_name', 'Artica Mailing List', 'List Name', 'on', 'on'),\n('list_fromname', 'poMMo Administrative Team', 'From Name', 'off', 'on'),\n('list_fromemail', 'pommo@yourdomain.com', 'From Email', 'off', 'on'),\n('list_frombounce', 'bounces@yourdomain.com', 'Bounces', 'off', 'on'),\n('list_exchanger', 'sendmail', 'List Exchanger', 'off', 'on'),\n('list_confirm', 'on', 'Confirmation Messages', 'off', 'on'),\n('list_charset', 'ISO-8859-1', '', 'off', 'on'),\n('list_wysiwyg', 'on', '', 'off', 'off'),\n('maxRuntime', '80', '', 'off', 'on'),\n('messages', 'a:6:{s:9:\"subscribe\";a:4:{s:3:\"msg\";s:152:\"Welcome to our mailing list. You can always login to update your records or unsubscribe by visiting: \n  https://192.168.1.12:9000/mailing/user/login.php\";s:3:\"sub\";s:30:\"Welcome to Artica Mailing List\";s:3:\"web\";s:45:\"Welcome to our mailing list. Enjoy your stay.\";s:5:\"email\";b:0;}s:11:\"unsubscribe\";a:4:{s:3:\"sub\";s:33:\"Farewell from Artica Mailing List\";s:3:\"msg\";s:106:\"You have been unsubscribed and will not receive any more mailings from us. Feel free to come back anytime!\";s:3:\"web\";s:55:\"You have successfully unsubscribed. Enjoy your travels.\";s:5:\"email\";b:0;}s:7:\"confirm\";a:2:{s:3:\"msg\";s:253:\"You have requested to subscribe to Artica Mailing List. We would like to validate your email address before adding you as a subscriber. Please click the link below to be added ->\r\n\t[[url]]\r\n\r\nIf you have received this message in error, please ignore it.\";s:3:\"sub\";s:20:\"Subscription request\";}s:8:\"activate\";a:2:{s:3:\"msg\";s:222:\"Someone has requested to access to your records for Artica Mailing List. You may edit your information or unsubscribe by visiting the link below ->\r\n\t[[url]]\r\n\r\nIf you have received this message in error, please ignore it.\";s:3:\"sub\";s:36:\"Artica Mailing List: Account Access.\";}s:8:\"password\";a:2:{s:3:\"msg\";s:201:\"You have requested to change your password for Artica Mailing List. Please validate this request by clicking the link below ->\r\n\t[[url]]\r\n\r\nIf you have received this message in error, please ignore it.\";s:3:\"sub\";s:23:\"Change Password request\";}s:6:\"update\";a:2:{s:3:\"msg\";s:198:\"You have requested to update your records for Artica Mailing List. Please validate this request by clicking the link below ->\n\n\t[[url]]\n\nIf you have received this message in error, please ignore it.\";s:3:\"sub\";s:22:\"Update Records request\";}}', '', 'off', 'off'),\n('notices', '', '', 'off', 'off'),\n('demo_mode', 'off', 'Demonstration Mode', 'on', 'on'),\n('smtp_1', 'a:5:{s:4:\"host\";s:9:\"127.0.0.1\";s:4:\"port\";s:4:\"2525\";s:4:\"auth\";s:3:\"off\";s:4:\"user\";s:0:\"\";s:4:\"pass\";s:0:\"\";}', '', 'off', 'off'),\n('smtp_2', '', '', 'off', 'off'),\n('smtp_3', '', '', 'off', 'off'),\n('smtp_4', '', '', 'off', 'off'),\n('throttle_DBPP', '0', '', 'off', 'on'),\n('throttle_DP', '10', '', 'off', 'on'),\n('throttle_DMPP', '0', '', 'off', 'on'),\n('throttle_BPS', '0', '', 'off', 'on'),\n('throttle_MPS', '3', '', 'off', 'on'),\n('throttle_SMTP', 'individual', '', 'off', 'on'),\n('public_history', 'on', 'Public Mailing History', 'off', 'on'),\n('version', 'Aardvark PR16.1', 'poMMo Version', 'on', 'off'),\n('key', '1e0b60', 'Unique Identifier', 'on', 'off'),\n('revision', '42', 'Internal Revision', 'on', 'off');\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_fields` (\n  `field_id` smallint(5) unsigned NOT NULL auto_increment,\n  `field_active` enum('on','off') NOT NULL default 'off',\n  `field_ordering` smallint(5) unsigned NOT NULL default '0',\n  `field_name` varchar(60) default NULL,\n  `field_prompt` varchar(60) default NULL,\n  `field_normally` varchar(60) default NULL,\n  `field_array` text,\n  `field_required` enum('on','off') NOT NULL default 'off',\n  `field_type` enum('checkbox','multiple','text','date','number','comment') default NULL,\n  PRIMARY KEY  (`field_id`),\n  KEY `active` (`field_active`,`field_ordering`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_groups` (\n  `group_id` smallint(5) unsigned NOT NULL auto_increment,\n  `group_name` tinytext NOT NULL,\n  PRIMARY KEY  (`group_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_group_rules` (\n  `rule_id` int(10) unsigned NOT NULL auto_increment,\n  `group_id` int(10) unsigned NOT NULL default '0',\n  `field_id` tinyint(3) unsigned NOT NULL default '0',\n  `type` tinyint(1) NOT NULL default '0' COMMENT '0: OFF, (and), 1: ON (or)',\n  `logic` enum('is','not','greater','less','true','false','is_in','not_in') NOT NULL,\n  `value` text,\n  PRIMARY KEY  (`rule_id`),\n  KEY `group_id` (`group_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_mailings` (\n  `mailing_id` int(10) unsigned NOT NULL auto_increment,\n  `fromname` varchar(60) NOT NULL default '',\n  `fromemail` varchar(60) NOT NULL default '',\n  `frombounce` varchar(60) NOT NULL default '',\n  `subject` varchar(60) NOT NULL default '',\n  `body` mediumtext NOT NULL,\n  `altbody` mediumtext,\n  `ishtml` enum('on','off') NOT NULL default 'off',\n  `mailgroup` varchar(60) NOT NULL default 'Unknown',\n  `subscriberCount` int(10) unsigned NOT NULL default '0',\n  `started` datetime NOT NULL,\n  `finished` datetime default NULL,\n  `sent` int(10) unsigned NOT NULL default '0',\n  `charset` varchar(15) NOT NULL default 'UTF-8',\n  `status` tinyint(1) NOT NULL default '1' COMMENT '0: finished, 1: processing, 2: cancelled',\n  PRIMARY KEY  (`mailing_id`),\n  KEY `status` (`status`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_mailing_current` (\n  `current_id` int(10) unsigned NOT NULL,\n  `command` enum('none','restart','stop','cancel') NOT NULL default 'none',\n  `serial` int(10) unsigned default NULL,\n  `securityCode` char(32) default NULL,\n  `notices` longtext,\n  `current_status` enum('started','stopped') NOT NULL default 'stopped',\n  `touched` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n  PRIMARY KEY  (`current_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_mailing_notices` (\n  `mailing_id` int(10) unsigned NOT NULL,\n  `notice` varchar(255) NOT NULL,\n  `touched` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n  `id` smallint(5) unsigned NOT NULL,\n  KEY `mailing_id` (`mailing_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_queue` (\n  `subscriber_id` int(10) unsigned NOT NULL,\n  `status` tinyint(1) NOT NULL default '0' COMMENT '0: unsent, 1: sent, 2: failed',\n  `smtp` tinyint(1) NOT NULL default '0' COMMENT '0: none, 1-4: Designated to SMTP relay #',\n  PRIMARY KEY  (`subscriber_id`),\n  KEY `status` (`status`,`smtp`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_scratch` (\n  `scratch_id` int(10) unsigned NOT NULL auto_increment,\n  `time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n  `type` smallint(5) unsigned NOT NULL default '0' COMMENT 'Used to identify row type. 0 = undifined, 1 = ',\n  `int` bigint(20) default NULL,\n  `str` text,\n  PRIMARY KEY  (`scratch_id`),\n  KEY `type` (`type`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='General Purpose Table for caches, counts, etc.' AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_subscribers` (\n  `subscriber_id` int(10) unsigned NOT NULL auto_increment,\n  `email` char(60) NOT NULL default '',\n  `time_touched` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n  `time_registered` datetime NOT NULL,\n  `flag` tinyint(1) NOT NULL default '0' COMMENT '0: NULL, 1-8: REMOVE, 9: UPDATE',\n  `ip` int(10) unsigned default NULL COMMENT 'Stored with INET_ATON(), Fetched with INET_NTOA()',\n  `status` tinyint(1) NOT NULL default '2' COMMENT '0: Inactive, 1: Active, 2: Pending',\n  PRIMARY KEY  (`subscriber_id`),\n  KEY `status` (`status`,`subscriber_id`),\n  KEY `status_2` (`status`,`email`),\n  KEY `status_3` (`status`,`time_touched`),\n  KEY `status_4` (`status`,`time_registered`),\n  KEY `status_5` (`status`,`ip`),\n  KEY `flag` (`flag`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_subscriber_data` (\n  `data_id` bigint(20) unsigned NOT NULL auto_increment,\n  `field_id` int(10) unsigned NOT NULL default '0',\n  `subscriber_id` int(10) unsigned NOT NULL default '0',\n  `value` char(60) NOT NULL default '',\n  PRIMARY KEY  (`data_id`),\n  KEY `subscriber_id` (`subscriber_id`,`field_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_subscriber_pending` (\n  `pending_id` int(10) unsigned NOT NULL auto_increment,\n  `subscriber_id` int(10) unsigned NOT NULL default '0',\n  `pending_code` char(32) NOT NULL,\n  `pending_type` enum('add','del','change','password') default NULL,\n  `pending_array` text,\n  PRIMARY KEY  (`pending_id`),\n  KEY `code` (`pending_code`),\n  KEY `subscriber_id` (`subscriber_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_templates` (\n  `template_id` smallint(5) unsigned NOT NULL auto_increment,\n  `name` varchar(60) NOT NULL default 'name',\n  `description` varchar(255) default NULL,\n  `body` mediumtext,\n  `altbody` mediumtext,\n  PRIMARY KEY  (`template_id`)\n) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;\n";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "INSERT INTO `pommo_templates` (`template_id`, `name`, `description`, `body`, `altbody`) VALUES\n(1, 'CSS Example', 'poMMo default, featuring a plain CSS based HTML design. Includes a weblink (to view online) in the header, and a unsubscribe link in the footer.', '<style type=\"text/css\" media=\"all\">\r\n\r\n/* base styling */\r\n\r\ndiv.pommoMailing {\r\n\r\n  background-color: white; /* background color */\r\n  color: #333; /* text color */\r\n  width: 100%;\r\n  padding: 6px;\r\n\r\n}\r\n\r\ndiv.pommoMailing a, div.pommoMailing a:visited {\r\n\r\n  text-decoration: none;\r\n  color: #0067ff; /* link & visited link color */\r\n\r\n}\r\n\r\n/* header styling */\r\n\r\ndiv.pommoMailing div.pommoHeader {\r\n  \r\n  border: 1px solid black;\r\n  padding: 6px;\r\n  background-color: #DDF0BD; /* light green */\r\n  color: green;\r\n  width: 100%;\r\n  text-align: center;\r\n}\r\n\r\n/* footer styling */\r\n\r\ndiv.pommoMailing div.pommoFooter {\r\n  width: 100%;\r\n  padding: 5px 12px;\r\n  background-color: black;\r\n  color: #DDD;\r\n}\r\n\r\ndiv.pommoMailing p.smaller {\r\n  font-size: 80%;\r\n}\r\n\r\n\r\n</style>\r\n\r\n<div class=\"pommoMailing\">\r\n\r\n  <div class=\"pommoHeader\">\r\n    If you are having trouble viewing this email, <a href=\"[[!weblink]]\">click here</a>.\r\n  </div>\r\n\r\n  <h2>Bonjour!</h2>\r\n  <br />\r\n \r\n  <p>\r\n  Aliquam tempor erat eu sapien. Proin nisl lorem, hendrerit ut, venenatis vel, consequat in, est. In hac habitasse platea dictumst. Praesent malesuada tristique massa. Donec nec dui. Nulla at ligula quis diam auctor vulputate. Sed ligula ligula, elementum ac, tincidunt nec, accumsan non, risus. Aliquam convallis blandit tortor. In porta nisi interdum ante. Maecenas sem. Maecenas at felis ac massa dictum malesuada. Maecenas quis lectus. In hac habitasse platea dictumst. Ut sit amet nunc. Donec non lacus. Nulla facilisi. Vestibulum molestie. Aenean at enim sit amet augue auctor bibendum. Duis in ipsum.\r\n  </p>\r\n\r\n  <div class=\"pommoFooter\">\r\n  To unsubscribe or update your records, <a href=\"[[!unsubscribe]]\">Click here</a>.\r\n  </div>\r\n\r\n  <p class=\"smaller\">\r\n    Message sent with <a href=\"http://www.pommo.org/\">poMMo</a>.\r\n  </p>\r\n\r\n</div>', NULL);";
    $q->QUERY_SQL($sql, "pommo");
    $sql = "CREATE TABLE IF NOT EXISTS `pommo_updates` (\n  `serial` int(10) unsigned NOT NULL,\n  PRIMARY KEY  (`serial`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;\n";
    $sql = "INSERT INTO `pommo_updates` (`serial`) VALUES (24);";
    $q->QUERY_SQL($sql, "pommo");
}
开发者ID:brucewu16899,项目名称:artica,代码行数:40,代码来源:exec.pommo.php

示例8: repairocsweb

function repairocsweb()
{
    $unix = new unix();
    $q = new mysql();
    $q->CREATE_DATABASE("ocsweb");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `hardware` (\n\t\t\t\t  `ID` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `DEVICEID` varchar(255) NOT NULL,\n\t\t\t\t  `NAME` varchar(255) DEFAULT NULL,\n\t\t\t\t  `WORKGROUP` varchar(255) DEFAULT NULL,\n\t\t\t\t  `USERDOMAIN` varchar(255) DEFAULT NULL,\n\t\t\t\t  `OSNAME` varchar(255) DEFAULT NULL,\n\t\t\t\t  `OSVERSION` varchar(255) DEFAULT NULL,\n\t\t\t\t  `OSCOMMENTS` varchar(255) DEFAULT NULL,\n\t\t\t\t  `PROCESSORT` varchar(255) DEFAULT NULL,\n\t\t\t\t  `PROCESSORS` int(11) DEFAULT '0',\n\t\t\t\t  `PROCESSORN` smallint(6) DEFAULT NULL,\n\t\t\t\t  `MEMORY` int(11) DEFAULT NULL,\n\t\t\t\t  `SWAP` int(11) DEFAULT NULL,\n\t\t\t\t  `IPADDR` varchar(255) DEFAULT NULL,\n\t\t\t\t  `DNS` varchar(255) DEFAULT NULL,\n\t\t\t\t  `DEFAULTGATEWAY` varchar(255) DEFAULT NULL,\n\t\t\t\t  `ETIME` datetime DEFAULT NULL,\n\t\t\t\t  `LASTDATE` datetime DEFAULT NULL,\n\t\t\t\t  `LASTCOME` datetime DEFAULT NULL,\n\t\t\t\t  `QUALITY` decimal(7,4) DEFAULT NULL,\n\t\t\t\t  `FIDELITY` bigint(20) DEFAULT '1',\n\t\t\t\t  `USERID` varchar(255) DEFAULT NULL,\n\t\t\t\t  `TYPE` int(11) DEFAULT NULL,\n\t\t\t\t  `DESCRIPTION` varchar(255) DEFAULT NULL,\n\t\t\t\t  `WINCOMPANY` varchar(255) DEFAULT NULL,\n\t\t\t\t  `WINOWNER` varchar(255) DEFAULT NULL,\n\t\t\t\t  `WINPRODID` varchar(255) DEFAULT NULL,\n\t\t\t\t  `WINPRODKEY` varchar(255) DEFAULT NULL,\n\t\t\t\t  `USERAGENT` varchar(50) DEFAULT NULL,\n\t\t\t\t  `CHECKSUM` bigint(20) unsigned DEFAULT '262143',\n\t\t\t\t  `SSTATE` int(11) DEFAULT '0',\n\t\t\t\t  `IPSRC` varchar(255) DEFAULT NULL,\n\t\t\t\t  `UUID` varchar(255) DEFAULT NULL,\n\t\t\t\t  PRIMARY KEY (`DEVICEID`,`ID`),\n\t\t\t\t  KEY `NAME` (`NAME`),\n\t\t\t\t  KEY `CHECKSUM` (`CHECKSUM`),\n\t\t\t\t  KEY `USERID` (`USERID`),\n\t\t\t\t  KEY `WORKGROUP` (`WORKGROUP`),\n\t\t\t\t  KEY `OSNAME` (`OSNAME`),\n\t\t\t\t  KEY `MEMORY` (`MEMORY`),\n\t\t\t\t  KEY `DEVICEID` (`DEVICEID`),\n\t\t\t\t  KEY `ID` (`ID`)\n\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=UTF8;", "ocsweb");
    $mysql = $unix->find_program("mysql");
    $password = $q->mysql_password;
    if (strlen($password) > 0) {
        $password = " -p{$password}";
    }
    $cmd = "{$mysql} -u {$q->mysql_admin}{$password} --batch -h {$q->mysql_server} -P {$q->mysql_port} -D ocsweb < /usr/share/artica-postfix/bin/install/ocsbase_new.sql";
    exec($cmd, $results);
    while (list($a, $b) = each($results)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$b}";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:19,代码来源:exec.mysql.build.php

示例9: CheckHttpdConf


//.........这里部分代码省略.........
        $httpd[] = "Include {$DAEMON_PATH}/mod_security.conf";
    }
    if ($FreeWebsEnableModEvasive == 1) {
        $httpd[] = "Include {$DAEMON_PATH}/mod_evasive.conf";
    }
    $httpd[] = 'Loglevel info';
    $httpd[] = 'ErrorLog /var/log/apache2/error.log';
    $httpd[] = 'LogFormat "%h %l %u %t \\"%r\\" %<s %b" common';
    $httpd[] = 'CustomLog /var/log/apache2/access.log common';
    $mod_status = $freeweb->mod_status();
    if ($mod_status != null) {
        $status[] = "<IfModule mod_status.c>";
        $status[] = "\tExtendedStatus On";
        $status[] = "{$mod_status}";
        $status[] = "</IfModule>";
        @file_put_contents("{$DAEMON_PATH}/mods-enabled/mod-status.init", @implode("\n", $status));
    }
    @unlink("{$DAEMON_PATH}/mods-enabled/pagespeed.conf");
    if ($users->APACHE_MOD_PAGESPEED) {
        if (!is_dir("/var/cache/apache2/mod_pagespeed/default/files")) {
            @mkdir("/var/cache/apache2/mod_pagespeed/default/files", 644, true);
        }
        $pspedd[] = "<IfModule pagespeed_module>";
        $pspedd[] = "\tModPagespeedFileCachePath            \"/var/cache/apache2/mod_pagespeed/default\"";
        $pspedd[] = "\tModPagespeedGeneratedFilePrefix      \"/var/cache/apache2/mod_pagespeed/files/\"";
        $pspedd[] = "\tSetOutputFilter MOD_PAGESPEED_OUTPUT_FILTER";
        $pspedd[] = "\tAddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html";
        $pspedd[] = "</IfModule>";
        @file_put_contents("{$DAEMON_PATH}/mods-enabled/pagespeed.conf", @implode("\n", $pspedd));
    }
    if ($users->APACHE_MOD_LOGSSQL) {
        $q = new mysql();
        if (!$q->DATABASE_EXISTS("apachelogs")) {
            $q->CREATE_DATABASE("apachelogs");
        }
        $APACHE_MOD_LOGSSQL[] = "<IfModule log_sql_mysql_module>";
        $APACHE_MOD_LOGSSQL[] = "\tLogSQLLoginInfo mysql://{$q->mysql_admin}:{$q->mysql_password}@{$q->mysql_server}:{$q->mysql_port}/apachelogs";
        $APACHE_MOD_LOGSSQL[] = "\tLogSQLMassVirtualHosting On";
        $APACHE_MOD_LOGSSQL[] = "\tLogSQLmachineID {$users->hostname}";
        $APACHE_MOD_LOGSSQL[] = "\tLogSQLTransferLogFormat AbcHhmMpRSstTUuvz";
        $APACHE_MOD_LOGSSQL[] = "</IfModule>";
        @file_put_contents("{$DAEMON_PATH}/mods-enabled/log_sql_module.conf", @implode("\n", $APACHE_MOD_LOGSSQL));
    }
    if (is_file("/etc/apache2/sysconfig.d/loadmodule.conf")) {
        $httpd[] = "Include /etc/apache2/sysconfig.d/loadmodule.conf";
    }
    if (is_file("/etc/apache2/uid.conf")) {
        $httpd[] = "Include /etc/apache2/uid.conf";
    }
    if (is_file("/etc/apache2/default-server.conf")) {
        patch_suse_default_server();
        $httpd[] = "Include /etc/apache2/default-server.conf";
    }
    $httpd[] = "Include {$DAEMON_PATH}/conf.d/";
    $httpd[] = "Include {$DAEMON_PATH}/sites-enabled/";
    if (is_file("{$APACHE_MODULES_PATH}/mod_php5.so")) {
        $httpd[] = "LoadModule php5_module {$APACHE_MODULES_PATH}/mod_php5.so";
    }
    if (is_file("{$APACHE_MODULES_PATH}/mod_ldap.so")) {
        $httpd[] = "LoadModule ldap_module {$APACHE_MODULES_PATH}/mod_ldap.so";
    }
    if ($ApacheDisableModDavFS == 0) {
        if (is_file("{$APACHE_MODULES_PATH}/mod_dav.so")) {
            echo "Starting......: Apache module 'dav_module' enabled\n";
            $httpd[] = "LoadModule dav_module {$APACHE_MODULES_PATH}/mod_dav.so";
        }
开发者ID:,项目名称:,代码行数:67,代码来源:

示例10: rotate

function rotate()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "TimeFile={$TimeFile}\n";
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $xtime = $unix->file_time_min($TimeFile);
    if (!$GLOBALS['VERBOSE']) {
        if ($xtime < 5) {
            return;
        }
    }
    @unlink($TimeFile, time());
    @file_put_contents($TimeFile, time());
    $q = new mysql();
    $echo = $unix->find_program("echo");
    if (!$q->DATABASE_EXISTS("bwmng")) {
        $q->CREATE_DATABASE("bwmng");
    }
    if (!$q->DATABASE_EXISTS("bwmng", true)) {
        return;
    }
    @copy("/home/artica/bwm-ng/interfaces.csv", "/home/artica/bwm-ng/interfaces.csv." . time());
    @unlink("/home/artica/bwm-ng/interfaces.csv");
    $files = $unix->DirFiles("/home/artica/bwm-ng");
    if (system_is_overloaded(__FILE__)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "OVERLOADED !!!!\n";
        }
        return;
    }
    while (list($filename, $notused) = each($files)) {
        if ($filename == "interfaces.csv") {
            continue;
        }
        $filepath = "/home/artica/bwm-ng/{$filename}";
        $filetime = $unix->file_time_min($filepath);
        if ($filetime > 60) {
            @unlink($filepath);
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Open {$filepath} {$filetime}mn\n";
        }
        $row = 1;
        if (($handle = fopen($filepath, "r")) !== FALSE) {
            while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
                $num = count($data);
                if ($num == 0) {
                    continue;
                }
                $row++;
                $uniq_key = md5(serialize($data));
                $Unix_Timestamp = $data[0];
                if (!is_numeric($Unix_Timestamp)) {
                    continue;
                }
                $Interface_Name = $data[1];
                if (trim($Interface_Name) == null) {
                    print_r($data);
                    continue;
                }
                $BytesOut = intval($data[2]);
                $BytesIn = intval($data[3]);
                $BytesTotal = $data[4];
                $PacketsOut = $data[5];
                $PacketsIn = $data[6];
                $PacketsTotal = $data[7];
                if ($BytesOut == 0 && $BytesIn == 0) {
                    continue;
                }
                $Date = date("Y-m-d H:i:s", $Unix_Timestamp);
                $tableT = date("YmdH", $Unix_Timestamp) . "_bwmrt";
                if ($Interface_Name == "total") {
                    $array_total[$tableT][] = "('{$uniq_key}','{$Date}','{$BytesOut}','{$BytesIn}')";
                    continue;
                }
                $table = date("YmdH", $Unix_Timestamp) . "_bwmrh";
                $array_eths[$table][] = "('{$uniq_key}','{$Interface_Name}','{$Date}','{$BytesOut}','{$BytesIn}')";
            }
            fclose($handle);
            if (system_is_overloaded(__FILE__)) {
                break;
            }
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "{$filepath} CLOSED: " . count($array_eths) . " eths, " . count($array_total) . " total\n";
        }
        if (array_to_interfaces($array_eths)) {
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.bwm-ng.php

示例11: snapshot


//.........这里部分代码省略.........
                    continue;
                }
                if (preg_match("#^allsizes#", $table_name)) {
                    continue;
                }
                if (preg_match("#^alluid#", $table_name)) {
                    continue;
                }
                if (preg_match("#^categorize#", $table_name)) {
                    continue;
                }
                if (preg_match("#^blocked_#", $table_name)) {
                    continue;
                }
                if (preg_match("#^sites\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^users\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^ufdbunlock\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^updateblks_events\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^main_websites#", $table_name)) {
                    continue;
                }
                if (preg_match("#^notcategorized#", $table_name)) {
                    continue;
                }
                if ($q->COUNT_ROWS($table_name, "squidlogs") == 0) {
                    $GLOBALS["TRUNCATES"]["squidlogs"][$table_name] = true;
                    continue;
                }
                progress(30, "{backup} {$table_name}");
                echo "{$BaseWorkDir}/squidlogs/{$table_name}.gz\n";
                $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/squidlogs/{$table_name}.gz 2>&1";
                if ($GLOBALS["VERBOSE"]) {
                    echo "{$cmd}\n";
                }
                exec($cmd, $results);
                if ($unix->MYSQL_BIN_PARSE_ERROR($results)) {
                    echo "Failed to create snapshot\n " . @implode("\n", $results);
                    shell_exec("{$rm} -rf {$BaseWorkDir}");
                    system_admin_events("Failed to create snapshot " . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__);
                    return;
                }
                $GLOBALS["ARRAY_CONTENT"]["squidlogs/{$table_name}.gz"] = @filesize("{$BaseWorkDir}/squidlogs/{$table_name}.gz");
                $c++;
            }
        }
    }
    progress(35, "{backup} OpenDLAP server");
    backup_ldap($BaseWorkDir);
    progress(40, "{backup} Reverse Proxy");
    backup_nginx($BaseWorkDir);
    progress(45, "{backup} PowerDNS");
    backup_mysql_powerdns($BaseWorkDir);
    progress(50, "{backup} Artica settings");
    backup_artica_settings($BaseWorkDir);
    @file_put_contents("{$BaseWorkDir}/TRUNCATE_TABLES", serialize($GLOBALS["TRUNCATES"]));
    $temp = $unix->FILE_TEMP() . ".tar.gz";
    $tempdir = $unix->TEMP_DIR();
    chdir($BaseWorkDir);
    progress(60, "{compressing}");
    system("{$tar} -czf {$temp} *");
    shell_exec("{$rm} -rf {$BaseWorkDir}");
    echo "{$temp}\n";
    $q = new mysql();
    $q->CREATE_DATABASE("artica_snapshots");
    $sql = "CREATE TABLE IF NOT EXISTS `snapshots` (\n\t`ID` int(11) NOT NULL AUTO_INCREMENT,\n\t`zmd5` VARCHAR(90) NOT NULL,\n\t`size` INT UNSIGNED NOT NULL,\n\t`zDate` DATETIME NOT NULL,\n\t`snap` LONGBLOB NOT NULL,\n\t `content` TEXT NOT NULL,\n\t PRIMARY KEY (`ID`),\n\t UNIQUE KEY `zmd5` (`zmd5`),\n\t KEY `zDate` (`zDate`)\n\t) ENGINE=MyISAM";
    $q->QUERY_SQL($sql, 'artica_snapshots');
    progress(70, "{saving}");
    if ($GLOBALS["SEND_META"]) {
        $articameta = new artica_meta();
        $filemeta = $tempdir . "/snapshot.tar.gz";
        if (@copy($temp, $filemeta)) {
            if (!$articameta->SendFile($filemeta, "SNAPSHOT")) {
                $articameta->events("{$temp} unable to upload", __FUNCTION__, __FILE__, __LINE__);
            }
        } else {
            $articameta->events("{$temp} unable to copy {$temp} to {$filemeta}", __FUNCTION__, __FILE__, __LINE__);
        }
        @unlink($filemeta);
    }
    $zmd5 = md5_file($temp);
    $data = mysql_escape_string2(@file_get_contents($temp));
    $size = @filesize($temp);
    $final_array = mysql_escape_string2(serialize($GLOBALS["ARRAY_CONTENT"]));
    $q->QUERY_SQL("INSERT IGNORE INTO `snapshots` (zDate,snap,size,content,zmd5) \n\t\t\tVALUES (NOW(),'{$data}','{$size}','{$final_array}','{$zmd5}')", "artica_snapshots");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
        progress(70, "{failed}");
    }
    @unlink($temp);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/snapshots");
    progress(100, "{success}");
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.backup.artica.php

示例12: 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);
    }
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例13: CheckHttpdConf


//.........这里部分代码省略.........
    }
    @mkdir("/var/lib/apache2/fastcgi", 0755, true);
    @chown("/var/lib/apache2/fastcgi", $APACHE_SRC_ACCOUNT);
    @chgrp("/var/lib/apache2/fastcgi", $APACHE_SRC_GROUP);
    $httpd[] = 'Loglevel info';
    $httpd[] = 'ErrorLog /var/log/apache2/error.log';
    $httpd[] = 'LogFormat "%h %l %u %t \\"%r\\" %<s %b" common';
    $httpd[] = 'CustomLog /var/log/apache2/access.log common';
    $mod_status = $freeweb->mod_status();
    if ($mod_status != null) {
        $status[] = "<IfModule mod_status.c>";
        $status[] = "\tExtendedStatus On";
        $status[] = "{$mod_status}";
        $status[] = "</IfModule>";
        @file_put_contents("{$DAEMON_PATH}/mods-enabled/mod-status.init", @implode("\n", $status));
    }
    @unlink("{$DAEMON_PATH}/mods-enabled/pagespeed.conf");
    if ($users->APACHE_MOD_PAGESPEED) {
        if (!is_dir("/var/cache/apache2/mod_pagespeed/default/files")) {
            @mkdir("/var/cache/apache2/mod_pagespeed/default/files", 644, true);
        }
        $pspedd[] = "<IfModule pagespeed_module>";
        $pspedd[] = "\tModPagespeedFileCachePath            \"/var/cache/apache2/mod_pagespeed/default\"";
        $pspedd[] = "\tModPagespeedGeneratedFilePrefix      \"/var/cache/apache2/mod_pagespeed/files/\"";
        $pspedd[] = "\tSetOutputFilter MOD_PAGESPEED_OUTPUT_FILTER";
        $pspedd[] = "\tAddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html";
        $pspedd[] = "</IfModule>";
        @file_put_contents("{$DAEMON_PATH}/mods-enabled/pagespeed.conf", @implode("\n", $pspedd));
    }
    if ($users->APACHE_MOD_LOGSSQL) {
        if ($FreeWebEnableSQLLog == 1) {
            $q = new mysql();
            if (!$q->DATABASE_EXISTS("apachelogs")) {
                $q->CREATE_DATABASE("apachelogs");
            }
            $APACHE_MOD_LOGSSQL[] = "<IfModule log_sql_mysql_module>";
            $APACHE_MOD_LOGSSQL[] = "\tLogSQLLoginInfo mysql://{$q->mysql_admin}:{$q->mysql_password}@{$q->mysql_server}:{$q->mysql_port}/apachelogs";
            $APACHE_MOD_LOGSSQL[] = "\tLogSQLMassVirtualHosting On";
            $APACHE_MOD_LOGSSQL[] = "\tLogSQLmachineID {$users->hostname}";
            $APACHE_MOD_LOGSSQL[] = "\tLogSQLTransferLogFormat AbcHhmMpRSstTUuvz";
            $APACHE_MOD_LOGSSQL[] = "</IfModule>";
            @file_put_contents("{$DAEMON_PATH}/mods-enabled/log_sql_module.conf", @implode("\n", $APACHE_MOD_LOGSSQL));
        }
    }
    CheckHttpdConf_mime_module();
    CheckHttpdConf_mailman();
    if (is_file("/etc/apache2/mailman.conf")) {
        $httpd[] = "Include /etc/apache2/mailman.conf";
    }
    if (is_file("/etc/apache2/sysconfig.d/loadmodule.conf")) {
        $httpd[] = "Include /etc/apache2/sysconfig.d/loadmodule.conf";
    }
    if (is_file("/etc/apache2/uid.conf")) {
        $httpd[] = "Include /etc/apache2/uid.conf";
    }
    if (is_file("/etc/apache2/default-server.conf")) {
        patch_suse_default_server();
        $httpd[] = "Include /etc/apache2/default-server.conf";
    }
    $httpd[] = "Include {$DAEMON_PATH}/mime.conf";
    $httpd[] = "Include {$DAEMON_PATH}/conf.d/";
    $httpd[] = "Include {$DAEMON_PATH}/sites-enabled/";
    $httpd[] = "Include {$DAEMON_PATH}/webdavcontainers.conf";
    //PHP5 MODULE
    //if(is_file("$APACHE_MODULES_PATH/mod_php5.so")){$httpd[]="LoadModule php5_module $APACHE_MODULES_PATH/mod_php5.so";}
    //if(is_file("$APACHE_MODULES_PATH/mod_ldap.so")){$httpd[]="LoadModule ldap_module $APACHE_MODULES_PATH/mod_ldap.so";}
开发者ID:articatech,项目名称:artica,代码行数:67,代码来源:exec.freeweb.php

示例14: 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;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:40,代码来源:exec.greyhole.php

示例15: build_phpmyadmin


//.........这里部分代码省略.........
    $f[] = " * Defines whether a user should be displayed a \"show all (records)\"";
    $f[] = " * button in browse mode or not.";
    $f[] = " * default = false";
    $f[] = " */";
    $f[] = "//\$cfg['ShowAll'] = true;";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * Number of rows displayed when browsing a result set. If the result";
    $f[] = " * set contains more rows, \"Previous\" and \"Next\".";
    $f[] = " * default = 30";
    $f[] = " */";
    $f[] = "//\$cfg['MaxRows'] = 50;";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * disallow editing of binary fields";
    $f[] = " * valid values are:";
    $f[] = " *   false    allow editing";
    $f[] = " *   'blob'   allow editing except for BLOB fields";
    $f[] = " *   'noblob' disallow editing except for BLOB fields";
    $f[] = " *   'all'    disallow editing";
    $f[] = " * default = blob";
    $f[] = " */";
    $f[] = "//\$cfg['ProtectBinary'] = 'false';";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * Default language to use, if not browser-defined or user-defined";
    $f[] = " * (you find all languages in the locale folder)";
    $f[] = " * uncomment the desired line:";
    $f[] = " * default = 'en'";
    $f[] = " */";
    $f[] = "//\$cfg['DefaultLang'] = 'en';";
    $f[] = "//\$cfg['DefaultLang'] = 'de';";
    $f[] = "//\$cfg['DefaultLang'] = 'fr';";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * default display direction (horizontal|vertical|horizontalflipped)";
    $f[] = " */";
    $f[] = "//\$cfg['DefaultDisplay'] = 'vertical';";
    $f[] = "";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * How many columns should be used for table display of a database?";
    $f[] = " * (a value larger than 1 results in some information being hidden)";
    $f[] = " * default = 1";
    $f[] = " */";
    $f[] = "//\$cfg['PropertiesNumColumns'] = 2;";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * Set to true if you want DB-based query history.If false, this utilizes";
    $f[] = " * JS-routines to display query history (lost by window close)";
    $f[] = " *";
    $f[] = " * This requires configuration storage enabled, see above.";
    $f[] = " * default = false";
    $f[] = " */";
    $f[] = "//\$cfg['QueryHistoryDB'] = true;";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * When using DB-based query history, how many entries should be kept?";
    $f[] = " *";
    $f[] = " * default = 25";
    $f[] = " */";
    $f[] = "//\$cfg['QueryHistoryMax'] = 100;";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * Should error reporting be enabled for JavaScript errors";
    $f[] = " *";
    $f[] = " * default = 'ask'";
    $f[] = " */";
    $f[] = "//\$cfg['SendErrorReports'] = 'ask';";
    $f[] = "";
    $f[] = "/*";
    $f[] = " * You can find more configuration options in the documentation";
    $f[] = " * in the doc/ folder or at <http://docs.phpmyadmin.net/>.";
    $f[] = " */";
    $f[] = "?>";
    echo "slapd: [INFO] phpmyadmin success\n";
    @file_put_contents("/usr/share/phpmyadmin/config.inc.php", @implode("\n", $f));
    @chmod("/usr/share/phpmyadmin/config.inc.php", 0705);
    $q = new mysql();
    if (!$q->DATABASE_EXISTS("phpmyadmin")) {
        $q->CREATE_DATABASE("phpmyadmin");
    }
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__bookmark` (\n`id` int(11) NOT NULL auto_increment,\n`dbase` varchar(255) NOT NULL default '',\n`user` varchar(255) NOT NULL default '',\n`label` varchar(255) COLLATE utf8_general_ci NOT NULL default '',\n`query` text NOT NULL,\nPRIMARY KEY  (`id`)\n)\nCOMMENT='Bookmarks'\nDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__column_info` (\n\t\t`id` int(5) unsigned NOT NULL auto_increment,\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`table_name` varchar(64) NOT NULL default '',\n\t\t`column_name` varchar(64) NOT NULL default '',\n\t\t`comment` varchar(255) COLLATE utf8_general_ci NOT NULL default '',\n\t\t`mimetype` varchar(255) COLLATE utf8_general_ci NOT NULL default '',\n\t\t`transformation` varchar(255) NOT NULL default '',\n\t\t`transformation_options` varchar(255) NOT NULL default '',\n\t\tPRIMARY KEY  (`id`),\n\t\tUNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)\n)\nCOMMENT='Column information for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__history` (\n\t\t`id` bigint(20) unsigned NOT NULL auto_increment,\n\t\t`username` varchar(64) NOT NULL default '',\n\t\t`db` varchar(64) NOT NULL default '',\n\t\t`table` varchar(64) NOT NULL default '',\n\t\t`timevalue` timestamp NOT NULL,\n\t\t`sqlquery` text NOT NULL,\n\t\tPRIMARY KEY  (`id`),\n\t\tKEY `username` (`username`,`db`,`table`,`timevalue`)\n)\nCOMMENT='SQL history for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__pdf_pages` (\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`page_nr` int(10) unsigned NOT NULL auto_increment,\n\t\t`page_descr` varchar(50) COLLATE utf8_general_ci NOT NULL default '',\n\t\tPRIMARY KEY  (`page_nr`),\n\t\tKEY `db_name` (`db_name`)\n)\nCOMMENT='PDF relation pages for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__recent` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`tables` text NOT NULL,\n\t\tPRIMARY KEY (`username`)\n)\nCOMMENT='Recently accessed tables'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__favorite` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`tables` text NOT NULL,\n\t\tPRIMARY KEY (`username`)\n)\nCOMMENT='Favorite tables'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`db_name` varchar(64) NOT NULL,\n\t\t`table_name` varchar(64) NOT NULL,\n\t\t`prefs` text NOT NULL,\n\t\t`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t\tPRIMARY KEY (`username`,`db_name`,`table_name`)\n)\nCOMMENT='Tables'' UI preferences'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__relation` (\n\t\t`master_db` varchar(64) NOT NULL default '',\n\t\t`master_table` varchar(64) NOT NULL default '',\n\t\t`master_field` varchar(64) NOT NULL default '',\n\t\t`foreign_db` varchar(64) NOT NULL default '',\n\t\t`foreign_table` varchar(64) NOT NULL default '',\n\t\t`foreign_field` varchar(64) NOT NULL default '',\n\t\tPRIMARY KEY  (`master_db`,`master_table`,`master_field`),\n\t\tKEY `foreign_field` (`foreign_db`,`foreign_table`)\n)\nCOMMENT='Relation table'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__table_coords` (\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`table_name` varchar(64) NOT NULL default '',\n\t\t`pdf_page_number` int(11) NOT NULL default '0',\n\t\t`x` float unsigned NOT NULL default '0',\n\t\t`y` float unsigned NOT NULL default '0',\n\t\tPRIMARY KEY  (`db_name`,`table_name`,`pdf_page_number`)\n)\nCOMMENT='Table coordinates for phpMyAdmin PDF output'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__table_info` (\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`table_name` varchar(64) NOT NULL default '',\n\t\t`display_field` varchar(64) NOT NULL default '',\n\t\tPRIMARY KEY  (`db_name`,`table_name`)\n)\nCOMMENT='Table information for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__designer_coords` (\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`table_name` varchar(64) NOT NULL default '',\n\t\t`x` INT,\n\t\t`y` INT,\n\t\t`v` TINYINT,\n\t\t`h` TINYINT,\n\t\tPRIMARY KEY (`db_name`,`table_name`)\n)\nCOMMENT='Table coordinates for Designer'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__tracking` (\n\t\t`db_name` varchar(64) NOT NULL,\n\t\t`table_name` varchar(64) NOT NULL,\n\t\t`version` int(10) unsigned NOT NULL,\n\t\t`date_created` datetime NOT NULL,\n\t\t`date_updated` datetime NOT NULL,\n\t\t`schema_snapshot` text NOT NULL,\n\t\t`schema_sql` text,\n\t\t`data_sql` longtext,\n\t\t`tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') default NULL,\n\t\t`tracking_active` int(1) unsigned NOT NULL default '1',\n\t\tPRIMARY KEY  (`db_name`,`table_name`,`version`)\n)\nCOMMENT='Database changes tracking for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__userconfig` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`timevalue` timestamp NOT NULL,\n\t\t`config_data` text NOT NULL,\n\t\tPRIMARY KEY  (`username`)\n)\nCOMMENT='User preferences storage for phpMyAdmin'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__users` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`usergroup` varchar(64) NOT NULL,\n\t\tPRIMARY KEY (`username`,`usergroup`)\n)\nCOMMENT='Users and their assignments to user groups'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__usergroups` (\n\t\t`usergroup` varchar(64) NOT NULL,\n\t\t`tab` varchar(64) NOT NULL,\n\t\t`allowed` enum('Y','N') NOT NULL DEFAULT 'N',\n\t\tPRIMARY KEY (`usergroup`,`tab`,`allowed`)\n)\nCOMMENT='User groups with configured menu items'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__navigationhiding` (\n\t\t`username` varchar(64) NOT NULL,\n\t\t`item_name` varchar(64) NOT NULL,\n\t\t`item_type` varchar(64) NOT NULL,\n\t\t`db_name` varchar(64) NOT NULL,\n\t\t`table_name` varchar(64) NOT NULL,\n\t\tPRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)\n)\nCOMMENT='Hidden items of navigation tree'\n\t\tDEFAULT CHARACTER SET utf8 COLLATE utf8_bin;", "phpmyadmin");
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `pma__savedsearches` (\n\t\t`id` int(5) unsigned NOT NULL auto_increment,\n\t\t`username` varchar(64) NOT NULL default '',\n\t\t`db_name` varchar(64) NOT NULL default '',\n\t\t`search_name` varchar(64) NOT NULL default '',\n\t\t`search_data` text NOT NULL,\n\t\tPRIMARY KEY  (`id`),\n\t\tUNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`)\n)", "phpmyadmin");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.phpmyadmin.php


注:本文中的mysql::CREATE_DATABASE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。