本文整理匯總了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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
示例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);
示例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];
示例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) {
示例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)) {
示例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)) {
示例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) {
示例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];
示例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];
示例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{
示例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{