3.1 & 3.2 Extensions Database 3.1 / 3.2System Info

<span class="qte-attr qte_31_32-qte">3.1.x &amp; 3.2.x</span>
User avatar

spazz
Users
Users
Posts: 13
Joined: 16 Nov 2015, 22:46
    Windows 7 Firefox

Re: System Info

Post by spazz »

Working on Windows compatibility for this. Where should I submit it? Here as a rar and only the file I change?

User avatar

spazz
Users
Users
Posts: 13
Joined: 16 Nov 2015, 22:46
    Windows 7 Firefox

Re: System Info

Post by spazz »

Ok I'll just put the code in here.
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'],
		));
	}
language/en/common.php
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.

User avatar

spazz
Users
Users
Posts: 13
Joined: 16 Nov 2015, 22:46
    Windows 7 Firefox

Re: System Info

Post by spazz »

I don't think it is possible to grab a average load for Windows. So I just made it "Current Load"

User avatar

Antaka
Users
Users
Posts: 8
Joined: 02 Feb 2016, 07:03
    Windows 7 Firefox

Re: System Info

Post by Antaka »

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

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6466
Joined: 13 Jan 2014, 21:45
    Android Chrome

Re: System Info

Post by dmzx »

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
Thanks!

[ Post made via Samsung Galaxy S4 ] Image

User avatar

Napster
Users
Users
Posts: 25
Joined: 15 Sep 2015, 15:35
    Windows 10 Firefox

Re: System Info

Post by Napster »

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

User avatar

martin
Admin
Admin
Posts: 5105
Joined: 06 Apr 2014, 16:12
    Windows 10 Chrome

Re: System Info

Post by martin »

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.
Image

User avatar

Napster
Users
Users
Posts: 25
Joined: 15 Sep 2015, 15:35
    Windows 10 Firefox

Re: System Info

Post by Napster »

Ok thanks martin :thumbup:

User avatar

kaspir
Users
Users
Posts: 112
Joined: 25 Aug 2016, 12:50
    Windows 7 Firefox

Re: System Info

Post by kaspir »

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?
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6466
Joined: 13 Jan 2014, 21:45
    Windows 10 Firefox

Re: System Info

Post by dmzx »

What host do you use?

User avatar

kaspir
Users
Users
Posts: 112
Joined: 25 Aug 2016, 12:50
    Windows 7 Firefox

Re: System Info

Post by kaspir »

dmzx wrote: 27 Aug 2016, 15:34 What host do you use?
Sorry I left that out, Siteground. (Did I make an unwise host decision? lol)

User avatar

Solidjeuh
Donator
Donator
Posts: 348
Joined: 13 Dec 2014, 02:40
    Windows 10 Firefox

Re: System Info

Post by Solidjeuh »

Download is not working / offline.
Can you please re-upload?
Forum voor NL Extensie vertalingen ---> https://www.supportforum.be
----------------------------------------------------------------------------

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6466
Joined: 13 Jan 2014, 21:45
    Windows 10 Chrome

Re: System Info

Post by dmzx »

Solidjeuh wrote: 07 Oct 2016, 18:23 Download is not working / offline.
Can you please re-upload?
Yes something strange :P
See first post.


Edit link works again

User avatar

Solidjeuh
Donator
Donator
Posts: 348
Joined: 13 Dec 2014, 02:40
    Windows 10 Firefox

Re: System Info

Post by Solidjeuh »

dmzx wrote: 07 Oct 2016, 18:53
Solidjeuh wrote: 07 Oct 2016, 18:23 Download is not working / offline.
Can you please re-upload?
Yes something strange :P
See first post.


Edit link works again
:rolling: Thank you!

User avatar

kaspir
Users
Users
Posts: 112
Joined: 25 Aug 2016, 12:50
    Windows 7 Firefox

Re: System Info

Post by kaspir »

kaspir wrote: 27 Aug 2016, 17:25
dmzx wrote: 27 Aug 2016, 15:34 What host do you use?
Sorry I left that out, Siteground. (Did I make an unwise host decision? lol)
I got this working now. Unsure how, doesn't matter.. wish I could explain.. :mml:
Last edited by kaspir on 24 Dec 2016, 22:51, edited 1 time in total.

Post Reply Previous topicNext topic