mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Merge branch 'release/3.2'
This commit is contained in:
commit
83077309ef
@ -30,6 +30,7 @@ use pocketmine\Player;
|
|||||||
use pocketmine\scheduler\BulkCurlTask;
|
use pocketmine\scheduler\BulkCurlTask;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\timings\TimingsHandler;
|
use pocketmine\timings\TimingsHandler;
|
||||||
|
use pocketmine\utils\InternetException;
|
||||||
|
|
||||||
class TimingsCommand extends VanillaCommand{
|
class TimingsCommand extends VanillaCommand{
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ class TimingsCommand extends VanillaCommand{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$result = $this->getResult()[0];
|
$result = $this->getResult()[0];
|
||||||
if($result instanceof \RuntimeException){
|
if($result instanceof InternetException){
|
||||||
$sender->getServer()->getLogger()->logException($result);
|
$sender->getServer()->getLogger()->logException($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,12 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\scheduler;
|
namespace pocketmine\scheduler;
|
||||||
|
|
||||||
use pocketmine\utils\Internet;
|
use pocketmine\utils\Internet;
|
||||||
|
use pocketmine\utils\InternetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a consecutive list of cURL operations.
|
* Executes a consecutive list of cURL operations.
|
||||||
*
|
*
|
||||||
* The result of this AsyncTask is an array of arrays (returned from {@link Utils::simpleCurl}) or RuntimeException objects.
|
* The result of this AsyncTask is an array of arrays (returned from {@link Utils::simpleCurl}) or InternetException objects.
|
||||||
*
|
*
|
||||||
* @package pocketmine\scheduler
|
* @package pocketmine\scheduler
|
||||||
*/
|
*/
|
||||||
@ -54,7 +55,7 @@ class BulkCurlTask extends AsyncTask{
|
|||||||
foreach($operations as $op){
|
foreach($operations as $op){
|
||||||
try{
|
try{
|
||||||
$results[] = Internet::simpleCurl($op["page"], $op["timeout"] ?? 10, $op["extraHeaders"] ?? [], $op["extraOpts"] ?? []);
|
$results[] = Internet::simpleCurl($op["page"], $op["timeout"] ?? 10, $op["extraHeaders"] ?? [], $op["extraOpts"] ?? []);
|
||||||
}catch(\RuntimeException $e){
|
}catch(InternetException $e){
|
||||||
$results[] = $e;
|
$results[] = $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class Internet{
|
|||||||
try{
|
try{
|
||||||
list($ret, $headers, $httpCode) = self::simpleCurl($page, $timeout, $extraHeaders);
|
list($ret, $headers, $httpCode) = self::simpleCurl($page, $timeout, $extraHeaders);
|
||||||
return $ret;
|
return $ret;
|
||||||
}catch(\RuntimeException $ex){
|
}catch(InternetException $ex){
|
||||||
$err = $ex->getMessage();
|
$err = $ex->getMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ class Internet{
|
|||||||
CURLOPT_POSTFIELDS => $args
|
CURLOPT_POSTFIELDS => $args
|
||||||
]);
|
]);
|
||||||
return $ret;
|
return $ret;
|
||||||
}catch(\RuntimeException $ex){
|
}catch(InternetException $ex){
|
||||||
$err = $ex->getMessage();
|
$err = $ex->getMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user