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


PHP mysql::DATABASE_LIST方法代码示例

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


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

示例1: popup

function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $databases = $q->DATABASE_LIST();
    while (list($database, $line) = each($databases)) {
        $tbs = $tbs + $line[0];
        $tx = trim($line[1]);
        $re = explode(" ", $tx);
        $tsize = $re[0];
        $unit = $re[1];
        if ($unit == "KB") {
            $size = $size + $tsize;
        }
        if ($unit == "MB") {
            $tsize = intval($tsize) * 1024;
            $size = $size + $tsize;
        }
        if ($unit == "GB") {
            $tsize = intval($tsize) * 1024;
            $tsize = $tsize * 1024;
            $size = $size + $tsize;
        }
    }
    $text = $tpl->javascript_parse_text("{convertto_innodb_file_per_tableask}");
    $text = str_replace("%free", "{$size}", $text);
    $text = str_replace("%tablesnum", "{$tbs}", $text);
    $t = time();
    $html = "\n\t<center id='{$t}-div'></center>\n\t<div class=explain style='font-size:14px'>{convertto_innodb_file_per_table_text}</div>\n\t<div style='text-align:right;text-decoration:underline'><a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://www.mail-appliance.org/index.php?cID=278','1024','900');\" style='font-size:16px;'>{online_help}</a></div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td align='center' style='padding:10px'>" . button("{convertto_innodb_file_per_table}", "ConvertInnodb{$t}()", "18px") . "</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tvar x_ConvertInnodb{$t}= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tdocument.location.href='admin.index.php';\n\t\t\t\n\t\t}\n\t\n\t\tfunction ConvertInnodb{$t}(){\n\t\t\tif(confirm('{$text}')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('ConvertInnoDB','yes');\n\t\t\t\tAnimateDiv('{$t}-div');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ConvertInnodb{$t});\t\n\t\t\t}\t\t\n\t\t\n\t\t}\t\n\t\t\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:32,代码来源:zarafa.innodbfpt.php

示例2: page

function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $databases = $q->DATABASE_LIST();
    while (list($database, $line) = each($databases)) {
        $tbs = $tbs + $line[0];
        $tx = trim($line[1]);
        $re = explode("&nbsp;", $tx);
        $tsize = $re[0];
        $unit = $re[1];
        if ($unit == "KB") {
            $size = $size + $tsize;
        }
        if ($unit == "MB") {
            $tsize = intval($tsize) * 1024;
            $size = $size + $tsize;
        }
        if ($unit == "GB") {
            $tsize = intval($tsize) * 1024;
            $tsize = $tsize * 1024;
            $size = $size + $tsize;
        }
    }
    $text = $tpl->_ENGINE_parse_body("{INNODB_FILE_PER_TABLE_ASK}");
    $size = FormatBytes($size);
    $text = str_replace("%free", "<strong>{$size}</strong>", $text);
    $text = str_replace("%tablesnum", "<strong>{$tbs}</strong>", $text);
    $t = time();
    $html = "\n\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/database-connect-128.png'></td>\n\t\t<td valign='top' width=99% style='padding-left:20px'>\n\t\t<div style='font-size:18px;font-weight:bold'>InnoDB File per Table</div>\n\t\t<div id='{$t}-div'></div>\n\t\t<div style='font-size:14px'>{$text}</div>\n\t\t<div style='margin:10px;text-align:center'>" . button("{i_understand_continue}", "SaveContinue{$t}()", "18px") . "</div>\n\t\t<div style='margin:10px;text-align:center'>" . button("{convertto_innodb_file_per_table}", "ConvertInnodb{$t}()", "18px") . "</div>\n\t\t<div style='margin:10px;text-align:center'>\n\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://www.mail-appliance.org/index.php?cID=278','1024','900');\"\n\t\tstyle='font-size:18px;'>{online_help}</a>\n\t\t\n\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\tvar x_SaveContinue{$t}= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tdocument.location.href='admin.index.php';\n\t\t\t\n\t\t}\n\t\n\t\n\t\tfunction SaveContinue{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('InnoDBFilePerTableAsk','yes');\n\t\t\tAnimateDiv('{$t}-div');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveContinue{$t});\t\n\t\t}\n\t\t\n\t\tfunction ConvertInnodb{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ConvertInnoDB','yes');\n\t\t\tAnimateDiv('{$t}-div');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveContinue{$t});\t\t\t\n\t\t\n\t\t}\n\t\n\t</script>\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:33,代码来源:mysql.innodb.file.per.table.php

