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


PHP reindex函数代码示例

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


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

示例1: testReindex

 public function testReindex()
 {
     $iter = reindex('strtoupper', ['a', 'b', 'c', 'd', 'e']);
     $this->assertSame(['A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e'], toArrayWithKeys($iter));
     $iter = reindex(fn\operator('*', 2), [1, 2, 3, 4]);
     $this->assertSame([2 => 1, 4 => 2, 6 => 3, 8 => 4], toArrayWithKeys($iter));
 }
开发者ID:nikic,项目名称:iter,代码行数:7,代码来源:iterTest.php

示例2: get_indexes

function get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids)
{
    $arr = reindex(cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.2.1.25.3.3.1", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));
    $return_arr = array();
    $j = 0;
    for ($i = 0; $i < sizeof($arr); $i++) {
        if (ereg("^[0-9]+\$", $arr[$i])) {
            $return_arr[$j] = $j;
            $j++;
        }
    }
    return $return_arr;
}
开发者ID:songchin,项目名称:Cacti,代码行数:13,代码来源:query_host_cpu.php

示例3: get_indexes

function get_indexes($hostname, $snmp_community, $snmp_version)
{
    $arr = reindex(cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.2.1.25.3.3.1", $snmp_version, "", "", 161, 1000));
    $return_arr = array();
    $j = 0;
    for ($i = 0; $i < sizeof($arr); $i++) {
        if (ereg("^[0-9]+\$", $arr[$i])) {
            $return_arr[$j] = $j;
            $j++;
        }
    }
    return $return_arr;
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:13,代码来源:query_host_cpu.php

示例4: get_indexes

function get_indexes($hostname, $snmp_community, $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol) {
	$arr = reindex(cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.2.1.25.3.3.1", $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, 161, 1000));
	$return_arr = array();

	$j = 0;

	for ($i=0;($i<sizeof($arr));$i++) {
		if (is_numeric($arr[$i])) {
			$return_arr[$j] = $j;
			$j++;
		}
	}

	return $return_arr;
}
开发者ID:songchin,项目名称:Cacti,代码行数:15,代码来源:query_host_cpu.php

示例5: _submit


//.........这里部分代码省略.........
                            set_config('num_posts', $this->post_approved ? $config['num_posts'] + (1 + $post_data['topic_replies']) : $config['num_posts'] - (1 + $post_data['topic_replies']), true);
                        }
                    } else {
                        //reply
                        $sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : -1);
                        $sync->add('forum', $this->forum_id, 'forum_posts', $this->post_approved ? 1 : -1);
                    }
                }
                //update total posts
                if (!$is_first_post) {
                    set_config('num_posts', $this->post_approved ? $config['num_posts'] + 1 : $config['num_posts'] - 1, true);
                }
            }
            /*if($this->post_postcount != $post_data['post_postcount'] && $this->poster_id != ANONYMOUS)
            		{
            			//increase or decrease user_posts
            			$sync->add('user', $this->poster_id, 'user_posts', $this->post_approved ? 1 : -1);
            		}*/
            if ($this->poster_id != $post_data['poster_id'] || $this->post_postcount != $post_data['post_postcount']) {
                if ($post_data['post_postcount'] && $post_data['poster_id'] != ANONYMOUS) {
                    $sync->add('user', $post_data['poster_id'], 'user_posts', -1);
                }
                if ($this->post_postcount && $this->poster_id != ANONYMOUS) {
                    $sync->add('user', $this->poster_id, 'user_posts', 1);
                }
            }
            if ($is_first_post) {
                $sync->topic_first_post($this->topic_id);
            }
            if ($is_last_post) {
                $sync->topic_last_post($this->topic_id);
                $sync->forum_last_post($this->forum_id);
            }
            reindex('edit', $this->post_id, $sql_data['post_text'], $this->post_subject, $this->poster_id, $this->forum_id);
            $db->sql_transaction('commit');
        } elseif ($this->topic_id) {
            //reply
            $sql = "SELECT t.*, f.forum_name\n\t\t\t\t\tFROM " . TOPICS_TABLE . " t\n\t\t\t\t\tLEFT JOIN " . FORUMS_TABLE . " f ON (f.forum_id = t.forum_id)\n\t\t\t\t\tWHERE t.topic_id=" . intval($this->topic_id);
            $result = $db->sql_query($sql);
            $topic_data = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$topic_data) {
                trigger_error("topic_id={$this->topic_id}, but that topic does not exist", E_USER_ERROR);
            }
            //we need topic_id and forum_id
            $this->forum_id = $topic_data['forum_id'];
            $sql_data['forum_id'] = $this->forum_id;
            $sql_data['topic_id'] = $this->topic_id;
            //make sure we have a post_subject (empty subjects are bad for e.g. approving)
            if ($this->post_subject == '') {
                $this->post_subject = 'Re: ' . $topic_data['topic_title'];
            }
            $db->sql_transaction('begin');
            //insert post
            $sql = "INSERT INTO " . POSTS_TABLE . " " . $db->sql_build_array('INSERT', $sql_data);
            $db->sql_query($sql);
            $this->post_id = $db->sql_nextid();
            //update topic
            if (!$sync->new_topic_flag) {
                $sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : 0);
                $sync->add('topic', $this->topic_id, 'topic_replies_real', 1);
                $sync->set('topic', $this->topic_id, 'topic_bumped', 0);
                $sync->set('topic', $this->topic_id, 'topic_bumper', 0);
            } else {
                $sync->topic_first_post($this->topic_id);
                $sync->new_topic_flag = false;
开发者ID:gn36,项目名称:phpbb-oo-posting-api,代码行数:67,代码来源:functions_post_oo.php

示例6: reindex

<?php

/**
 * LICENSE: This source code is subject to the license that is available
 * in the LICENSE file distributed along with this package.
 *
 * @package    Penelope
 * @author     Matthew Caruana Galizia <mcg@karwana.com>
 * @copyright  Karwana Ltd
 * @since      File available since Release 1.0.0
 */
use Karwana\Penelope\Schema;
use Karwana\Penelope\Scripts\Reindexer;
function reindex(Schema $schema)
{
    $reindexer = new Reindexer($schema);
    $reindexer->run();
}
if (empty($argv[1])) {
    throw new \InvalidArgumentException('Missing initialization script path.');
}
require_once __DIR__ . '/Penelope/Reindexer.php';
require_once $argv[1];
if (!isset($schema)) {
    $schema = $penelope->getSchema();
}
reindex($schema);
开发者ID:karwana,项目名称:penelope,代码行数:27,代码来源:reindex.php

示例7: include

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileEncryptionCipher = ".1.3.6.1.4.1.14179.2.1.4.1.31";

$stationcipher = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnMobileEncryptionCipher, $snmp_version, "", "", 161, 1000));

