本文整理汇总了PHP中mysql::DELETE_DATABASE方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::DELETE_DATABASE方法的具体用法?PHP mysql::DELETE_DATABASE怎么用?PHP mysql::DELETE_DATABASE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::DELETE_DATABASE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reset2
function reset2()
{
system("clear");
echo "Remove databases\n";
$q = new mysql();
echo "Remove database settings\n";
$q->DELETE_DATABASE("artica_backup");
echo "Remove database events\n";
$q->DELETE_DATABASE("artica_events");
echo "Remove database Proxy\n";
$q = new mysql_squid_builder();
$q->QUERY_SQL("DROP DATABASE `squidlogs`");
echo "Remove Artica settings Proxy\n";
$unix = new unix();
$files = $unix->DirFiles("/etc/artica-postfix/settings/Daemons");
while (list($filename, $value) = each($files)) {
$fulename = "/etc/artica-postfix/settings/Daemons/{$filename}";
echo "Removing {$filename}\n";
@unlink($fulename);
}
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/ProxyUseArticaDB", 1);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/StatsPerfsSquidAnswered", 1);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/CacheManagement2", 1);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnablePHPFPM", 0);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableArticaFrontEndToNGninx", 0);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableArticaFrontEndToApache", 1);
@file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableNginx", 0);
echo "Restarting Web Console...\n";
system('/etc/init.d/artica-webconsole restart');
system("clear");
echo "All data has been erased..\n";
echo "Type Enter key to exit\n";
$answer = trim(strtolower(fgets(STDIN)));
die;
}
示例2: removedatabase
function removedatabase()
{
$q = new mysql();
if (!$q->DATABASE_EXISTS("ocsweb")) {
$q->DELETE_DATABASE("ocsweb");
}
}
示例3: removedb
function removedb()
{
$q = new mysql();
$q->DELETE_DATABASE("zarafa");
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock = new sockets();
$sock->getFrameWork("zarafa.php?removeidb=yes");
$sock->getFrameWork("cmd.php?zarafa-restart-server=yes");
}
示例4: CheckUninstall
function CheckUninstall()
{
$sql = "SELECT * FROM joomla_users WHERE install=-1";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
$q = new mysql();
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
unset($arrayconfig);
$GLOBALS["joom_servername"] = $ligne["servername"];
set_status('{checking}');
$q->DELETE_DATABASE($ligne["databasename"]);
DeleteMysqlAdmin($ligne["databasename"]);
$u = new user($uid);
$arrayconfig["password"] = $u->password;
$root = $u->homeDirectory . "/www/{$ligne["servername"]}";
$arrayconfig["root"] = $root;
shell_exec("/bin/rm -rf {$root} >/dev/null 2>&1");
$sql = "DELETE FROM joomla_users WHERE servername='{$GLOBALS["joom_servername"]}'";
$q->QUERY_SQL($sql, "artica_backup");
}
shell_exec("/usr/share/artica-postfix/bin/artica-install --reload-apache-groupware");
}
示例5: duplicate_wordpress
function duplicate_wordpress($servername)
{
$unix = new unix();
$q = new mysql();
$free = new freeweb($servername);
$WORKING_DIRECTORY = $free->www_dir;
if ($free->groupware_duplicate == null) {
build_progress("{$servername}: {duplicate} {$servername} no duplicate set...", 42);
sleep(2);
return false;
}
$free2 = new freeweb($free->groupware_duplicate);
if ($free2->mysql_database == null) {
echo "Fatal: {$free->groupware_duplicate} did not have any such DB set, try to find it..\n";
$free2->mysql_database = $free2->CreateDatabaseName();
echo "Fatal: {$free->groupware_duplicate} = {$free2->mysql_database}\n";
}
if (!$q->DATABASE_EXISTS($free2->mysql_database, true)) {
build_progress("{$servername}: {duplicate} {$free->groupware_duplicate} did not have any database...", 42);
sleep(2);
return false;
}
$srcdir = $free2->www_dir;
$Mysqlpassword = null;
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
if (@is_link($WORKING_DIRECTORY)) {
$WORKING_DIRECTORY = @readlink($WORKING_DIRECTORY);
}
if (is_dir($WORKING_DIRECTORY)) {
build_progress("{$servername}: {removing} {$WORKING_DIRECTORY}...", 42);
sleep(2);
shell_exec("{$rm} -rf {$WORKING_DIRECTORY}/*");
}
@mkdir($WORKING_DIRECTORY, 0755, true);
build_progress("{$servername}: {installing} {from} {$srcdir}...", 42);
shell_exec("{$cp} -rf {$srcdir}/* {$WORKING_DIRECTORY}/");
$wordpressDB = $free->mysql_database;
if ($wordpressDB == null) {
$wordpressDB = $free->CreateDatabaseName();
}
if ($q->DATABASE_EXISTS($wordpressDB)) {
build_progress("{$servername}: {remove_database} {$wordpressDB}...", 42);
sleep(2);
if (!$q->DELETE_DATABASE($wordpressDB)) {
build_progress("{$servername}: {remove_database} {$wordpressDB} {failed}...", 42);
return false;
}
if (!$q->CREATE_DATABASE($wordpressDB, true)) {
build_progress("{$servername}: {create_database} {$wordpressDB} {failed}...", 42);
return false;
}
}
if (!$q->DATABASE_EXISTS($wordpressDB)) {
if (!$q->CREATE_DATABASE($wordpressDB, true)) {
build_progress("{$servername}: {create_database} {$wordpressDB} {failed}...", 42);
return false;
}
}
build_progress("{$servername}: {backup_database} {from} {$free2->mysql_database}...", 42);
$mysqldump = $unix->find_program("mysqldump");
$q = new mysql();
if ($q->mysql_password != null) {
$Mysqlpassword = " -p" . $unix->shellEscapeChars($q->mysql_password);
}
$t = time();
$TMP_FILE = $unix->FILE_TEMP();
$cmdline = trim("{$mysqldump} --add-drop-table --single-transaction --force --insert-ignore -S /var/run/mysqld/mysqld.sock -u {$q->mysql_admin}{$Mysqlpassword} {$free2->mysql_database} >{$TMP_FILE} 2>&1");
if ($GLOBALS["VERBOSE"]) {
echo "{$cmdline}\n";
}
$results = array();
exec($cmdline, $results);
while (list($num, $ligne) = each($results)) {
echo "{$ligne}\n";
if (preg_match("#ERROR\\s+([0-9]+)#", $ligne)) {
build_progress("{$servername}: {restore_database} {to} {$wordpressDB} {failed}..", 42);
sleep(3);
return false;
}
}
build_progress("{$servername}: {restore_database} {to} {$wordpressDB}..", 42);
$mysqlbin = $unix->find_program("mysql");
$cmd = "{$mysqlbin} --batch --force -S /var/run/mysqld/mysqld.sock -u {$q->mysql_admin}{$Mysqlpassword} --database={$wordpressDB} <{$TMP_FILE} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
exec($cmd, $results);
while (list($num, $ligne) = each($results)) {
echo "{$ligne}\n";
if (preg_match("#ERROR\\s+([0-9]+)#", $ligne)) {
build_progress("{$servername}: {restore_database} {to} {$wordpressDB} {failed}..", 42);
sleep(3);
return false;
}
}
build_progress("{$servername}: {restore_database} {to} {$wordpressDB}..{done}", 42);
@unlink($TMP_FILE);
if (!scan($WORKING_DIRECTORY)) {
build_progress("{$servername}: {install} {failed}", 42);
//.........这里部分代码省略.........
示例6: writeconfigfile
public function writeconfigfile()
{
$unix = new unix();
$q = new mysql();
$firstinstall = false;
if ($this->rebuildb) {
writelogs("[{$this->servername}] DELETE_DATABASE", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
$q->DELETE_DATABASE($this->database, true);
writelogs("[{$this->servername}] CREATE_DATABASE", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
$q = new mysql();
$q->CREATE_DATABASE($this->database, true);
}
if ($GLOBALS["REINSTALL"]) {
$q->DELETE_DATABASE($this->database);
$q->CREATE_DATABASE($this->database, true);
}
if (!$q->DATABASE_EXISTS($this->database)) {
writelogs("[{$this->servername}] DATABASE DOES NOT EXISTS Create e new one", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" create database {$this->database}\n";
$q->CREATE_DATABASE($this->database, true);
} else {
echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" create {$this->database} OK\n";
}
if (!$q->DATABASE_EXISTS($this->database)) {
echo "Starting......: " . date("H:i:s") . " Apache \"{$this->servername}\" create database {$this->database} FAILED\n";
}
if (!$this->testtables()) {
$mysql = $unix->find_program("mysql");
if (is_file("{$this->www_dir}/install/sql/groupoffice.sql")) {
$cmd = "{$mysql} -u {$q->mysql_admin} -p\"{$q->mysql_password}\" --batch --database={$this->database} < {$this->www_dir}/install/sql/groupoffice.sql";
writelogs("[{$this->servername}] \"{$this->servername}\" Creating tables....", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
writelogs("[{$this->servername}] {$cmd}", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
echo "Starting......: " . date("H:i:s") . " Apache {$cmd}\n";
exec($cmd, $talesexec);
while (list($num, ) = each($talesexec)) {
writelogs("[{$this->servername}] \"{$this->servername}\" {$ligne}", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
}
if (!$this->testtables()) {
writelogs("[{$this->servername}] \"{$this->servername}\" Creating tables FAILED", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
$firstinstall = true;
}
} else {
writelogs("[{$this->servername}] \"{$this->servername}\" {$this->www_dir}/install/sql/groupoffice.sql no such file !!!!!", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
}
} else {
writelogs("[{$this->servername}] \"{$this->servername}\" {$ligne} tables OK", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__);
}
if ($q->mysql_server == "localhost") {
$q->mysql_server = "127.0.0.1";
}
$gpoffice[] = "<?php";
$gpoffice[] = "\$config['enabled']=true;";
$gpoffice[] = "\$config['id']=\"groupoffice\";";
$gpoffice[] = "\$config['debug']=false;";
$gpoffice[] = "\$config['debug_log']=false;";
$gpoffice[] = "\$config['info_log']=\"/home/{$this->servername}/log/info.log\";";
$gpoffice[] = "\$config['debug_display_errors']=False;";
$gpoffice[] = "\$config['log']=True;";
$gpoffice[] = "\$config['language']=\"en\";";
$gpoffice[] = "\$config['default_country']=\"NL\";";
$gpoffice[] = "\$config['default_timezone']=\"Europe/Berlin\";";
$gpoffice[] = "\$config['default_currency']=\"€\";";
$gpoffice[] = "\$config['default_date_format']=\"dmY\";";
$gpoffice[] = "\$config['default_date_separator']=\"-\";";
$gpoffice[] = "\$config['default_time_format']=\"G:i\";";
$gpoffice[] = "\$config['default_sort_name']=\"last_name\";";
$gpoffice[] = "\$config['default_first_weekday']=\"1\";";
$gpoffice[] = "\$config['default_decimal_separator']=\",\";";
$gpoffice[] = "\$config['default_thousands_separator']=\".\";";
$gpoffice[] = "\$config['theme']=\"Default\";";
$gpoffice[] = "\$config['allow_themes']=true;";
$gpoffice[] = "\$config['allow_password_change']=true;";
$gpoffice[] = "\$config['allow_profile_edit']=true;";
$gpoffice[] = "\$config['allow_registration']=false;";
$gpoffice[] = "\$config['registration_fields']=\"title_initials,sex,birthday,address,home_phone,fax,cellular,company,department,function,work_address,work_phone,work_fax,homepage\";";
$gpoffice[] = "\$config['required_registration_fields']=\"company,address\";";
$gpoffice[] = "\$config['allow_duplicate_email']=false;";
$gpoffice[] = "\$config['auto_activate_accounts']=false;";
$gpoffice[] = "\$config['notify_admin_of_registration']=true;";
$gpoffice[] = "\$config['register_modules_read']=\"summary,email,calendar,tasks,addressbook,files,notes,emailportlet,log,dav,tools,settings,groups,links,blacklist,mailings,bookmarks,sieve,comments,users,search,modules\";";
$gpoffice[] = "\$config['register_modules_write']=\"summary,email,calendar,tasks,addressbook,files,notes,emailportlet,log,dav,tools,settings,groups,links,blacklist,mailings,bookmarks,sieve,comments,users,search,modules\";";
$gpoffice[] = "\$config['allowed_modules']=\"\";";
$gpoffice[] = "\$config['register_user_groups']=\"\";";
$gpoffice[] = "\$config['register_visible_user_groups']=\",\";";
$gpoffice[] = "\$config['host']=\"/\";";
$gpoffice[] = "\$config['force_login_url']=false;";
$gpoffice[] = "\$config['full_url']=\"http://{$this->servername}/\";";
$gpoffice[] = "\$config['title']=\"{$this->servername}\";";
$gpoffice[] = "\$config['webmaster_email']=\"webmaster@example.com\";";
$gpoffice[] = "\$config['help_link']=\"http://www.group-office.com/wiki/\";";
$gpoffice[] = "\$config['root_path']=\"{$this->www_dir}/\";";
$gpoffice[] = "\$config['tmpdir']=\"/tmp/\";";
$gpoffice[] = "\$config['max_users']=\"0\";";
$gpoffice[] = "\$config['quota']=\"0\";";
$gpoffice[] = "\$config['db_type']=\"mysql\";";
$gpoffice[] = "\$config['db_host']=\"{$q->mysql_server}\";";
$gpoffice[] = "\$config['db_name']=\"{$this->database}\";";
$gpoffice[] = "\$config['db_user']=\"{$q->mysql_admin}\";";
$gpoffice[] = "\$config['db_pass']=\"{$q->mysql_password}\";";
$gpoffice[] = "\$config['db_port']=\"{$q->mysql_port}\";";
//.........这里部分代码省略.........
示例7: updatev2_manu
function updatev2_manu()
{
$sock = new sockets();
$unix = new unix();
$t = time();
$GLOBALS["TEMP_PATH"] = $unix->TEMP_DIR();
$ManualArticaDBPath = $sock->GET_INFO("ManualArticaDBPath");
$ArticaDbReplicate = $sock->GET_INFO("ArticaDbReplicate");
if ($ManualArticaDBPath == null) {
$ManualArticaDBPath = "/home/manualupdate/articadb.tar.gz";
}
$ArticaDBPath = $sock->GET_INFO("ArticaDBPath");
if ($ArticaDBPath == null) {
$ArticaDBPath = "/opt/articatech";
}
if (!is_numeric($ArticaDbReplicate)) {
$ArticaDbReplicate = 0;
}
$tar = $unix->find_program("tar");
updatev2_progress(80, "{installing}...");
if ($GLOBALS["VERBOSE"]) {
echo "uncompressing {$ManualArticaDBPath}\n";
}
@mkdir($ArticaDBPath, 0755, true);
updatev2_progress(85, "{stopping_service}...");
shell_exec("/etc/init.d/artica-postfix stop articadb");
updatev2_progress(95, "{extracting_package}...");
shell_exec("{$tar} -xf {$ManualArticaDBPath} -C {$ArticaDBPath}/");
updatev2_progress(96, "{cleaning}...");
if ($ArticaDbReplicate == 1) {
@copy("/usr/share/artica-postfix/ressources/logs/web/cache/CATZ_ARRAY", "/home/articatechdb.version");
@copy("{$ManualArticaDBPath}", "/home/articadb.tar.gz");
@chmod("/home/articadb.tar.gz", 0755);
@chmod("/home/articatechdb.version", 0755);
}
@unlink($ManualArticaDBPath);
updatev2_progress(89, "{starting_service}...");
if ($GLOBALS["VERBOSE"]) {
echo "starting Articadb\n";
}
shell_exec("/etc/init.d/artica-postfix start articadb");
updatev2_progress(90, "{checking}");
$q = new mysql();
if (!$q->DATABASE_EXISTS("catz")) {
updatev2_progress(95, "Removing old database catz");
$q->DELETE_DATABASE("catz");
}
updatev2_progress(99, "{finish}");
$took = $unix->distanceOfTimeInWords($t, time());
$LOCAL_VERSION = @file_get_contents("{$ArticaDBPath}/VERSION");
squid_admin_mysql(2, "New Artica Database statistics {$LOCAL_VERSION} updated took:{$took}", "");
// ufdbguard_admin_events("New Artica Database statistics $LOCAL_VERSION updated took:$took.",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
updatev2_progress(100, "{done}");
$q->QUERY_SQL("TRUNCATE TABLE `catztemp`");
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
$cmd = trim("{$nohup} {$php5} /usr/share/artica-postfix/exec.squid.visited.sites.php --schedule-id={$GLOBALS["SCHEDULE_ID"]} >/dev/null 2>&1 &");
shell_exec($cmd);
return true;
}
示例8: remove
function remove($servername)
{
$apache = new vhosts();
$GLOBALS["ADDLOG"] = "{$GLOBALS["ARTICALOGDIR"]}/{$servername}.log";
$confs = $apache->SearchHosts($servername);
events(__FUNCTION__ . ":: Check {$servername}");
events(__FUNCTION__ . ":: remove files and directories");
if (is_dir("/usr/share/artica-groupware/domains/{$servername}")) {
shell_exec("/bin/rm -rf /usr/share/artica-groupware/domains/{$servername}");
}
$server_database = str_replace(" ", "_", $servername);
$server_database = str_replace(".", "_", $servername);
$server_database = str_replace("-", "_", $server_database);
$q = new mysql();
if ($q->DATABASE_EXISTS($server_database)) {
$q->DELETE_DATABASE($server_database);
}
$flaseuser["root"] = true;
$flaseuser["admin"] = true;
$flaseuser["manager"] = true;
$sql = "DELETE FROM `mysql`.`db` WHERE `db`.`Db` = '{$server_database}'";
$q->QUERY_SQL($sql, "mysql");
events(__FUNCTION__ . ":: removing ldap branch {$confs["dn"]}");
$ldap = new clladp();
if ($ldap->ExistsDN($confs["dn"])) {
$ldap->ldap_delete($confs["dn"]);
}
events(__FUNCTION__ . ":: restarting HTTP service...");
shell_exec("/etc/init.d/artica-postfix restart apache-groupware &");
}
示例9: rebuild_zarafa
function rebuild_zarafa()
{
$q = new mysql();
$q->DELETE_DATABASE("zarafa");
shell_exec("/etc/init.d/artica-postfix restart zarafa");
}
示例10: 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);
}
示例11: remove_database
function remove_database()
{
$q = new mysql();
$unix = new unix();
$sock = new sockets();
$ZarafaDedicateMySQLServer = $sock->GET_INFO("ZarafaDedicateMySQLServer");
if (!is_numeric($ZarafaDedicateMySQLServer)) {
$ZarafaDedicateMySQLServer = 0;
}
if ($ZarafaDedicateMySQLServer == 1) {
shell_exec($unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.zarafa-db.php --remove-database");
return;
}
$MYSQL_DATA_DIR = $unix->MYSQL_DATA_DIR();
$q->DELETE_DATABASE("zarafa");
if (!$q->ok) {
echo "Error while removing zarafa database...{$q->mysql_error}\n";
return;
}
if (!is_dir($MYSQL_DATA_DIR)) {
echo "Failed to locate {$MYSQL_DATA_DIR}\n";
return;
}
if (is_file("/etc/artica-postfix/ZARFA_FIRST_INSTALL")) {
@unlink("/etc/artica-postfix/ZARFA_FIRST_INSTALL");
}
$kill = $unix->find_program("kill");
$pidof = $unix->find_program("pidof");
$zarafa_server = $unix->find_program("zarafa-server");
shell_exec("{$kill} -9 `{$pidof} {$zarafa_server}` >/dev/null 2>&1");
echo "Starting zarafa..............: remove {$MYSQL_DATA_DIR}/ib_logfile*\n";
shell_exec("/bin/rm -f {$MYSQL_DATA_DIR}/ib_logfile*");
shell_exec("/bin/rm -f {$MYSQL_DATA_DIR}/ibdata*");
echo "Starting zarafa..............: remove {$MYSQL_DATA_DIR}/zarafa*\n";
shell_exec("/bin/rm -rf {$MYSQL_DATA_DIR}/zarafa");
echo "Starting zarafa..............: restart MySQL\n";
mysql_admin_mysql(1, "Restarting MySQL service...", null, __FILE__, __LINE__);
shell_exec("/etc/init.d/mysql restart --force --framework=" . __FILE__ . " >/tmp/zarafa_removedb 2>&1");
echo "Starting zarafa..............: restart Zarafa server\n";
shell_exec("/etc/init.d/zarafa-server restart >>/tmp/zarafa_removedb 2>&1");
$unix->send_email_events("Success removing zarafa databases", "removed {$MYSQL_DATA_DIR}/ib_logfile*\nremoved {$MYSQL_DATA_DIR}/ibdata*\nremoved {$MYSQL_DATA_DIR}/zarafa\n\n" . @file_get_contents("/tmp/zarafa_removedb"), "mailbox");
}
示例12: remove_host
function remove_host($hostname)
{
$freeweb = new freeweb($hostname);
if (is_dir("/var/www/{$hostname}")) {
shell_exec("/bin/rm -rf /var/www/{$hostname}");
}
if ($freeweb->IsGroupWareFromArtica()) {
$freeweb->delete();
return;
}
if ($freeweb->WebCopyID > 0) {
$freeweb->delete();
return;
}
$mysql_database = $freeweb->mysql_database;
$q = new mysql();
if ($q->DATABASE_EXISTS($mysql_database)) {
$q->DELETE_DATABASE($mysql_database);
}
if ($freeweb->groupware == "POWERADMIN") {
$freeweb->delete();
return;
}
if ($freeweb->groupware == "ARKEIA") {
$freeweb->delete();
return;
}
if ($freeweb->groupware == "UPDATEUTILITY") {
$freeweb->delete();
return;
}
if ($freeweb->groupware == "SARG") {
$freeweb->delete();
return;
}
if ($hostname == "_default_") {
$freeweb->delete();
return;
}
if ($freeweb->Forwarder == 0) {
$freeweb->delete();
return;
}
if (is_dir($freeweb->WORKING_DIRECTORY)) {
shell_exec("/bin/rm -rf {$freeweb->WORKING_DIRECTORY}");
}
$freeweb->delete();
}
示例13: build
function build()
{
$sock = new sockets();
$ArticaDBPath = $sock->GET_INFO("ArticaDBPath");
if ($ArticaDBPath == null) {
$ArticaDBPath = "/opt/articatech";
}
if (!is_dir("{$ArticaDBPath}/data/catz")) {
return;
}
$f[] = "[client] ";
$f[] = "#password\t= your_password ";
$f[] = "#port\t\t= 3306 ";
$f[] = "socket\t\t= /var/run/mysqld/articadb.sock ";
$f[] = " ";
$f[] = " ";
$f[] = "[mysqld] ";
$f[] = "#port\t\t= 3306 ";
$f[] = "socket\t\t= /var/run/mysqld/articadb.sock ";
$f[] = "skip-external-locking";
$f[] = "skip-networking ";
$f[] = "skip-innodb";
$f[] = "skip-slave-start";
$f[] = "default-storage-engine = MYISAM ";
$f[] = "default_tmp_storage_engine = MYISAM ";
$f[] = "key_buffer_size = 16M ";
$f[] = "max_allowed_packet = 1M ";
$f[] = "query_cache_type = 1";
$f[] = "query_cache_size = 35M";
$f[] = "max_heap_table_size=40M";
$f[] = "tmp_table_size=8M";
$f[] = "table_open_cache = 180 ";
$f[] = "sort_buffer_size = 256K ";
$f[] = "read_buffer_size = 1M ";
$f[] = "read_rnd_buffer_size = 256K ";
$f[] = "net_buffer_length = 128K ";
$f[] = "thread_stack = 128K ";
$f[] = "thread_cache_size=8";
$f[] = "table_open_cache=70";
$f[] = "max_connections=20";
$f[] = "server-id\t= 1 ";
$f[] = "#log-bin=mysql-bin ";
$f[] = "#binlog_format=mixed ";
$f[] = "#binlog_direct_non_transactional_updates=TRUE ";
$f[] = "tmpdir={$ArticaDBPath}/tmp";
$f[] = "open_files_limit=2048";
$f[] = " ";
$f[] = " ";
$f[] = "[mysqldump] ";
$f[] = "quick ";
$f[] = "max_allowed_packet = 16M ";
$f[] = " ";
$f[] = "[mysql] ";
$f[] = "no-auto-rehash ";
$f[] = "#safe-updates ";
$f[] = " ";
$f[] = "[myisamchk] ";
$f[] = "key_buffer_size = 8M ";
$f[] = "sort_buffer_size = 8M ";
$f[] = " ";
$f[] = "[mysqlhotcopy] ";
$f[] = "interactive-timeout ";
$f[] = "";
@file_put_contents("{$ArticaDBPath}/my.cnf", @implode("\n", $f));
@mkdir("{$ArticaDBPath}/mysql/etc", 0755, true);
@mkdir("{$ArticaDBPath}/tmp", 0755, true);
shell_exec("/bin/ln -sf {$ArticaDBPath}/data {$ArticaDBPath}/mysql/data");
shell_exec("/bin/ln -sf {$ArticaDBPath}/my.cnf {$ArticaDBPath}/mysql/etc/my.cnf");
@unlink("{$ArticaDBPath}/data/data");
$q = new mysql();
if ($q->DATABASE_EXISTS("catz")) {
$q->DELETE_DATABASE("catz");
}
echo "Starting......: " . date("H:i:s") . " ArticaDBst configuration done...\n";
}
示例14: rebuild_database
function rebuild_database($nollop = false)
{
$unix = new unix();
$MYSQL_DATA_DIR = $unix->MYSQL_DATA_DIR();
echo "Starting......: " . date("H:i:s") . " PowerDNS destroy database and recreate it\n";
$q = new mysql();
$q->DELETE_DATABASE("powerdns");
$rm = $unix->find_program("rm");
if (is_dir("{$MYSQL_DATA_DIR}/powerdns")) {
echo "Starting......: " . date("H:i:s") . " PowerDNS removing {$MYSQL_DATA_DIR}/powerdns\n";
shell_exec("{$rm} -rf {$MYSQL_DATA_DIR}/powerdns");
}
checkMysql($nollop);
shell_exec("/etc/init.d/artica-postfix restart pdns");
}
示例15: clean_events
function clean_events()
{
$q = new mysql();
$unix = new unix();
$rm = $unix->find_program("rm");
$nohup = $unix->find_program("nohup");
$TABLES = $q->LIST_TABLES_EVENTS_SYSTEM();
while (list($tablename, $line) = each($TABLES)) {
echo "DROP {$tablename}\n";
$q->QUERY_SQL("DROP TABLE `{$tablename}`", "artica_events");
}
$datadir = $unix->MYSQL_DATA_DIR();
shell_exec("{$rm} -f {$datadir}/artica_events/*.BAK");
if (is_dir("{$datadir}/syslogstore")) {
$q->DELETE_DATABASE("syslogstore");
shell_exec("{$rm} -f {$datadir}/syslogstore/*.BAK");
}
$files = $unix->DirFiles("{$datadir}/artica_events", "TaskSq[0-9]+\\.MYI");
while (list($file, $line) = each($files)) {
$file = str_replace(".MYI", "", $file);
$q->QUERY_SQL("DROP TABLE `{$file}`", "artica_events");
}
$q->QUERY_SQL("TRUNCATE TABLE `nmap_events`", "artica_events");
$q->QUERY_SQL("TRUNCATE TABLE `nmap_events`", "artica_events");
$q->QUERY_SQL("TRUNCATE TABLE `avgreports`", "artica_events");
$q->QUERY_SQL("TRUNCATE TABLE `events`", "artica_events");
$q->QUERY_SQL("TRUNCATE TABLE `dhcpd_logs`", "artica_events");
$q->QUERY_SQL("TRUNCATE TABLE `update_events`", "artica_events");
shell_exec("{$nohup} /etc/init.d/mysql restart --framework=" . __FILE__ . " >/dev/null 2>&1 &");
shell_exec($unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.mysql.start.php --engines --verbose --framework=" . __FILE__ . " 2>&1 &");
}