GG.deals clone: CodeIgniter 4 + MongoDB game price tracker
- Full gg.deals-style UI: deal feed with filters, game pages with price history charts, rankings, vouchers, news, prepaids, subscriptions, bundles, franchises, wishlist, API docs - Real data crawlers: * gg:crawl (Steam Store API + GOG Catalog + Epic free games) * gg:catalog (252K game slugs from gg.deals sitemaps) * gg:ggdeals (per-game prices via FlareSolverr session, JSON-LD parsing) * gg:seed / gg:crawl-covers (demo seed + Steam CDN cover art) - 24/7 self-updating scheduler (scripts/scheduler_loop.php, lockfile-protected) - Tailwind v4 dark/light theme, Alpine.js, Chart.js
This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of CodeIgniter 4 framework.
|
||||
*
|
||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use CodeIgniter\Boot;
|
||||
use Config\Paths;
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* Sample file for Preloading
|
||||
*---------------------------------------------------------------
|
||||
* See https://www.php.net/manual/en/opcache.preloading.php
|
||||
*
|
||||
* How to Use:
|
||||
* 0. Copy this file to your project root folder.
|
||||
* 1. Set the $paths property of the preload class below.
|
||||
* 2. Set opcache.preload in php.ini.
|
||||
* php.ini:
|
||||
* opcache.preload=/path/to/preload.php
|
||||
*/
|
||||
|
||||
// Load the paths config file
|
||||
require __DIR__ . '/app/Config/Paths.php';
|
||||
|
||||
// Path to the front controller
|
||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
||||
|
||||
class preload
|
||||
{
|
||||
/**
|
||||
* @var array Paths to preload.
|
||||
*/
|
||||
private array $paths = [
|
||||
[
|
||||
'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation
|
||||
'exclude' => [
|
||||
// Not needed if you don't use them.
|
||||
'/system/Database/OCI8/',
|
||||
'/system/Database/Postgre/',
|
||||
'/system/Database/SQLite3/',
|
||||
'/system/Database/SQLSRV/',
|
||||
// Not needed for web apps.
|
||||
'/system/Database/Seeder.php',
|
||||
'/system/Test/',
|
||||
'/system/CLI/',
|
||||
'/system/Commands/',
|
||||
'/system/Publisher/',
|
||||
'/system/ComposerScripts.php',
|
||||
// Not Class/Function files.
|
||||
'/system/Config/Routes.php',
|
||||
'/system/Language/',
|
||||
'/system/bootstrap.php',
|
||||
'/system/util_bootstrap.php',
|
||||
'/system/rewrite.php',
|
||||
'/Views/',
|
||||
// Errors occur.
|
||||
'/system/ThirdParty/',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->loadAutoloader();
|
||||
}
|
||||
|
||||
private function loadAutoloader(): void
|
||||
{
|
||||
$paths = new Paths();
|
||||
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php';
|
||||
|
||||
Boot::preload($paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load PHP files.
|
||||
*/
|
||||
public function load(): void
|
||||
{
|
||||
foreach ($this->paths as $path) {
|
||||
$directory = new RecursiveDirectoryIterator($path['include']);
|
||||
$fullTree = new RecursiveIteratorIterator($directory);
|
||||
$phpFiles = new RegexIterator(
|
||||
$fullTree,
|
||||
'/.+((?<!Test)+\.php$)/i',
|
||||
RecursiveRegexIterator::GET_MATCH,
|
||||
);
|
||||
|
||||
foreach ($phpFiles as $key => $file) {
|
||||
foreach ($path['exclude'] as $exclude) {
|
||||
if (str_contains($file[0], $exclude)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
require_once $file[0];
|
||||
// Uncomment only for debugging (to inspect which files are included).
|
||||
// Never use this in production - preload scripts must not generate output.
|
||||
// echo 'Loaded: ' . $file[0] . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(new preload())->load();
|
||||
Reference in New Issue
Block a user