3.1 & 3.2 Extensions Database 3.1 / 3.2 ⇒ System Info
-
- Users
- Posts: 13
- Joined: 16 Nov 2015, 22:46
Re: System Info
Working on Windows compatibility for this. Where should I submit it? Here as a rar and only the file I change?
-
- Users
- Posts: 13
- Joined: 16 Nov 2015, 22:46
Re: System Info
Ok I'll just put the code in here.
This will need translation to other languages. I only know English.
event/listener.php
language/en/common.php
This will need translation to other languages. I only know English.
event/listener.php
Find and select entire function This may be a partial find and not the whole line
Code: Select all
public function main($event)
Replace with Replace the preceding lines with the following
Code: Select all
public function main($event)
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
// Time calculations
$winstats = shell_exec("net statistics server");
$findtime_begin = "Statistics since";
$findtime_pos_begin = strpos($winstats, $findtime_begin) + strlen($findtime_begin) + 1;
$findtime_end = "Sessions accepted";
$findtime_pos_end = strpos($winstats, $findtime_end) - 3;
$findtime_size = $findtime_pos_end - $findtime_pos_begin;
$system_start_time = strtotime(substr($winstats, $findtime_pos_begin, $findtime_size));
$uptimeindex = time() - $system_start_time;
// Load calculations
exec('typeperf -sc 1 "\Processor(*)\% Processor Time"',$result);
for ($i = 0; trim($result[$i]) == ''; $i++) continue;
$parts = explode(',',$result[++$i]);
$load[1] = (is_numeric($load[1] = trim(trim(array_pop($parts)),'"\''))) ? number_format((float)($load[1]), 2, '.', '') . '%' : 'Unavailable';
}
else
{
$uptimeindex = shell_exec("cut -d. -f1 /proc/uptime");
$load = sys_getloadavg();
}
$daysindex = floor($uptimeindex/60/60/24);
$hoursindex = $uptimeindex/60/60%24;
$minsindex = $uptimeindex/60%60;
$secsindex = $uptimeindex%60;
$os = php_uname('s') . ' ' . php_uname('r');
$this->template->assign_vars(array(
'UPTIME_DAYS' => $daysindex,
'UPTIME_HOURS' => $hoursindex,
'UPTIME_MINS' => $minsindex,
'UPTIME_SECS' => $secsindex,
'AVG_LOAD0' => $load[0],
'AVG_LOAD1' => $load[1],
'AVG_LOAD2' => $load[2],
'PHP_OS' => $os,
'BOARD_VERSION' => $this->config['version'],
));
}
Find This may be a partial find and not the whole line
Code: Select all
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
Add after Add these lines on a new blank line after the preceding line(s) to find
Code: Select all
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
$systemload = 'Current load:';
}
else
{
$systemload = 'Average load:';
}
Find This may be a partial find and not the whole line
Code: Select all
'SYSTEM_LOAD' => 'Average load:',
Replace with Replace the preceding lines with the following
Code: Select all
'SYSTEM_LOAD' => $systemload,
Last edited by spazz on 17 Nov 2015, 23:44, edited 2 times in total.
-
- Users
- Posts: 13
- Joined: 16 Nov 2015, 22:46
Re: System Info
I don't think it is possible to grab a average load for Windows. So I just made it "Current Load"
-
- Users
- Posts: 8
- Joined: 02 Feb 2016, 07:03
Re: System Info
Hi dmzx
I offer you the French translation for the version of your extension v1.0.0
https://github.com/TakaMockingjay/syste ... anguage/fr
Have a good day
I offer you the French translation for the version of your extension v1.0.0
https://github.com/TakaMockingjay/syste ... anguage/fr
Have a good day
-
- Founder
- Posts: 6466
- Joined: 13 Jan 2014, 21:45
Re: System Info
Thanks!Antaka wrote: 12 Aug 2016, 08:44 hi dmzx
I offer you the French translation for the version of your extension v1.0.0
https://github.com/TakaMockingjay/syste ... anguage/fr
Have a good day
[ Post made via Samsung Galaxy S4 ]

-
- Users
- Posts: 25
- Joined: 15 Sep 2015, 15:35
Re: System Info
Just installed and getting this error...
Code: Select all
[phpBB Debug] PHP Warning: in file [ROOT]/ext/dmzx/systeminfo/event/listener.php on line 43: shell_exec() has been disabled for security reasons
-
- Admin
- Posts: 5105
- Joined: 06 Apr 2014, 16:12
Re: System Info
Your host has shell_exec( turned off or your on windows server but chances are your linux and host has it off you need to ask them to turn it on.

-
- Users
- Posts: 112
- Joined: 25 Aug 2016, 12:50
Re: System Info
Hey dmzx! I've got about 8 of your extensions so far and like'em all!
I'm not getting any errors, ext was installed correctly. It's just, it's not displaying server uptime?!
I got the PBtech skin.
[img]http://i68.tinypic.com/2pyp91d.png[/img]
If it's due to the shell_exec() being disabled, then I've just sent a ticket in to my host asking them, and awaiting response.
Best regards!
Edit// I actually got a response from my host. And for security, they will not enable shell_exec on a shared server. :(
Any other ideas?
I'm not getting any errors, ext was installed correctly. It's just, it's not displaying server uptime?!
I got the PBtech skin.
[img]http://i68.tinypic.com/2pyp91d.png[/img]
If it's due to the shell_exec() being disabled, then I've just sent a ticket in to my host asking them, and awaiting response.
Best regards!
Edit// I actually got a response from my host. And for security, they will not enable shell_exec on a shared server. :(
Any other ideas?
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads.
-
- Users
- Posts: 112
- Joined: 25 Aug 2016, 12:50
Re: System Info
Sorry I left that out, Siteground. (Did I make an unwise host decision? lol)
-
- Donator
- Posts: 348
- Joined: 13 Dec 2014, 02:40
Re: System Info
Download is not working / offline.
Can you please re-upload?
Can you please re-upload?
Forum voor NL Extensie vertalingen ---> https://www.supportforum.be
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-
- Founder
- Posts: 6466
- Joined: 13 Jan 2014, 21:45
Re: System Info
Yes something strange
See first post.
Edit link works again
-
- Users
- Posts: 112
- Joined: 25 Aug 2016, 12:50
Re: System Info
I got this working now. Unsure how, doesn't matter.. wish I could explain..

Last edited by kaspir on 24 Dec 2016, 22:51, edited 1 time in total.