Made Zlib required

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-26 13:21:58 +01:00
parent d1d720e9ef
commit ac0fab8f0b
3 changed files with 11 additions and 13 deletions

View File

@ -36,6 +36,8 @@ The entire server is done in PHP, and has been tested, profiled and optimized to
* __[PHP cURL](http://php.net/manual/en/book.curl.php)__ * __[PHP cURL](http://php.net/manual/en/book.curl.php)__
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__ * __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
* __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__ * __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__
* __[PHP GMP](http://php.net/manual/en/book.gmp.php)__
* __[PHP Zlib](http://php.net/manual/en/book.zlib.php)__
* __[PHP pthreads](https://github.com/krakjoe/pthreads)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything. * __[PHP pthreads](https://github.com/krakjoe/pthreads)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
* __[PHP NBT](https://github.com/TheFrozenFire/PHP-NBT-Decoder-Encoder/blob/master/nbt.class.php)__ by _[TheFrozenFire](https://github.com/TheFrozenFire)_: Class for reading in NBT-format files (modified to handle Little-Endian files). * __[PHP NBT](https://github.com/TheFrozenFire/PHP-NBT-Decoder-Encoder/blob/master/nbt.class.php)__ by _[TheFrozenFire](https://github.com/TheFrozenFire)_: Class for reading in NBT-format files (modified to handle Little-Endian files).
* __[Math_BigInteger](http://phpseclib.sourceforge.net/math/intro.html)__ by _[phpseclib](http://phpseclib.sourceforge.net/)_: Pure-PHP arbitrary precission integer arithmetic library * __[Math_BigInteger](http://phpseclib.sourceforge.net/math/intro.html)__ by _[phpseclib](http://phpseclib.sourceforge.net/)_: Pure-PHP arbitrary precission integer arithmetic library

View File

@ -59,7 +59,7 @@ class ChunkParser{
} }
public function loadFile($file){ public function loadFile($file){
if(ZLIB_EXTENSION === true and file_exists($file.".gz")){ if(file_exists($file.".gz")){
$this->raw = gzinflate(file_get_contents($file.".gz")); $this->raw = gzinflate(file_get_contents($file.".gz"));
$r = @gzinflate($this->raw); $r = @gzinflate($this->raw);
if($r !== false and $r != ""){ if($r !== false and $r != ""){
@ -169,7 +169,6 @@ class ChunkParser{
} }
flock($fp, LOCK_UN); flock($fp, LOCK_UN);
fclose($fp); fclose($fp);
if(ZLIB_EXTENSION === true){
$original = filesize($this->file); $original = filesize($this->file);
file_put_contents($this->file .".gz", gzdeflate(gzdeflate(file_get_contents($this->file),9),9)); //Double compression for flat maps file_put_contents($this->file .".gz", gzdeflate(gzdeflate(file_get_contents($this->file),9),9)); //Double compression for flat maps
$compressed = filesize($this->file .".gz"); $compressed = filesize($this->file .".gz");
@ -178,7 +177,6 @@ class ChunkParser{
@unlink($this->file); @unlink($this->file);
} }
} }
}
public function getFloor($x, $z){ public function getFloor($x, $z){
$X = $x >> 4; $X = $x >> 4;

View File

@ -77,10 +77,8 @@ if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"")
} }
if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){ if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find Zlib extension. Compressed worlds won't be loaded", true, true, 0); console("[ERROR] Unable to find Zlib extension", true, true, 0);
define("ZLIB_EXTENSION", false); ++$errors;
}else{
define("ZLIB_EXTENSION", true);
} }
if($errors > 0){ if($errors > 0){