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


PHP openqrm_get_db_connection函数代码示例

本文整理汇总了PHP中openqrm_get_db_connection函数的典型用法代码示例。如果您正苦于以下问题:PHP openqrm_get_db_connection函数的具体用法?PHP openqrm_get_db_connection怎么用?PHP openqrm_get_db_connection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: openqrm_puppet_cloud_product

function openqrm_puppet_cloud_product($cmd, $cloud_hook_config)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    global $RootDir;
    $openqrm_server = new openqrm_server();
    $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Handling " . $cmd . " event", "", "", 0, 0, 0);
    switch ($cmd) {
        case "add":
            $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Handling cloud-product " . $cmd . " event", "", "", 0, 0, 0);
            // create application products
            $next_sort_id = 0;
            $db = openqrm_get_db_connection();
            $puppet = new puppet();
            $puppet_group_array = $puppet->get_available_groups();
            foreach ($puppet_group_array as $index => $puppet_app) {
                $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Adding application " . $puppet_app . " as cloud-product", "", "", 0, 0, 0);
                $cloud_product_id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
                $create_application_cloudselector_config = "insert into cloud_selector (id, type, sort_id, quantity, price, name, description, state) VALUES (" . $cloud_product_id . ", 'application', " . $next_sort_id . ", 'puppet/" . $puppet_app . "', 1, '" . $puppet_app . "', '" . $puppet_app . " via puppet', 1);";
                $recordSet = $db->Execute($create_application_cloudselector_config);
                $next_sort_id++;
            }
            break;
        case "remove":
            $cloud_product_class = $RootDir . "/plugins/cloud/class/cloudselector.class.php";
            if (file_exists($cloud_product_class)) {
                require_once $cloud_product_class;
                $cloud_selector = new cloudselector();
                $cloud_selector_id_ar = $cloud_selector->get_all_ids();
                foreach ($cloud_selector_id_ar as $key => $value) {
                    $id = $value['id'];
                    $cloud_selector->get_instance_by_id($id);
                    $pos = strpos($cloud_selector->quantity, 'puppet/');
                    if ($pos !== false) {
                        $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Removing application " . $cloud_selector->quantity . " from cloud-products", "", "", 0, 0, 0);
                        $cloud_selector->remove($id);
                    }
                }
            }
            break;
    }
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:44,代码来源:openqrm-puppet-cloud-product-hook.php