$findStationCipherType= array_count_values($stationcipher);

$stationccmpaes=0;
$stationtkipmic=0;
$stationwep40=0;
$stationwep104=0;
$stationwep128=0;
$stationciphernone=0;
$stationciphernotavailable=0;
$stationcipherunknown=0;


if (array_key_exists('0', $findStationCipherType)) {
	$stationccmpaes=$findStationCipherType[0];
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:Cisco_WLC_Station_Cipher.php

示例8: folders

    exit;
}
if (isset($_GET["folder"])) {
    folders();
    exit;
}
if (isset($_GET["events"])) {
    events();
    exit;
}
if (isset($_GET["events-list"])) {
    events_list();
    exit;
}
if (isset($_GET["reindex"])) {
    reindex();
    exit;
}
if (isset($_GET["import-now"])) {
    importnow();
    exit;
}
if (isset($_GET["js-folder"])) {
    js_folder();
    exit;
}
js();
function checkrights()
{
    $users = new usersMenus();
    if ($users->AsSambaAdministrator) {
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:auditd.php

示例9: include

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileStationPolicyType = ".1.3.6.1.4.1.14179.2.1.4.1.30";

$stationpolicy = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnMobileStationPolicyType, $snmp_version, "", "", 161, 1000));

$findStationPolicyType= array_count_values($stationpolicy);

$stationpolicydot1x=0;
$stationpolicywpa1=0;
$stationpolicywpa2=0;
$stationpolicywpav2vff=0;
$stationpolicynotavailable=0;
$stationpolicyunknown=0;


if (array_key_exists('0', $findStationPolicyType)) {
	$stationpolicydot1x=$findStationPolicyType[0];
	}
if (array_key_exists('1', $findStationPolicyType)) {
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:Cisco_WLC_Station_Policy.php

示例10: include

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileStationStatus = ".1.3.6.1.4.1.14179.2.1.4.1.9";

$stationstatus = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnMobileStationStatus, $snmp_version, "", "", 161, 1000));

$findStationStatusType= array_count_values($stationstatus);

$stationidle=0;
$stationpending=0;
$stationauthenticated=0;
$stationassociated=0;
$stationpowersave=0;
$stationdisassociated=0;
$stationtobedeleted=0;
$stationprobing=0;
$stationblacklisted=0;


if (array_key_exists('0', $findStationStatusType)) {
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:Cisco_WLC_Station_Status.php

示例11: include

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnRogueAPEntry = ".1.3.6.1.4.1.14179.2.1.7.1.24";

$rogues = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnRogueAPEntry, $snmp_version, "", "", 161, 1000));

$sorted = array_count_values($rogues);

for ($i = 0; $i <= 10; $i++) {
	if (array_key_exists($i, $sorted)) {
	}
	else {
	$sorted[$i] = 0;}

}


