Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  Download YaBB 2.5.2
You can download the newest version here
This Forum is now READ ONLY. For those who wish to participate in the development of YaBB 2.6 please go to YaBBForumSoftware, otherwise, go to YaBB Forum
  HomeHelpSearchLogin  
 
Page Index Toggle Pages: 1
Send Topic Print
Admin/Settings_Advanced.pl (Read 2157 times)
Dandello
YaBB Administrator
*****
Offline


YaBB 2.5.2 Rocks!

Posts: 630
The Land of YaBB
Gender: female
Admin/Settings_Advanced.pl
Sep 26th, 2012 at 6:44pm
 
This has been discussed over on YaBB Forum.

There's some code -specifically: Code:
my @disk_space = qx{df -k .};
map { $_ =~ s/ +/  /g } @disk_space; 


that causes some Server/Windows combinations to have issues with the whole of Settings_Advanced.pl

Now a tentative fix is for the people who have this issue to open that file and comment out those two lines.

A more user friendly fix would be something one the order of replacing those lines with Code:
if( $^O !~ /Win/ ) {@disk_space = qx{df -k .};
map { $_ =~ s/ +/  /g } @disk_space;
} 



And a more complete (but untested on touchy systems) would on the order of Code:
if( $^O =~ /Win/ ) {
      @x = qx{DIR /-C};
	my $lastline = pop(@x); # should look like: 17 Directory(s), 21305790464 Bytes free
	return -1 if $lastline !~ m/byte/i; # error trapping if output fails. The word byte should be in the line
	$lastline =~ /^\s+(\d+)\s+(.+?)\s+(\d+)\s+(.+?)\n$/;
	$FreeBytes = $3 - 100000; # 100000 bytes reserve
	if ($FreeBytes >= 1073741824) {
		$yyfreespace = sprintf("%.2f", $FreeBytes / (1024 * 1024 * 1024)) . " GB";
	} elsif ($FreeBytes >= 1048576) {
		$yyfreespace = sprintf("%.2f", $FreeBytes / (1024 * 1024)) . " MB";
	} else {
		$yyfreespace = sprintf("%.2f", $FreeBytes / 1024) . " KB";
	}
		@disk_space = $yyfreespace;
}
else {
	@disk_space = qx{df -k .};
	map { $_ =~ s/ +/  /g } @disk_space;
} 



Some of us think that Settings_Advanced -> Advanced not getting the free space figure from Windows when it does it for *nix, is a bug.
Wink

Oh, and I have tried it with Code:
@disk_space = qx{DIR /-C} 

for the Windows side and it's just ugly and way too much information - especially since we really only want the last line.
Back to top
 

The Administrator.
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print