-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt for upstream laravel structure
- Loading branch information
Showing
174 changed files
with
6,642 additions
and
11,839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
|
||
/** | ||
* Register the Closure based commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
// protected function commands() | ||
// { | ||
// require base_path('routes/console.php'); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Register The Auto Loader | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Composer provides a convenient, automatically generated class loader | ||
| for our application. We just need to utilize it! We'll require it | ||
| into the script here so that we do not have to worry about the | ||
| loading of any our classes "manually". Feels great to relax. | ||
| | ||
*/ | ||
|
||
require __DIR__.'/bootstrap/autoload.php'; | ||
//require_once __DIR__.'/library/config.php'; | ||
//require_once __DIR__.'/common.php'; | ||
$app = require_once __DIR__.'/bootstrap/app.php'; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Run The Artisan Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| When we run the console application, the current CLI command will be | ||
| executed in this console and the response sent back to a terminal | ||
| or another output device for the developers. Here goes nothing! | ||
| | ||
*/ | ||
|
||
/* @var App\Console\Kernel $kernel */ | ||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); | ||
|
||
$status = $kernel->handle( | ||
$input = new Symfony\Component\Console\Input\ArgvInput, | ||
new Symfony\Component\Console\Output\ConsoleOutput | ||
); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Shutdown The Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Once Artisan has finished running, we will fire off the shutdown events | ||
| so that any final work may be done by the application before we shut | ||
| down the process. This is the last thing to happen to the request. | ||
| | ||
*/ | ||
|
||
$kernel->terminate($input, $status); | ||
|
||
exit($status); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
<?php | ||
/** | ||
* TorrentPier – Bull-powered BitTorrent tracker engine | ||
* | ||
* @copyright Copyright (c) 2005-2017 TorrentPier (https://torrentpier.com) | ||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository | ||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License | ||
*/ | ||
|
||
use Dotenv\Dotenv; | ||
use Dotenv\Exception\InvalidPathException; | ||
use Illuminate\Cache\CacheManager; | ||
use Illuminate\Config\Repository; | ||
use Illuminate\Container\Container; | ||
use Illuminate\Database\Capsule\Manager; | ||
use Illuminate\Database\Events\StatementPrepared; | ||
use Illuminate\Events\Dispatcher; | ||
use Illuminate\Filesystem\Filesystem; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\Translation\FileLoader; | ||
use Illuminate\Translation\Translator; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
try { | ||
(new Dotenv(__DIR__.'/..'))->load(); | ||
} catch (InvalidPathException $e) { | ||
throw $e; | ||
} | ||
|
||
/* | ||
* Create The Application | ||
* @var Application $app | ||
*/ | ||
$app = new Application( | ||
realpath(__DIR__.'/../') | ||
); | ||
//$app = new Container(); | ||
//Container::setInstance($app); | ||
//$app->instance('app', $app); | ||
//$app->instance(Container::class, $app); | ||
|
||
$app->singleton( | ||
Illuminate\Contracts\Console\Kernel::class, | ||
// in future to overrive use | ||
App\Console\Kernel::class | ||
// Illuminate\Foundation\Console\Kernel::class | ||
); | ||
|
||
$app->singleton( | ||
Illuminate\Contracts\Debug\ExceptionHandler::class, | ||
// in future to override use | ||
//App\Exceptions\Handler::class | ||
Illuminate\Foundation\Exceptions\Handler::class | ||
); | ||
|
||
/** | ||
* Service Container | ||
* @var Container $container | ||
*/ | ||
//$container = new Container; | ||
//Container::setInstance($container); | ||
|
||
/** | ||
* Events | ||
*/ | ||
$app->instance('events', new Dispatcher); | ||
|
||
/** | ||
* Database | ||
*/ | ||
$app->singleton('db', function ($app) { | ||
/** @var Manager $capsule */ | ||
$capsule = new Manager; | ||
|
||
$capsule->addConnection([ | ||
'driver' => 'mysql', | ||
'host' => env('DB_HOST', 'localhost'), | ||
'database' => env('DB_DATABASE', 'torrentpier'), | ||
'username' => env('DB_USERNAME', 'root'), | ||
'password' => env('DB_PASSWORD', 'pass'), | ||
'charset' => 'utf8mb4', | ||
'collation' => 'utf8mb4_unicode_ci', | ||
'prefix' => '', | ||
'strict' => true, | ||
]); | ||
|
||
$capsule->setEventDispatcher($app['events']); | ||
$capsule->setAsGlobal(); | ||
$capsule->bootEloquent(); | ||
|
||
return $capsule; | ||
}); | ||
$app->instance(Manager::class, $app->make('db')); | ||
|
||
/** | ||
* Database setFetchMode | ||
* @var Dispatcher $dispatcher | ||
*/ | ||
$dispatcher = $app->make('events'); | ||
$dispatcher->listen(StatementPrepared::class, function ($event) { | ||
$event->statement->setFetchMode(PDO::FETCH_ASSOC); | ||
}); | ||
|
||
/** | ||
* Request | ||
*/ | ||
$app->instance('request', Illuminate\Http\Request::capture()); | ||
|
||
/** | ||
* Filesystem | ||
*/ | ||
$app->instance('files', new Filesystem); | ||
|
||
/** | ||
* Config | ||
*/ | ||
$app->singleton('config', function () { | ||
/** @var Repository $config */ | ||
$config = new Repository; | ||
|
||
$files = []; | ||
|
||
$configPath = __DIR__ . '/config'; | ||
|
||
/** @noinspection ForeachSourceInspection */ | ||
foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { | ||
/** @var \SplFileInfo $file */ | ||
$configFile = $file->getRealPath(); | ||
$files[basename($configFile, '.php')] = $configFile; | ||
} | ||
|
||
foreach ($files as $key => $path) { | ||
if ($key === 'tp') { | ||
// if (!$cfg = OLD_CACHE('bb_config')->get('config_bb_config')) { | ||
$cfg = []; | ||
foreach (Manager::table('bb_config')->get()->toArray() as $row) { | ||
$cfg[$row['config_name']] = $row['config_value']; | ||
} | ||
// } | ||
/** @noinspection PhpIncludeInspection */ | ||
$config->set($key, array_merge(require $path, $cfg)); | ||
} else { | ||
/** @noinspection PhpIncludeInspection */ | ||
$config->set($key, require $path); | ||
} | ||
} | ||
|
||
$config->set('cache', [ | ||
'default' => 'file', | ||
'stores' => [ | ||
'file' => [ | ||
'driver' => 'file', | ||
'path' => $config->get('tp.cache.db_dir'), | ||
], | ||
], | ||
]); | ||
|
||
return $config; | ||
}); | ||
|
||
/** | ||
* Cache | ||
*/ | ||
$app->singleton('cache', function ($app) { | ||
/** @var CacheManager $cache */ | ||
$cache = new CacheManager($app); | ||
|
||
return $cache->driver(); | ||
}); | ||
|
||
/** | ||
* Localization | ||
*/ | ||
$app->singleton('translator', function ($app) { | ||
$loader = $app['translation.loader']; | ||
$locale = $app['config']['app.locale']; | ||
|
||
$trans = new Translator($loader, $locale); | ||
|
||
$trans->setFallback($app['config']['app.fallback_locale']); | ||
|
||
return $trans; | ||
}); | ||
|
||
$app->singleton('translation.loader', function ($app) { | ||
return new FileLoader($app['files'], __DIR__ . '/resources/lang'); | ||
}); | ||
|
||
return $app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
define('LARAVEL_START', microtime(true)); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Register The Composer Auto Loader | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Composer provides a convenient, automatically generated class loader | ||
| for our application. We just need to utilize it! We'll require it | ||
| into the script here so we do not have to manually load any of | ||
| our application's PHP classes. It just feels great to relax. | ||
| | ||
*/ | ||
|
||
require __DIR__.'/../vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.