mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
Added new PHP YAML extension
This commit is contained in:
parent
d8f4e88e5d
commit
b481c94f45
@ -5,6 +5,7 @@ php:
|
||||
|
||||
before_script:
|
||||
- pecl install channel://pecl.php.net/pthreads-0.1.0
|
||||
- pecl install channel://pecl.php.net/yaml-1.1.1
|
||||
|
||||
script:
|
||||
- php src/tests/ServerSuiteTest.php --no-wizard
|
||||
|
@ -41,8 +41,9 @@ The entire server is done in PHP, and has been tested, profiled and optimized to
|
||||
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
|
||||
* __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__
|
||||
* __[PHP BCMath](http://php.net/manual/en/book.bc.php)__
|
||||
* __[PHP pthreads](https://github.com/krakjoe/pthreads)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
|
||||
* __[Spyc](https://github.com/mustangostang/spyc/blob/master/Spyc.php)__ by _[Vlad Andersen](https://github.com/mustangostang)_: A simple YAML loader/dumper class for PHP.
|
||||
* __[PHP pthreads](http://pthreads.org/)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
|
||||
* __[PHP YAML](https://code.google.com/p/php-yaml/)__ by _Bryan Davis_: The Yaml PHP Extension provides a wrapper to the LibYAML library.
|
||||
* __[LibYAML](http://pyyaml.org/wiki/LibYAML)__ by _Kirill Simonov_: A YAML 1.1 parser and emitter written in C.
|
||||
* __[mintty](https://code.google.com/p/mintty/)__ : xterm Terminal Emulator
|
||||
* __[cURL](http://curl.haxx.se/)__: cURL is a command line tool for transferring data with URL syntax
|
||||
* __[Zlib](http://www.zlib.net/)__: A Massively Spiffy Yet Delicately Unobtrusive Compression Library
|
||||
|
@ -7,6 +7,8 @@ ZEND_VM="GOTO"
|
||||
LIBEDIT_VERSION="0.3"
|
||||
ZLIB_VERSION="1.2.8"
|
||||
PTHREADS_VERSION="0.1.0"
|
||||
PHPYAML_VERSION="1.1.1"
|
||||
YAML_VERSION="0.1.4"
|
||||
CURL_VERSION="curl-7_34_0"
|
||||
|
||||
echo "[PocketMine] PHP installer and compiler for Linux & Mac"
|
||||
@ -205,6 +207,28 @@ wget http://pecl.php.net/get/pthreads-$PTHREADS_VERSION.tgz --no-check-certifica
|
||||
mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads"
|
||||
echo " done!"
|
||||
|
||||
#PHP YAML
|
||||
echo -n "[PHP YAML] downloading $PHPYAML_VERSION..."
|
||||
wget http://pecl.php.net/get/yaml-$PHPYAML_VERSION.tgz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||
mv yaml-$PHPYAML_VERSION "$DIR/install_data/php/ext/yaml"
|
||||
echo " done!"
|
||||
|
||||
#YAML
|
||||
echo -n "[YAML] downloading $YAML_VERSION..."
|
||||
wget http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||
mv yaml-$YAML_VERSION yaml
|
||||
echo -n " checking..."
|
||||
cd yaml
|
||||
RANLIB=$RANLIB ./configure --prefix="$DIR/install_data/php/ext/yaml" \
|
||||
--enable-static --disable-shared >> "$DIR/install.log" 2>&1
|
||||
echo -n " compiling..."
|
||||
make -j $THREADS >> "$DIR/install.log" 2>&1
|
||||
echo -n " installing..."
|
||||
make install >> "$DIR/install.log" 2>&1
|
||||
echo -n " cleaning..."
|
||||
cd ..
|
||||
rm -r -f ./yaml
|
||||
echo " done!"
|
||||
|
||||
echo -n "[PHP]"
|
||||
set +e
|
||||
@ -237,6 +261,7 @@ fi
|
||||
--with-curl="$HAVE_CURL" \
|
||||
--with-zlib="$DIR/install_data/php/ext/zlib" \
|
||||
--with-zlib-dir="$DIR/install_data/php/ext/zlib" \
|
||||
--with-yaml="$DIR/install_data/php/ext/yaml" \
|
||||
$HAVE_LIBEDIT \
|
||||
--disable-libxml \
|
||||
--disable-xml \
|
||||
|
@ -75,6 +75,11 @@ if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"")
|
||||
++$errors;
|
||||
}
|
||||
|
||||
if(!extension_loaded("yaml") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "yaml." . PHP_SHLIB_SUFFIX) === false){
|
||||
console("[ERROR] Unable to find the YAML extension.", true, true, 0);
|
||||
++$errors;
|
||||
}
|
||||
|
||||
if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){
|
||||
console("[ERROR] Unable to find the Zlib extension.", true, true, 0);
|
||||
++$errors;
|
||||
|
@ -87,6 +87,10 @@ class Config{
|
||||
$correct = $this->check();
|
||||
}
|
||||
|
||||
public function fixYAMLIndexes($str){
|
||||
return preg_replace("#^([ ]*)([a-zA-Z_]{1}[^\:]*)\:#m", "$1\"$2\":", $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param int $type
|
||||
@ -125,7 +129,8 @@ class Config{
|
||||
$this->config = @json_decode($content, true);
|
||||
break;
|
||||
case CONFIG_YAML:
|
||||
$this->config = Spyc::YAMLLoad($content);
|
||||
$content = $this->fixYAMLIndexes($content);
|
||||
$this->config = yaml_parse($content);
|
||||
break;
|
||||
case CONFIG_SERIALIZED:
|
||||
$this->config = @unserialize($content);
|
||||
@ -172,7 +177,7 @@ class Config{
|
||||
$content = json_encode($this->config, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING);
|
||||
break;
|
||||
case CONFIG_YAML:
|
||||
$content = Spyc::YAMLDump($this->config);
|
||||
$content = yaml_emit($this->config, YAML_UTF8_ENCODING);
|
||||
break;
|
||||
case CONFIG_SERIALIZED:
|
||||
$content = @serialize($this->config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user