示例3: DATABASES_LIST

function DATABASES_LIST()
{
    $q = new mysql();
    $array = $q->DATABASE_LIST();
    if (!is_array($array)) {
        return MYSQL_NO_CONNECTIONS($q);
    }
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{database}</th>\n\t\t<th>{tables_number}</th>\n\t\t<th>{database_size}</th>\n\t</tr>";
    while (list($num, $ligne) = each($array)) {
        if ($ligne[0] == null) {
            $ligne[0] = "0";
        }
        $js = "LoadMysqlTables('{$num}');";
        $html = $html . "<tr " . CellRollOver($js) . ">\n\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td width=1% nowrap><code style='font-size:12px;font-weight:bold'>{$num}</code></td>\n\t\t<td width=1% nowrap><code style='font-size:12px;font-weight:bold'>{$ligne[0]}</code></td>\n\t\t<td width=80% nowrap><code style='font-size:12px;font-weight:bold'>{$ligne[1]}</code></td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    return $html;
}
开发者ID:brucewu16899,项目名称:artica,代码行数:18,代码来源:mysql.browse.php

示例4: backup_mysql_artica_backup

function backup_mysql_artica_backup($BaseWorkDir)
{
    $unix = new unix();
    $password = null;
    $mysqldump = $unix->find_program("mysqldump");
    $gzip = $unix->find_program("gzip");
    $sock = new sockets();
    $BackupArticaBackAllDB = intval($sock->GET_INFO("BackupArticaBackAllDB"));
    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;
    }
    $nice = $unix->EXEC_NICE();
    $q = new mysql();
    $LIST_TABLES_ARTICA_BACKUP = $q->LIST_TABLES_ARTICA_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} artica_backup");
    @mkdir("{$BaseWorkDir}/artica_backup", 0755, true);
    $c = 0;
    while (list($table_name, $val) = each($LIST_TABLES_ARTICA_BACKUP)) {
        $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/artica_backup/{$table_name}.gz";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$cmd}\n";
        }
        shell_exec($cmd);
        $c++;
    }
    $LIST_TABLES_ARTICA_SQUIDLOGS = $q->LIST_TABLES_ARTICA_SQUIDLOGS();
    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} squidlogs");
    @mkdir("{$BaseWorkDir}/squidlogs", 0755, true);
    $BLACKLIST["tables_day"] = true;
    $BLACKLIST["quotachecked"] = true;
    $BLACKLIST["cached_total"] = true;
    while (list($table_name, $val) = each($LIST_TABLES_ARTICA_SQUIDLOGS)) {
        if (preg_match("#[0-9]+#", $table_name)) {
            continue;
        }
        if (preg_match("#[0-9]+#", $table_name)) {
            continue;
        }
        if (preg_match("#^www_#", $table_name)) {
            continue;
        }
        if (preg_match("#^visited_#", $table_name)) {
            continue;
        }
        if (preg_match("#^youtube_#", $table_name)) {
            continue;
        }
        if (isset($BLACKLIST[$table_name])) {
            continue;
        }
        $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/squidlogs/{$table_name}.gz";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$cmd}\n";
        }
        shell_exec($cmd);
        $c++;
    }
    $LIST_TABLES_ARTICA_OCSWEB = $q->LIST_TABLES_ARTICA_OCSWEB();
    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} ocsweb");
    @mkdir("{$BaseWorkDir}/ocsweb", 0755, true);
    while (list($table_name, $val) = each($LIST_TABLES_ARTICA_OCSWEB)) {
        $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/ocsweb/{$table_name}.gz";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$cmd}\n";
        }
        shell_exec($cmd);
        $c++;
    }
    if ($BackupArticaBackAllDB == 1) {
        $DATABASE_LIST = $q->DATABASE_LIST();
        unset($DATABASE_LIST["squidlogs"]);
        unset($DATABASE_LIST["ocsweb"]);
        unset($DATABASE_LIST["artica_backup"]);
        unset($DATABASE_LIST["artica_events"]);
        unset($DATABASE_LIST["mysql"]);
        while (list($database, $val) = each($DATABASE_LIST)) {
            $prefix = trim("{$nice} {$mysqldump} --add-drop-table --single-transaction --force --insert-ignore -S /var/run/mysqld/mysqld.sock -u {$q->mysql_admin}{$password} {$database} | {$gzip} > {$BaseWorkDir}/DB_{$database}.gz");
            if ($GLOBALS["VERBOSE"]) {
                echo "{$prefix}\n";
            }
            shell_exec($prefix);
        }
    }
    system_admin_events("Artica Databases {$c} tables done\n", __FUNCTION__, __FILE__, __LINE__);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:99,代码来源:exec.backup.artica.php