print "reta:" . $sorted[0] . " retb:" . $sorted[1] . " retc:" . $sorted[2] . " retd:" . $sorted[3] . " rete:" . $sorted[4] . " retf:" . $sorted[5] . " retg:" . $sorted[6] . " reth:" . $sorted[7] . " reti:" . $sorted[8] . " retj:" . $sorted[9] . " retk:" . $sorted[10];

function reindex($arr) {
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:query_cisco4400_rogue_alerts.php

示例12: include

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");


$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileProtocol = ".1.3.6.1.4.1.14179.2.1.4.1.25";

$stationprotocol = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnMobileProtocol, $snmp_version, "", "", 161, 1000));

$findStationProtocolType= array_count_values($stationprotocol);

$stationdot11a=0;
$stationdot11b=0;
$stationdot11g=0;
$stationunknownprotocol=0;
$stationmobile=0;


if (array_key_exists('1', $findStationProtocolType)) {
	$stationdot11a=$findStationProtocolType[1];
	}
if (array_key_exists('2', $findStationProtocolType)) {
	$stationdot11b=$findStationProtocolType[2];
开发者ID:avillaverdec,项目名称:cacti,代码行数:30,代码来源:Cisco_WLC_Station_Protocol.php

示例13: include

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileStationCcxVersion = ".1.3.6.1.4.1.14179.2.1.4.1.33";

$stationccxversion = reindex(cacti_snmp_walk($hostname, $snmp_community, $bsnMobileStationCcxVersion, $snmp_version, "", "", 161, 1000));

$findStationccxversionType= array_count_values($stationccxversion);

$stationccxunsupported=0;
$stationccxv1=0;
$stationccxv2=0;
$stationccxv3=0;
$stationccxv4=0;
$stationccxv5=0;

if (array_key_exists('0', $findStationccxversionType)) {
	$stationccxunsupported=$findStationccxversionType[0];
	}
if (array_key_exists('1', $findStationccxversionType)) {
	$stationccxv1=$findStationccxversionType[1];
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:Cisco_WLC_Station_CCX.php

示例14: reindex

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];
$cmd = $_SERVER["argv"][4];

if ($cmd == "index") {
	$return_arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, "", "", "", 161, 1000));

	for ($i=0;($i<sizeof($return_arr));$i++) {
		print $return_arr[$i] . "\n";
	}
}elseif ($cmd == "query") {
	$arg = $_SERVER["argv"][5];

	$arr_index = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, "", "", "", 161, 1000));
	$arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, "", "", "", 161, 1000));

	for ($i=0;($i<sizeof($arr_index));$i++) {
		print $arr_index[$i] . "!" . $arr[$i] . "\n";
	}
}elseif ($cmd == "get") {
	$arg = $_SERVER["argv"][5];
	$index = $_SERVER["argv"][6];

	if (($arg == "total") || ($arg == "used")) {
		/* get hrStorageAllocationUnits from the snmp cache since it is faster */
		$host_id = db_fetch_cell("select id from host where hostname='$hostname' and snmp_community='$snmp_community'");
		$sau = db_fetch_cell("select field_value from host_snmp_cache where host_id=$host_id and field_name='hrStorageAllocationUnits' and snmp_index='$index'");

		print (cacti_snmp_get($hostname, $snmp_community, $oids[$arg] . ".$index", $snmp_version, "", "", "", 161, 1000) * $sau);
	}else{
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:query_host_partitions.php

示例15: reindex

$snmpv3_auth_protocol = $_SERVER["argv"][6];
$snmpv3_priv_passphrase = $_SERVER["argv"][7];
$snmpv3_priv_protocol = $_SERVER["argv"][8];
$cmd = $_SERVER["argv"][9];

if ($cmd == "index") {
	$return_arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, 161, 1000));

	for ($i=0;($i<sizeof($return_arr));$i++) {
		print $return_arr[$i] . "\n";
	}
}elseif ($cmd == "query") {
	$arg = $_SERVER["argv"][10];

	$arr_index = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, 161, 1000));
	$arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, 161, 1000));

	for ($i=0;($i<sizeof($arr_index));$i++) {
		print $arr_index[$i] . "!" . $arr[$i] . "\n";
	}
}elseif ($cmd == "get") {
	$arg = $_SERVER["argv"][10];
	$index = $_SERVER["argv"][11];

	if (($arg == "total") || ($arg == "used")) {
		/* get hrStorageAllocationUnits from the snmp cache since it is faster */
		$host_id = db_fetch_cell("select id from host where hostname='$hostname' and snmp_community='$snmp_community'");
		$sau = db_fetch_cell("select field_value from host_data_query_cache where host_id=$host_id and field_name='hrStorageAllocationUnits' and index_value='$index'");

		print (cacti_snmp_get($hostname, $snmp_community, $oids[$arg] . ".$index", $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmpv3_auth_protocol, $snmpv3_priv_passphrase, $snmpv3_priv_protocol, 161, 1000) * $sau);
	}else{
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:query_host_partitions.php


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