]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - Classes/class-checkup.php
5 * Does a complete checkup of the network.
9 public $num_of_problems = [
22 public $serverlist = [];
27 function __construct()
31 $this->serverlist
= $rpc->server()->getAll();
32 $this->chanmode_check();
33 $this->usermode_check();
34 //$this->module_check();
39 * Checks channel modes of servers against other servers
42 function chanmode_check() : void
44 foreach($this->serverlist
as $s) // cycle through each server
46 /* make a single string from the array of groups */
48 foreach ($s->server
->features
->chanmodes
as $set)
49 for ($i=0; isset($set[$i]); $i++
)
50 strcat($ourchmodes,$set[$i]);
52 /* take a look at every other server... yep, we do this for every server */
53 foreach ($this->serverlist
as $serv)
55 /* except for ourselves lol */
56 if ($serv->id
== $s->id
)
59 /* hmm if it's not unreal, skip it too */
60 if (!strstr($serv->server
->features
->software
,"UnrealIRCd"))
63 /* make a single string from the array of groups but for them this time */
65 foreach ($serv->server
->features
->chanmodes
as $set)
66 for ($i=0; isset($set[$i]); $i++
)
67 strcat($theirchmodes,$set[$i]);
69 /* check ours against theirs */
70 for ($i=0; isset($ourchmodes[$i]) && $m = $ourchmodes[$i]; $i++
)
72 /* if we have a mode that they don't have */
73 if (!strstr($theirchmodes, $m))
75 ++
$this->num_of_problems
['chanmodes'];
76 $this->problems
['chanmodes'][] = "Channel mode $m is present on $s->name but missing on $serv->name";
84 * Checks user modes of servers against other servers
87 function usermode_check() : void
89 /* make a single string from the array of groups */
90 $ourumodes = $s->server
->features
->usermodes
;
92 /* take a look at every other server... yep, we do this for every server */
93 foreach ($this->serverlist
as $serv)
95 /* except for ourselves lol */
96 if ($serv->id
== $s->id
)
99 /* hmm if it's not unreal, skip it too */
100 if (!strstr($serv->server
->features
->software
,"UnrealIRCd"))
103 $theirumodes = $serv->server
->features
->usermodes
;
105 /* check ours against theirs */
106 for ($i=0; isset($ourumodes[$i]) && $m = $ourumodes[$i]; $i++
)
108 /* if we have a mode that they don't have */
109 if (!strstr($theirumodes, $m))
111 ++
$this->num_of_problems
['usermodes'];
112 $this->problems
['usermodes'][] = "User mode $m is present on $s->name but missing on $serv->name";
119 * Checks modules of servers against other servers
122 function module_check() : void
127 foreach ($this->serverlist
as $serv)
128 $modlist[$serv->name
] = json_decode(json_encode($rpc->server()->module_list($serv->id
)->list), true);
130 echo highlight_string(var_export($modlist,true));