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>
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

spazz
Users
Users
Status: Offline
User theme: Dark
Posts: 13
Joined: Nov 16th, '15, 21: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?

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

spazz
Users
Users
Status: Offline
User theme: Dark
Posts: 13
Joined: Nov 16th, '15, 21: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 Nov 17th, '15, 22:44, edited 2 times in total.

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

spazz
Users
Users
Status: Offline
User theme: Dark
Posts: 13
Joined: Nov 16th, '15, 21: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"

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Antaka
Users
Users
Status: Offline
User theme: Dark
Posts: 8
Joined: Feb 2nd, '16, 06: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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Topic Author
dmzx
Founder
Founder
Status: Offline
User theme: Dark
Posts: 6483
Joined: Jan 13th, '14, 20:45
    Android Chrome

Re: System Info

Post by dmzx »

Antaka wrote: Aug 12th, '16, 06: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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Napster
Users
Users
Status: Offline
User theme: Dark
Posts: 25
Joined: Sep 15th, '15, 13: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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

martin
Admin
Admin
Status: Offline
User theme: Dark
Posts: 5116
Joined: Apr 6th, '14, 14: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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Napster
Users
Users
Status: Offline
User theme: Dark
Posts: 25
Joined: Sep 15th, '15, 13:35
    Windows 10 Firefox

Re: System Info

Post by Napster »

Ok thanks martin :thumbup:

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

kaspir
Users
Users
Status: Offline
User theme: Dark
Posts: 112
Joined: Aug 25th, '16, 10: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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Topic Author
dmzx
Founder
Founder
Status: Offline
User theme: Dark
Posts: 6483
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Re: System Info

Post by dmzx »

What host do you use?

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

kaspir
Users
Users
Status: Offline
User theme: Dark
Posts: 112
Joined: Aug 25th, '16, 10:50
    Windows 7 Firefox

Re: System Info

Post by kaspir »

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

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Solidjeuh
Users
Users
Status: Offline
User theme: Dark
Posts: 348
Joined: Dec 13th, '14, 01: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
----------------------------------------------------------------------------

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Topic Author
dmzx
Founder
Founder
Status: Offline
User theme: Dark
Posts: 6483
Joined: Jan 13th, '14, 20:45
    Windows 10 Chrome

Re: System Info

Post by dmzx »

Solidjeuh wrote: Oct 7th, '16, 16:23 Download is not working / offline.
Can you please re-upload?
Yes something strange :P
See first post.


Edit link works again

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Solidjeuh
Users
Users
Status: Offline
User theme: Dark
Posts: 348
Joined: Dec 13th, '14, 01:40
    Windows 10 Firefox

Re: System Info

Post by Solidjeuh »

dmzx wrote: Oct 7th, '16, 16:53
Solidjeuh wrote: Oct 7th, '16, 16: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!

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

kaspir
Users
Users
Status: Offline
User theme: Dark
Posts: 112
Joined: Aug 25th, '16, 10:50
    Windows 7 Firefox

Re: System Info

Post by kaspir »

kaspir wrote: Aug 27th, '16, 15:25
dmzx wrote: Aug 27th, '16, 13: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 Dec 24th, '16, 21:51, edited 1 time in total.