mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-30 17:17:22 +08:00
improve update
This commit is contained in:
@@ -43,25 +43,6 @@ class BonusRepository extends BaseRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initSeedPoints(): int
|
|
||||||
{
|
|
||||||
$size = 10000;
|
|
||||||
$tableName = (new User())->getTable();
|
|
||||||
$result = 0;
|
|
||||||
do {
|
|
||||||
$affectedRows = NexusDB::table($tableName)
|
|
||||||
->whereNull('seed_points')
|
|
||||||
->limit($size)
|
|
||||||
->update([
|
|
||||||
'seed_points' => NexusDB::raw('seed_points = seedbonus')
|
|
||||||
]);
|
|
||||||
$result += $affectedRows;
|
|
||||||
do_log("affectedRows: $affectedRows, query: " . last_query());
|
|
||||||
} while ($affectedRows > 0);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function consumeToBuyMedal($uid, $medalId): bool
|
public function consumeToBuyMedal($uid, $medalId): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1207,7 +1207,7 @@ if ($restrictemaildomain == 'yes'){
|
|||||||
$newEmail = trim(strtolower($newEmail));
|
$newEmail = trim(strtolower($newEmail));
|
||||||
$sql = sql_query("SELECT * FROM allowedemails") or sqlerr(__FILE__, __LINE__);
|
$sql = sql_query("SELECT * FROM allowedemails") or sqlerr(__FILE__, __LINE__);
|
||||||
$list = mysql_fetch_array($sql);
|
$list = mysql_fetch_array($sql);
|
||||||
$addresses = explode(' ', preg_replace("/[[:space:]]+/", " ", trim($list[value])) );
|
$addresses = explode(' ', preg_replace("/[[:space:]]+/", " ", trim($list['value'])) );
|
||||||
|
|
||||||
if(count($addresses) > 0)
|
if(count($addresses) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -539,12 +539,17 @@ class Install
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function runMigrate()
|
public function runMigrate($path = null)
|
||||||
{
|
{
|
||||||
if (!WITH_LARAVEL) {
|
if (!WITH_LARAVEL) {
|
||||||
throw new \RuntimeException('Laravel is not available.');
|
throw new \RuntimeException('Laravel is not available.');
|
||||||
}
|
}
|
||||||
$command = "php " . ROOT_PATH . "artisan migrate --force";
|
$command = "php " . ROOT_PATH . "artisan migrate";
|
||||||
|
if (!is_null($path)) {
|
||||||
|
$command .= " --path=$path";
|
||||||
|
} else {
|
||||||
|
$command .= " --force";
|
||||||
|
}
|
||||||
$result = exec($command, $output, $result_code);
|
$result = exec($command, $output, $result_code);
|
||||||
$this->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
$this->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
|
||||||
$this->doLog("output: " . json_encode($output));
|
$this->doLog("output: " . json_encode($output));
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ use App\Models\HitAndRun;
|
|||||||
use App\Models\Icon;
|
use App\Models\Icon;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Repositories\BonusRepository;
|
||||||
use App\Repositories\ExamRepository;
|
use App\Repositories\ExamRepository;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Nexus\Database\NexusDB;
|
use Nexus\Database\NexusDB;
|
||||||
|
|
||||||
@@ -126,15 +128,25 @@ class Update extends Install
|
|||||||
*
|
*
|
||||||
* attendance change, do migrate
|
* attendance change, do migrate
|
||||||
*/
|
*/
|
||||||
if (WITH_LARAVEL && VERSION_NUMBER == '1.6.0-beta9' && NexusDB::schema()->hasColumn('attendance', 'total_days')) {
|
if (WITH_LARAVEL && !NexusDB::schema()->hasColumn('attendance', 'total_days')) {
|
||||||
|
$this->runMigrate(database_path('migrations/2021_06_13_215440_add_total_days_to_attendance_table.php'));
|
||||||
$this->migrateAttendance();
|
$this->migrateAttendance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WITH_LARAVEL && version_compare(VERSION_NUMBER, '1.6.0-beta12', '>=')) {
|
/**
|
||||||
$this->addSetting('authority.torrent_hr', User::CLASS_ADMINISTRATOR);
|
* @since 1.6.0-beta13
|
||||||
$this->addSetting('bonus.cancel_hr', BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN);
|
*
|
||||||
$this->addSetting('hr.mode', HitAndRun::MODE_DISABLED);
|
* add seed points to user
|
||||||
|
*/
|
||||||
|
if (WITH_LARAVEL && !NexusDB::schema()->hasColumn('users', 'seed_points')) {
|
||||||
|
$this->runMigrate(database_path('migrations/2021_06_24_013107_add_seed_points_to_users_table.php'));
|
||||||
|
$result = $this->initSeedPoints();
|
||||||
|
$this->doLog("[INIT SEED POINTS], $result");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function migrateAttendance()
|
private function migrateAttendance()
|
||||||
@@ -248,4 +260,23 @@ class Update extends Install
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initSeedPoints(): int
|
||||||
|
{
|
||||||
|
$size = 10000;
|
||||||
|
$tableName = (new User())->getTable();
|
||||||
|
$result = 0;
|
||||||
|
do {
|
||||||
|
$affectedRows = NexusDB::table($tableName)
|
||||||
|
->whereNull('seed_points')
|
||||||
|
->limit($size)
|
||||||
|
->update([
|
||||||
|
'seed_points' => NexusDB::raw('seed_points = seedbonus')
|
||||||
|
]);
|
||||||
|
$result += $affectedRows;
|
||||||
|
$this->doLog("affectedRows: $affectedRows, query: " . last_query());
|
||||||
|
} while ($affectedRows > 0);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,9 +139,9 @@ if ($currentStep == 4) {
|
|||||||
while ($isPost) {
|
while ($isPost) {
|
||||||
try {
|
try {
|
||||||
$update->createSymbolicLinks($symbolicLinks);
|
$update->createSymbolicLinks($symbolicLinks);
|
||||||
$update->runMigrate();
|
|
||||||
$update->saveSettings($settings);
|
$update->saveSettings($settings);
|
||||||
$update->runExtraQueries();
|
$update->runExtraQueries();
|
||||||
|
$update->runMigrate();
|
||||||
$update->nextStep();
|
$update->nextStep();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
require "../include/bittorrent.php";
|
require "../include/bittorrent.php";
|
||||||
dbconn();
|
dbconn();
|
||||||
require_once(get_langfile_path());
|
require_once(get_langfile_path());
|
||||||
loggedinorreturn();
|
//loggedinorreturn();
|
||||||
|
|
||||||
stdhead($lang_faq['head_faq']);
|
stdhead($lang_faq['head_faq']);
|
||||||
$Cache->new_page('faq', 900, true);
|
$Cache->new_page('faq', 900, true);
|
||||||
@@ -61,7 +61,7 @@ if (isset($faq_categ)) {
|
|||||||
if ($faq_categ[$id]['flag'] == "1")
|
if ($faq_categ[$id]['flag'] == "1")
|
||||||
{
|
{
|
||||||
print("<ul><li><a href=\"#id". $faq_categ[$id]['link_id'] ."\"><b>". $faq_categ[$id]['title'] ."</b></a><ul>\n");
|
print("<ul><li><a href=\"#id". $faq_categ[$id]['link_id'] ."\"><b>". $faq_categ[$id]['title'] ."</b></a><ul>\n");
|
||||||
if (array_key_exists("items", $faq_categ[$id]))
|
if (array_key_exists("items", $faq_categ[$id]))
|
||||||
{
|
{
|
||||||
foreach ($faq_categ[$id]['items'] as $id2 => $temp)
|
foreach ($faq_categ[$id]['items'] as $id2 => $temp)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -344,7 +344,7 @@ if ($showstats_main == "yes")
|
|||||||
if (!$Cache->get_page()){
|
if (!$Cache->get_page()){
|
||||||
$Cache->add_whole_row();
|
$Cache->add_whole_row();
|
||||||
$registered = number_format(get_row_count("users"));
|
$registered = number_format(get_row_count("users"));
|
||||||
$unverified = number_format(get_row_count("users", "WHERE status='pending'"));
|
$unverified = number_format(get_row_count("users", "WHERE status='pending' and enabled='yes'"));
|
||||||
$totalonlinetoday = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 86400)))));
|
$totalonlinetoday = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 86400)))));
|
||||||
$totalonlineweek = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 604800)))));
|
$totalonlineweek = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 604800)))));
|
||||||
$VIP = number_format(get_row_count("users", "WHERE class=".UC_VIP));
|
$VIP = number_format(get_row_count("users", "WHERE class=".UC_VIP));
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
require "../include/bittorrent.php";
|
require "../include/bittorrent.php";
|
||||||
dbconn();
|
dbconn();
|
||||||
require_once(get_langfile_path());
|
require_once(get_langfile_path());
|
||||||
loggedinorreturn();
|
//loggedinorreturn();
|
||||||
stdhead($lang_rules['head_rules']);
|
stdhead($lang_rules['head_rules']);
|
||||||
$Cache->new_page('rules', 900, true);
|
$Cache->new_page('rules', 900, true);
|
||||||
if (!$Cache->get_page())
|
if (!$Cache->get_page())
|
||||||
|
|||||||
Reference in New Issue
Block a user