Skip to content

Commit

Permalink
Fix webhost support
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Dec 18, 2024
1 parent 9f3de19 commit a93d11b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Magic.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
namespace danog\MadelineProto;

use Amp\DeferredFuture;
use Amp\File\Driver\BlockingFilesystemDriver;
use Amp\File\Driver\EioFilesystemDriver;
use Amp\File\Driver\UvFilesystemDriver;
use Amp\SignalException;
use danog\MadelineProto\TL\Conversion\Extension;
use phpseclib3\Math\BigInteger;
Expand All @@ -36,6 +39,8 @@
use const SIG_DFL;
use const SIGINT;
use const SIGTERM;

use function Amp\File\filesystem;
use function Amp\Log\hasColorSupport;
use function function_exists;

Expand Down Expand Up @@ -227,6 +232,18 @@ public static function start(bool $light): void
\define('AMP_WORKER', 1);
}
if (!self::$initedLight) {
// Setup file driver
$driver = EventLoop::getDriver();

if (UvFilesystemDriver::isSupported($driver)) {
$driver = new UvFilesystemDriver($driver);
} elseif (EioFilesystemDriver::isSupported()) {
$driver = new EioFilesystemDriver($driver);
} else {
$driver = new BlockingFilesystemDriver();
}
filesystem($driver);

// Setup error reporting
Shutdown::init();
set_error_handler(Exception::exceptionErrorHandler(...));
Expand Down

0 comments on commit a93d11b

Please sign in to comment.