示例5: popup

function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    $EnableMysqlOptimize = $sock->GET_INFO("EnableMysqlOptimize");
    $MysqlOptimizeSchedule = $sock->GET_INFO("MysqlOptimizeSchedule");
    if (!is_numeric("{$EnableMysqlOptimize}")) {
        $EnableMysqlOptimize = 0;
    }
    $ARRAY = unserialize(base64_decode($sock->GET_INFO("MysqlOptimizeDBS")));
    $html = "\n\t<div id='x_SaveDBEnableOptimize2ID'>\n\t<input type='hidden' id='MysqlOptimizeSchedule' value='{$MysqlOptimizeSchedule}'>\n\t<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t<td valign='top' width=1%>" . Paragraphe("database-restore-64.png", "{launch_optimize}", "{launch_optimize_text}", "javascript:Loadjs('{$page}?launch-opimize-js=yes')") . "</td>\n\t<td valign='top'><div class=explain>{mysql_defrag_explain}</div></td>\n\t</tr>\n\t</tbody>\n\t</table>\n\n\t<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend>{enable} : {mysql_defrag}:</td>\n\t\t<td>" . Field_checkbox("EnableMysqlOptimize", 1, $EnableMysqlOptimize, "EnableMysqlOptimizeSave()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{schedule}:</td>\n\t\t<td><input type=button OnClick=\"javascript:Loadjs('cron.php?field=MysqlOptimizeSchedule&function2=MysqlOptimizeScheduleUpdateForm');\" value='{browse}&nbsp;&raquo;&raquo;'></td>\n\t</tr>\t\n\t\n\t</table>\n\t</div>\n\t<div style='margin-top:10px;font-size:16px'>{databases}:</div>\n\t<table style='width:100%' class=form>\n\t";
    $DATABASE_LIST = $q->DATABASE_LIST();
    while (list($num, $ligne) = each($DATABASE_LIST)) {
        $jsdb[] = "if(!document.getElementById('EnableMysqlOptimize').checked){document.getElementById('database-{$num}').disabled=true;}else{document.getElementById('database-{$num}').disabled=false;}";
        $html = $html . "<tr>\n\t\t<td class=legend>{$num}:</td>\n\t\t<td>" . Field_checkbox("database-{$num}", 1, $ARRAY[$num], "SaveDBEnableOptimize('{$num}')") . "</td>\n\t</tr>\n\t";
    }
    $html = $html . "</tbody></table>\n<script>\n function EnableMysqlOptimizeCheck(){\n \t" . @implode("\n", $jsdb) . "\n \t\n \t}\n\tvar x_SaveDBEnableOptimize= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tEnableMysqlOptimizeCheck();\n\t}\n\n\tvar x_SaveDBEnableOptimize2= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tRefreshTab('main_config_mysql_optimize');\n\t}\t\n \t\n function SaveDBEnableOptimize(database){\n \tvar value=0;\n \tif(document.getElementById('database-'+database).checked){value=1;}else{value=0;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('value',value);\n\tXHR.appendData('dbname',database);\n\tXHR.sendAndLoad('{$page}', 'POST',x_SaveDBEnableOptimize); \t\n \n }\n \n function MysqlOptimizeScheduleUpdateForm(){\n  \t\tvar value=0;\n \t\tif(document.getElementById('EnableMysqlOptimize').checked){value=1;}else{value=0;}\n \t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('EnableMysqlOptimize',value);\n\t\tXHR.appendData('MysqlOptimizeSchedule',document.getElementById('MysqlOptimizeSchedule').value);\n\t\tAnimateDiv('x_SaveDBEnableOptimize2ID');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveDBEnableOptimize2); \n \n }\n \n function EnableMysqlOptimizeSave(){\n \t\tvar value=0;\n \t\tif(document.getElementById('EnableMysqlOptimize').checked){value=1;}else{value=0;}\n \t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('EnableMysqlOptimize',value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveDBEnableOptimize); \t \t\t\n }\n\nEnableMysqlOptimizeCheck(); \t\n </script>\n \n\n\n";
    echo $tpl->_ENGINE_parse_body($html);
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例6: maintenance

function maintenance($force = false)
{
    $unix = new unix();
    $time = $unix->file_time_min("/etc/artica-postfix/mysql.optimize.time");
    $time1 = time();
    $myisamchk = $unix->find_program("myisamchk");
    $mysqlcheck = $unix->find_program("mysqlcheck");
    $myisamchk = $unix->find_program("myisamchk");
    $pgrep = $unix->find_program("pgrep");
    exec("{$pgrep} -l -f \"{$myisamchk}\"", $results);
    while (list($index, $line) = each($results)) {
        if (preg_match("#pgrep#", $line)) {
            continue;
        }
        if (preg_match("#^[0-9]+\\s+#", $line)) {
            writelogs("{$line} already executed", @implode("\r\n", $results), __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    if (!$force) {
        if (!$GLOBALS["VERBOSE"]) {
            if ($time < 1440) {
                $unix->events("Maintenance on aborting {$time}Mn wait 1440Mn minimal");
                system_admin_events("Maintenance on aborting {$time}Mn wait 1440Mn minimal", __FUNCTION__, __FILE__, __LINE__, "mysql");
                return;
            }
        }
    }
    @unlink("/etc/artica-postfix/mysql.optimize.time");
    @file_put_contents("/etc/artica-postfix/mysql.optimize.time", "#");
    if (is_file($mysqlcheck)) {
        exec("{$mysqlcheck} -A -1 2>&1", $mysqlcheck_array);
        $mysqlcheck_logs = $mysqlcheck_logs . "\n" . @implode("\n", $mysqlcheck_array);
        unset($mysqlcheck_array);
    }
    $q = new mysql();
    $DATAS = $q->DATABASE_LIST();
    if ($GLOBALS["VERBOSE"]) {
        echo "Maintenance on " . count($DATAS) . " databases starting...\n";
    }
    while (list($db, $ligne) = each($DATAS)) {
        _repair_database($db);
    }
    $t2 = time();
    $time_duration = distanceOfTimeInWords($time1, $t2);
    system_admin_events("Maintenance on " . count($DATAS) . " databases done tool:{$time_duration}\nMysql Check events:{$mysqlcheck_logs}", __FUNCTION__, __FILE__, __LINE__, "mysql");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:47,代码来源:exec.mysql.build.php

示例7: DATABASES_LIST

function DATABASES_LIST()
{
    $q = new mysql();
    $array = $q->DATABASE_LIST();
    if (!is_array($array)) {
        return MYSQL_NO_CONNECTIONS($q);
    }
    $html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{database}</th>\n\t\t<th>{tables_number}</th>\n\t\t<th>{database_size}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    while (list($num, $ligne) = each($array)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        if ($ligne[0] == null) {
            $ligne[0] = "0";
        }
        $js = "LoadMysqlTables('{$num}');";
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/datasource-32.png'></td>\n\t\t\t<td width=1% nowrap><a href=\"javascript:blur();\" OnClick=\"{$js}\" style='font-size:16px;font-weight:bold;text-decoration:underline'>{$num}</code></td>\n\t\t\t<td width=1% nowrap><code style='font-size:16px;font-weight:bold'>{$ligne[0]}</code></td>\n\t\t\t<td width=80% nowrap><code style='font-size:16px;font-weight:bold'>{$ligne[1]}</code></td>\n\t\t</tr>";
    }
    $html = $html . "\n\t</tbody>\n\t</table>";
    return $html;
}
开发者ID:,项目名称:,代码行数:23,代码来源:


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