This commit is contained in:
Marcel Pociot
2020-06-15 23:54:51 +02:00
parent 7f459faaac
commit d8496bd433
6 changed files with 258 additions and 576 deletions

View File

@@ -24,6 +24,7 @@ use App\Http\RouteGenerator;
use App\Server\Http\Router;
use App\Server\SubdomainGenerator\RandomSubdomainGenerator;
use Clue\React\SQLite\DatabaseInterface;
use Phar;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use React\Socket\Server;
@@ -205,7 +206,14 @@ class Factory
{
app()->singleton(DatabaseInterface::class, function() {
$factory = new \Clue\React\SQLite\Factory($this->loop);
return $factory->openLazy(config('expose.admin.database', ':memory:'));
$options = ['worker_command' => Phar::running(false) ? Phar::running(false) . ' --sqlite-worker' : null];
return $factory->openLazy(
config('expose.admin.database', ':memory:'),
null,
$options,
);
});
return $this;

Binary file not shown.

View File

@@ -14,19 +14,20 @@
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pestphp/pest"
"url": "https://github.com/seankndy/reactphp-sqlite"
}
],
"require": {
"php": "^7.2.5",
"ext-json": "*"
"ext-json": "*",
"padraic/phar-updater": "^1.0.6"
},
"require-dev": {
"nikic/php-parser": "^4.4",
"cboden/ratchet": "^0.4.2",
"clue/block-react": "^1.3",
"clue/buzz-react": "^2.7",
"clue/reactphp-sqlite": "^1.0",
"clue/reactphp-sqlite": "dev-modular-worker-for-phar-support",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/psr7": "dev-master as 1.6.1",
"illuminate/http": "5.8.*|^6.0|^7.0",

801
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -131,7 +131,11 @@ return [
| if you enable authentication token validation.
|
*/
'database' => base_path('database/expose.db'),
'database' => implode(DIRECTORY_SEPARATOR, [
$_SERVER['HOME'] ?? __DIR__,
'.expose',
'expose.db'
]),
/*
|--------------------------------------------------------------------------

10
expose
View File

@@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php
use function Clue\React\SQLite\runWorker;
define('LARAVEL_START', microtime(true));
/*
@@ -17,6 +19,14 @@ define('LARAVEL_START', microtime(true));
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
$options = getopt(null, [
'sqlite-worker',
]);
if (isset($options['sqlite-worker'])) {
runWorker($_SERVER['argv'][2] ?? null);
exit;
}
$app = require_once __DIR__.'/bootstrap/app.php';
/*