mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 15:19:56 +00:00
Added WeakRef as default extension
This commit is contained in:
parent
3729c5b603
commit
c15f05622e
@ -11,7 +11,7 @@ PHPNCURSES_VERSION="1.0.2"
|
||||
PTHREADS_VERSION="2.0.4"
|
||||
PHP_POCKETMINE_VERSION="0.0.4"
|
||||
UOPZ_VERSION="2.0.3"
|
||||
WEAKREF_VERSION="0.2.2"
|
||||
WEAKREF_VERSION="0.2.4"
|
||||
PHPYAML_VERSION="1.1.1"
|
||||
YAML_VERSION="0.1.4"
|
||||
LIBXML_VERSION="2.9.1"
|
||||
@ -527,11 +527,11 @@ fi
|
||||
#mv uopz-$UOPZ_VERSION "$DIR/install_data/php/ext/uopz"
|
||||
#echo " done!"
|
||||
|
||||
#WeakRef
|
||||
#echo -n "[PHP WeakRef] downloading $WEAKREF_VERSION..."
|
||||
#download_file "http://pecl.php.net/get/Weakref-$WEAKREF_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
|
||||
#mv Weakref-$WEAKREF_VERSION "$DIR/install_data/php/ext/weakref"
|
||||
#echo " done!"
|
||||
WeakRef
|
||||
echo -n "[PHP Weakref] downloading $WEAKREF_VERSION..."
|
||||
download_file "http://pecl.php.net/get/Weakref-$WEAKREF_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
|
||||
mv Weakref-$WEAKREF_VERSION "$DIR/install_data/php/ext/weakref"
|
||||
echo " done!"
|
||||
|
||||
#PHP YAML
|
||||
echo -n "[PHP YAML] downloading $PHPYAML_VERSION..."
|
||||
|
@ -333,11 +333,16 @@ namespace pocketmine {
|
||||
console("[ERROR] You have the native PocketMine extension, but your version is lower than 0.0.1.", true, true, 0);
|
||||
++$errors;
|
||||
}elseif(version_compare(phpversion("pocketmine"), "0.0.4") > 0){
|
||||
console("[ERROR] You have the native PocketMine extension, but your version is lower than 0.0.4.", true, true, 0);
|
||||
console("[ERROR] You have the native PocketMine extension, but your version is higher than 0.0.4.", true, true, 0);
|
||||
++$errors;
|
||||
}
|
||||
}
|
||||
|
||||
if(!extension_loaded("Weakref") and !extension_loaded("weakref")){
|
||||
console("[ERROR] Unable to find the Weakref extension.", true, true, 0);
|
||||
++$errors;
|
||||
}
|
||||
|
||||
if(!extension_loaded("curl")){
|
||||
console("[ERROR] Unable to find the cURL extension.", true, true, 0);
|
||||
++$errors;
|
||||
|
127
src/stubs/weakref.php
Normal file
127
src/stubs/weakref.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* WeakRef extension stub file for code completion purposes
|
||||
*
|
||||
* WARNING: Do not include this file
|
||||
*
|
||||
*/
|
||||
|
||||
class WeakRef{
|
||||
|
||||
/**
|
||||
* Constructs a new weak reference.
|
||||
*
|
||||
* @param object $object
|
||||
*/
|
||||
public function __construct($object = null){}
|
||||
|
||||
/**
|
||||
* Acquires a strong reference on that object,
|
||||
* virtually turning the weak reference into a strong one.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function acquire(){}
|
||||
|
||||
/**
|
||||
* Returns the object pointed to by the weak reference
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function get(){}
|
||||
|
||||
/**
|
||||
* Releases a previously acquired reference,
|
||||
* potentially turning a strong reference back into a weak reference.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function release(){}
|
||||
|
||||
/**
|
||||
* Checks whether the object referenced still exists
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function valid(){}
|
||||
}
|
||||
|
||||
class WeakMap implements Countable, ArrayAccess, Iterator{
|
||||
|
||||
/**
|
||||
* Constructs a new map
|
||||
*/
|
||||
public function __construct(){}
|
||||
|
||||
/**
|
||||
* Counts the number of live entries in the map
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count(){}
|
||||
|
||||
/**
|
||||
* Returns the current value being iterated on in the map.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function current(){}
|
||||
|
||||
/**
|
||||
* Returns the object serving as key in the map, at the current iterating position.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function key(){}
|
||||
|
||||
/**
|
||||
* Advances to the next map element.
|
||||
*/
|
||||
public function next(){}
|
||||
|
||||
/**
|
||||
* Checks whether the passed object is referenced in the map.
|
||||
*
|
||||
* @param object $object
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($object){}
|
||||
|
||||
/**
|
||||
* Returns the value pointed to by a certain object.
|
||||
*
|
||||
* @param object $object
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($object){}
|
||||
|
||||
/**
|
||||
* Updates the map with a new key-value pair.
|
||||
* If the key already existed in the map, the old value is replaced with the new.
|
||||
*
|
||||
* @param object $object
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($object, $value){}
|
||||
|
||||
/**
|
||||
* Removes an entry from the map.
|
||||
*
|
||||
* @param object $object
|
||||
*/
|
||||
public function offsetUnset($object){}
|
||||
|
||||
/**
|
||||
* Rewinds the iterator to the beginning of the map.
|
||||
*/
|
||||
public function rewind(){}
|
||||
|
||||
/**
|
||||
* Returns whether the iterator is still on a valid map element.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function valid(){}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user