This repository has been archived by the owner on Apr 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcallbacks.php
63 lines (55 loc) · 1.95 KB
/
callbacks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
require __DIR__.'/src/Utils/helpers.php';
return [
App\Events\PluginWasEnabled::class => function () {
if (! Schema::hasTable('uuid')) {
Schema::create('uuid', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('uuid', 255);
});
}
if (! Schema::hasTable('ygg_log')) {
Schema::create('ygg_log', function ($table) {
$table->increments('id');
$table->string('action');
$table->integer('user_id');
$table->integer('player_id');
$table->string('parameters')->default('');
$table->string('ip')->default('');
$table->dateTime('time');
});
}
$items = [
'ygg_uuid_algorithm' => 'v3',
'ygg_token_expire_1' => '259200', // 3 days
'ygg_token_expire_2' => '604800', // 7 days
'ygg_rate_limit' => '1000',
'ygg_skin_domain' => '',
'ygg_search_profile_max' => '5',
'ygg_private_key' => '',
'ygg_show_config_section' => 'true',
'ygg_show_activities_section' => 'true',
'ygg_enable_ali' => 'true'
];
foreach ($items as $key => $value) {
if (! Option::get($key)) {
Option::set($key, $value);
}
}
$originalDefaultValue = [
'ygg_token_expire_1' => '600',
'ygg_token_expire_2' => '1200'
];
// 原来的令牌过期时间默认值太低了,调高点
foreach ($originalDefaultValue as $key => $value) {
if (Option::get($key) == $value) {
Option::set($key, $items[$key]);
}
}
if (! env('YGG_VERBOSE_LOG')) {
@unlink(ygg_log_path());
@unlink(storage_path('logs/yggdrasil.log'));
}
},
];