示例2: get_ip_address

 function get_ip_address()
 {
     global $RESOURCE_INFO_TABLE;
     global $event;
     $db = openqrm_get_db_connection();
     $rs = $db->Execute("select resource_openqrmserver from {$RESOURCE_INFO_TABLE} where resource_id=0");
     if (!$rs) {
         $event->log("get_ip_address", $_SERVER['REQUEST_TIME'], 2, "openqrm_server.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$rs->EOF) {
             $resource_openqrmserver = $rs->fields["resource_openqrmserver"];
             $rs->MoveNext();
         }
     }
     if (!strlen($resource_openqrmserver)) {
         $event->log("get_ip_address", $_SERVER['REQUEST_TIME'], 2, "openqrm_server.class.php", "Could not find out IP-Address of the openQRM server. Server misconfiguration!", "", "", 0, 0, 0);
     }
     return $resource_openqrmserver;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:19,代码来源:openqrm_server.class.php

示例3: display_overview

 function display_overview($offset, $limit, $sort, $order)
 {
     global $CLOUD_MATRIX_TABLE;
     global $event;
     $db = openqrm_get_db_connection();
     $recordSet = $db->SelectLimit("select * from {$CLOUD_MATRIX_TABLE} order by {$sort} {$order}", $limit, $offset);
     $cloudmatrix_array = array();
     if (!$recordSet) {
         $event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "cloudmatrix.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$recordSet->EOF) {
             array_push($cloudmatrix_array, $recordSet->fields);
             $recordSet->MoveNext();
         }
         $recordSet->Close();
     }
     return $cloudmatrix_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:18,代码来源:cloudmatrix.class.php

示例4: display_overview

 function display_overview($offset, $limit, $sort, $order, $mode = null)
 {
     switch ($mode) {
         case '':
         case 'all':
             $sql = "select * from " . $this->_db_table . " order by " . $sort . " " . $order;
             break;
         case 'error':
             $sql = "select * from " . $this->_db_table . " where event_priority < 4 and event_status <> 1 order by " . $sort . " " . $order;
             break;
         case 'acknowledge':
             $sql = "select * from " . $this->_db_table . " where event_status = 1 order by " . $sort . " " . $order;
             break;
         case 'warning':
             $sql = "select * from " . $this->_db_table . " where event_priority = 4 and event_status <> 1 order by " . $sort . " " . $order;
             break;
         case 'active':
             $sql = "select * from " . $this->_db_table . " where event_priority = 9 and event_status <> 1 order by " . $sort . " " . $order;
             break;
     }
     $db = openqrm_get_db_connection();
     $recordSet = $db->SelectLimit($sql, $limit, $offset);
     $event_array = array();
     if (!$recordSet) {
         $this->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "event.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$recordSet->EOF) {
             array_push($event_array, $recordSet->fields);
             $recordSet->MoveNext();
         }
         $recordSet->Close();
     }
     return $event_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:34,代码来源:event.class.php

示例5: nagios3_services

    case 'init':
        // this command creates the following tables
        // -> nagios3_services
        // nagios3_service_id BIGINT
        // nagios3_service_name VARCHAR(50)
        // nagios3_service_port VARCHAR(50)
        // nagios3_service_type VARCHAR(50)
        // nagios3_service_description VARCHAR(255)
        $create_nagios3_service_table = "create table nagios3_services(nagios3_service_id BIGINT, nagios3_service_name VARCHAR(50), nagios3_service_port VARCHAR(50), nagios3_service_type VARCHAR(50), nagios3_service_description VARCHAR(255))";
        // -> nagios3_hosts
        // nagios3_host_id BIGINT
        // nagios3_appliance_id BIGINT
        // nagios3_appliance_services VARCHAR(255)
        $create_nagios3_host_table = "create table nagios3_hosts(nagios3_host_id BIGINT, nagios3_appliance_id BIGINT, nagios3_appliance_services VARCHAR(255))";
        $db = openqrm_get_db_connection();
        $recordSet = $db->Execute($create_nagios3_service_table);
        $recordSet = $db->Execute($create_nagios3_host_table);
        $db->Close();
        break;
    case 'uninstall':
        $drop_nagios3_service_table = "drop table nagios3_services";
        $drop_nagios3_host_table = "drop table nagios3_hosts";
        $db = openqrm_get_db_connection();
        $recordSet = $db->Execute($drop_nagios3_service_table);
        $recordSet = $db->Execute($drop_nagios3_host_table);
        $db->Close();
        break;
    default:
        $event->log("{$nagios3_command}", $_SERVER['REQUEST_TIME'], 3, "nagios3-action", "No such event command ({$nagios3_command})", "", "", 0, 0, 0);
        break;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:nagios3-action.php

示例6: get_id_by_cr

 function get_id_by_cr($cr_id)
 {
     $list = array();
     $query = 'SELECT ca_id FROM ' . $this->_db_table . ' WHERE ca_cr_id="' . $cr_id . '"';
     $db = openqrm_get_db_connection();
     $rs = $db->Execute($query);
     if (is_object($rs)) {
         while (!$rs->EOF) {
             $list[] = $rs->fields;
             $rs->MoveNext();
         }
         return $list[0]['ca_id'];
     }
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:14,代码来源:cloudappliance.class.php

示例7: display_overview

 function display_overview($offset, $limit, $sort, $order)
 {
     global $IMAGE_AUTHENTICATION_TABLE;
     global $event;
     $db = openqrm_get_db_connection();
     $recordSet = $db->SelectLimit("select * from {$IMAGE_AUTHENTICATION_TABLE} order by {$sort} {$order}", $limit, $offset);
     $image_authentication_array = array();
     if (!$recordSet) {
         $event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$recordSet->EOF) {
             array_push($image_authentication_array, $recordSet->fields);
             $recordSet->MoveNext();
         }
         $recordSet->Close();
     }
     return $image_authentication_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:18,代码来源:image_authentication.class.php

示例8: set_wizard

 function set_wizard($username, $wizardname, $step, $id)
 {
     $db = openqrm_get_db_connection();
     $sql = "update " . $this->_user_table . " set user_wizard_name='" . $wizardname . "',  user_wizard_step=" . $step . ",user_wizard_id=" . $id . " where user_name='" . $username . "'";
     $rs = $db->Execute($sql);
     return $rs;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:7,代码来源:dummyuser.class.php

示例9: get_deployment_ids

 function get_deployment_ids()
 {
     $deployment_array = array();
     $query = "select deployment_id from {$this->_db_table}";
     $db = openqrm_get_db_connection();
     $rs = $db->Execute($query);
     if (!$rs) {
         $event->log("get_deployment_ids", $_SERVER['REQUEST_TIME'], 2, "deployment.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$rs->EOF) {
             $deployment_array[] = $rs->fields;
             $rs->MoveNext();
         }
     }
     return $deployment_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:16,代码来源:deployment.class.php

示例10: remove_by_section

 function remove_by_section($section)
 {
     $db = openqrm_get_db_connection();
     $rs = $db->Execute("delete from " . $this->db_name . " where lock_section='{$section}'");
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:5,代码来源:lock.class.php

示例11: find_resource

 function find_resource($search)
 {
     global $RESOURCE_INFO_TABLE;
     global $event;
     $db = openqrm_get_db_connection();
     // replace glob wildcards with sql wildcards
     $search = str_replace('_', '\\_', $search);
     $search = str_replace('%', '\\%', $search);
     $search = str_replace('?', '_', $search);
     $search = str_replace('*', '%', $search);
     $sql = 'SELECT * FROM ' . $RESOURCE_INFO_TABLE;
     $sql .= ' WHERE resource_id LIKE ?';
     $sql .= ' OR resource_hostname LIKE ?';
     $sql .= ' OR resource_mac LIKE ?';
     // handle sql injection
     $sql = $db->db->Prepare($sql);
     $recordSet = $db->db->Execute($sql, array($search, $search, $search));
     $resource_array = array();
     if (!$recordSet) {
         $event->log("find_resource", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$recordSet->EOF) {
             array_push($resource_array, $recordSet->fields);
             $recordSet->MoveNext();
         }
         $recordSet->Close();
     }
     return $resource_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:29,代码来源:resource.class.php

示例12: remove_by_type

 function remove_by_type($type)
 {
     global $VIRTUALIZATION_INFO_TABLE;
     $db = openqrm_get_db_connection();
     $rs = $db->Execute("delete from {$VIRTUALIZATION_INFO_TABLE} where virtualization_type='{$type}'");
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:6,代码来源:virtualization.class.php

示例13: openqrm_db_get_result

function openqrm_db_get_result($query)
{
    $ar = array();
    $db = openqrm_get_db_connection();
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    $result = $db->Execute($query);
    if (is_object($result)) {
        while ($arr = $result->FetchRow()) {
            $tmp = array();
            foreach ($arr as $key => $val) {
                if (is_string($key)) {
                    $tmp[] = array("value" => $val, "label" => $key);
                }
            }
            $ar[] = $tmp;
        }
    }
    return $ar;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:19,代码来源:openqrm-database-functions.php

示例14: get_all_ids

 function get_all_ids()
 {
     global $AUTH_BLOCKER_TABLE;
     global $event;
     $authblocker_list = array();
     $query = "select ab_id from " . $this->_db_table;
     $db = openqrm_get_db_connection();
     $rs = $db->Execute($query);
     if (!$rs) {
         $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "authblocker.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$rs->EOF) {
             $authblocker_list[] = $rs->fields;
             $rs->MoveNext();
         }
     }
     return $authblocker_list;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:18,代码来源:authblocker.class.php

示例15: display_overview

 function display_overview($offset, $limit, $sort, $order)
 {
     global $KERNEL_INFO_TABLE;
     $db = openqrm_get_db_connection();
     $recordSet = $db->SelectLimit("select * from {$KERNEL_INFO_TABLE} where kernel_id > 0 order by {$sort} {$order}", $limit, $offset);
     $kernel_array = array();
     if (!$recordSet) {
         $this->__event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
     } else {
         while (!$recordSet->EOF) {
             array_push($kernel_array, $recordSet->fields);
             $recordSet->MoveNext();
         }
         $recordSet->Close();
     }
     return $kernel_array;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:17,代码来源:kernel.class.php


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