Move Internet-related functions from Utils into their own class (#2324)

- Added `Internet::getIP()`, `Internet::getURL()`, `Internet::postURL()`, and `Internet::simpleCurl()`.
- Deprecated the corresponding functions in `Utils`. Updating to the new functions is as simple as replacing `Utils` with `Internet`, since this doesn't break backwards compatibility.

The deprecations should be catered for by plugin developers. These deprecated redirects will be removed no later than 4.0.0.
This commit is contained in:
Dylan K. Taylor
2018-07-25 15:51:18 +01:00
committed by GitHub
parent 951870e6ec
commit 706c620d04
9 changed files with 211 additions and 117 deletions

View File

@ -27,7 +27,7 @@ namespace pocketmine\updater;
use pocketmine\scheduler\AsyncTask;
use pocketmine\Server;
use pocketmine\utils\Utils;
use pocketmine\utils\Internet;
class UpdateCheckTask extends AsyncTask{
@ -45,7 +45,7 @@ class UpdateCheckTask extends AsyncTask{
public function onRun(){
$error = "";
$response = Utils::getURL($this->endpoint . "?channel=" . $this->channel, 4, [], $error);
$response = Internet::getURL($this->endpoint . "?channel=" . $this->channel, 4, [], $error);
$this->error = $error;
if($response !== false){