mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Added demo mode 📺 (#1399)
* Added demo mode 📺 * Updated * Update main.php * Updated * Updated * Update admin_cron.php * Update admin_phpinfo.php * Updated * Update admin_forums.php * Update admin_extensions.php * Update admin_ug_auth.php * Update index.php * Update admin_phpinfo.php * Update admin_forums.php * Updated * Update admin_extensions.php * Update register.php * Updated * Update mysql.sql * Updated * Update demo_mode.php * Update demo_mode.php * Update demo_mode.php * Updated * Update demo_mode.php * Update demo_mode.php * Update demo_mode.php * Update demo_mode.php * Update mysql.sql * Update mysql.sql * Update demo_mode.php * Update admin_cron.php * Update admin_phpinfo.php * Revert "Update mysql.sql" This reverts commitd2ec089d8f
. * Revert "Update mysql.sql" This reverts commitdd7a584c47
. * Update mysql.sql * Update demo_mode.php * Updated * Update usercp_viewprofile.tpl * Update demo_mode.php * Update main.php * Update demo_mode.php * Updated * Update admin_cron.php * Update admin_cron.php * Update edit_user_profile.php * Update CHANGELOG.md * Update viewtopic.tpl * Update CHANGELOG.md
This commit is contained in:
parent
ab79ab9aea
commit
bf7fea1f20
22 changed files with 165 additions and 56 deletions
44
library/includes/cron/jobs/demo_mode.php
Normal file
44
library/includes/cron/jobs/demo_mode.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2024 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
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
set_time_limit(600);
|
||||
|
||||
global $cron_runtime_log;
|
||||
|
||||
$dump_path = BB_ROOT . 'install/sql/mysql.sql';
|
||||
|
||||
if (!IN_DEMO_MODE || !is_file($dump_path) || !is_readable($dump_path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean cache & datastore
|
||||
$datastore->clean();
|
||||
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
|
||||
CACHE($cache_name)->rm();
|
||||
}
|
||||
|
||||
// Drop tables & Insert sql dump
|
||||
$temp_line = '';
|
||||
foreach (file($dump_path) as $line) {
|
||||
if (str_starts_with($line, '--') || $line == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp_line .= $line;
|
||||
if (str_ends_with(trim($line), ';')) {
|
||||
if (!DB()->query($temp_line)) {
|
||||
$cron_runtime_log = date('Y-m-d H:i:s') . " -- Error performing query: " . $temp_line . " | " . DB()->sql_error()['message'] . "\n";
|
||||
}
|
||||
$temp_line = '';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue