Skip to content

Commit 8114ac3

Browse files
authored
Merge pull request #988 from proditis/master
merge with development
2 parents ff27e94 + 410ad15 commit 8114ac3

32 files changed

+341
-31
lines changed

backend/commands/CronController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ public function actionInstances($pfonly=false)
239239
{
240240
try {
241241
$dc->destroy();
242-
} catch (\Exception $e) {
243-
244-
}
242+
} catch (\Exception $e) { }
245243
$dc->pull();
246244
$dc->spin();
247245
}
@@ -280,7 +278,7 @@ public function actionInstances($pfonly=false)
280278
if(method_exists($e,'getErrorResponse'))
281279
echo $e->getErrorResponse()->getMessage(),"\n";
282280
else
283-
echo $e->getFile(),":",$e->getLine()," ",$e->getMessage(),"\n";
281+
echo $e->getMessage(),"\n";
284282
}
285283
}
286284
}

backend/commands/PlayerController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,17 @@ protected function playerList(array $players)
151151
/*
152152
Mail Users their activation URL
153153
*/
154-
public function actionMail($baseURL=null, $active=false, $email=false)
154+
public function actionMail($active=false, $email=false,$status=9)
155155
{
156156
// Get innactive players
157157
if($email !== false)
158158
{
159-
$players=Player::find()->where(['active'=>$active, 'email'=>trim(str_replace(array("\xc2\xa0", "\r\n", "\r"), "", $email))])->all();
159+
$players=Player::find()->where(['active'=>$active, 'status'=>$status, 'email'=>trim(str_replace(array("\xc2\xa0", "\r\n", "\r"), "", $email))])->all();
160160
$this->stdout("Mailing user: ".trim(str_replace(array("\xc2\xa0", "\r\n", "\r"), "", $email))."\n", Console::BOLD);
161161
}
162162
else
163163
{
164-
$players=Player::find()->where(['active'=>$active])->all();
164+
$players=Player::find()->where(['active'=>$active,'status'=>$status])->all();
165165
$this->stdout("Mailing Registered users:\n", Console::BOLD);
166166
}
167167
$event_name=Sysconfig::findOne('event_name')->val;
@@ -179,6 +179,7 @@ public function actionMail($baseURL=null, $active=false, $email=false)
179179
['user' => $player,'verifyLink'=>$activationURL]
180180
)
181181
->setFrom([Yii::$app->sys->mail_from => Yii::$app->sys->mail_fromName])
182+
->setBcc([Yii::$app->sys->mail_from => Yii::$app->sys->mail_fromName])
182183
->setTo([$player->email => $player->fullname])
183184
->setSubject(trim(Yii::$app->sys->event_name). ' Account approved')
184185
->send();

backend/components/Pf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function load_anchor_file($anchor, $file)
4949
*/
5050
public static function store($file, $contents)
5151
{
52-
if(empty($contents)) return false;
52+
if(empty($contents)) return file_put_contents($file, "\n")!==false;
5353
try
5454
{
5555
return file_put_contents($file, implode("\n", $contents)."\n")!==false;

backend/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"minimum-stability": "stable",
1414
"require": {
1515
"php": ">=7.2.0",
16+
"yiisoft/yii2": "2.0.47",
1617
"docker-php/docker-php": "^2.0",
1718
"jane-php/jane-php": "^4 <4.3",
1819
"miloschuman/yii2-highcharts-widget": "^10.0",
1920
"kartik-v/yii2-tabs-x": "@dev",
20-
"stripe/stripe-php": "^10.2",
21+
"stripe/stripe-php": "^12.0",
2122
"sleifer/yii2-autocomplete-ajax": "dev-master",
2223
"yiisoft/yii2-jui": "^2.0",
2324
"cebe/markdown": "^1.2",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Handles adding columns to table `{{%target_instance}}`.
7+
*/
8+
class m230826_200413_add_team_allowed_column_to_target_instance_table extends Migration
9+
{
10+
/**
11+
* {@inheritdoc}
12+
*/
13+
public function safeUp()
14+
{
15+
$this->addColumn('{{%target_instance}}', 'team_allowed', $this->boolean()->notNull()->defaultValue(false));
16+
}
17+
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function safeDown()
22+
{
23+
$this->dropColumn('{{%target_instance}}', 'team_allowed');
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Handles adding columns to table `{{%target_instance_audit}}`.
7+
*/
8+
class m230826_203504_add_team_allowed_column_to_target_instance_audit_table extends Migration
9+
{
10+
/**
11+
* {@inheritdoc}
12+
*/
13+
public function safeUp()
14+
{
15+
$this->addColumn('{{%target_instance_audit}}', 'team_allowed', $this->boolean()->notNull()->defaultValue(false));
16+
}
17+
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function safeDown()
22+
{
23+
$this->dropColumn('{{%target_instance_audit}}', 'team_allowed');
24+
}
25+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Handles adding columns to table `{{%server}}`.
7+
*/
8+
class m230826_212155_add_ssl_and_timeout_columns_to_server_table extends Migration
9+
{
10+
/**
11+
* {@inheritdoc}
12+
*/
13+
public function safeUp()
14+
{
15+
$this->addColumn('{{%server}}', 'ssl', $this->boolean()->notNull()->defaultValue(false));
16+
$this->addColumn('{{%server}}', 'timeout', $this->integer()->notNull()->defaultValue(9000));
17+
}
18+
19+
/**
20+
* {@inheritdoc}
21+
*/
22+
public function safeDown()
23+
{
24+
$this->dropColumn('{{%server}}', 'ssl');
25+
$this->dropColumn('{{%server}}', 'timeout');
26+
}
27+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Class m230827_161057_update_tai_target_instance_trigger_add_team_allowed
7+
*/
8+
class m230827_161057_update_tai_target_instance_trigger_add_team_allowed extends Migration
9+
{
10+
public $DROP_SQL="DROP TRIGGER IF EXISTS {{%tai_target_instance}}";
11+
public $CREATE_SQL="CREATE TRIGGER {{%tai_target_instance}} AFTER INSERT ON {{%target_instance}} FOR EACH ROW
12+
thisBegin:BEGIN
13+
IF (@TRIGGER_CHECKS = FALSE) THEN
14+
LEAVE thisBegin;
15+
END IF;
16+
IF NEW.ip IS NOT NULL THEN
17+
DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
18+
END IF;
19+
INSERT DELAYED INTO {{%target_instance_audit}} (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('i',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
20+
END";
21+
22+
public function up()
23+
{
24+
$this->db->createCommand($this->DROP_SQL)->execute();
25+
$this->db->createCommand($this->CREATE_SQL)->execute();
26+
}
27+
28+
public function down()
29+
{
30+
$this->db->createCommand($this->DROP_SQL)->execute();
31+
}
32+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Class m230827_161204_update_tau_target_instance_trigger_add_team_allowed
7+
*/
8+
class m230827_161204_update_tau_target_instance_trigger_add_team_allowed extends Migration
9+
{
10+
public $DROP_SQL="DROP TRIGGER IF EXISTS {{%tau_target_instance}}";
11+
public $CREATE_SQL="CREATE TRIGGER {{%tau_target_instance}} AFTER UPDATE ON {{%target_instance}} FOR EACH ROW
12+
thisBegin:BEGIN
13+
IF (@TRIGGER_CHECKS = FALSE) THEN
14+
LEAVE thisBegin;
15+
END IF;
16+
IF NEW.ip IS NOT NULL AND OLD.ip IS NULL THEN
17+
DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
18+
INSERT DELAYED INTO {{%target_instance_audit}} (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
19+
ELSEIF (NEW.ip IS NULL OR NEW.ip = '') and OLD.ip IS NOT NULL THEN
20+
DO memc_delete(CONCAT('target:',OLD.ip));
21+
INSERT DELAYED INTO {{%target_instance_audit}} (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
22+
ELSEIF NEW.ip!=OLD.ip THEN
23+
DO memc_delete(CONCAT('target:',OLD.ip));
24+
DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
25+
INSERT DELAYED INTO {{%target_instance_audit}} (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
26+
END IF;
27+
END";
28+
29+
public function up()
30+
{
31+
$this->db->createCommand($this->DROP_SQL)->execute();
32+
$this->db->createCommand($this->CREATE_SQL)->execute();
33+
}
34+
35+
public function down()
36+
{
37+
$this->db->createCommand($this->DROP_SQL)->execute();
38+
}
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
5+
/**
6+
* Class m230827_161324_update_tad_target_instance_trigger_add_team_allowed
7+
*/
8+
class m230827_161324_update_tad_target_instance_trigger_add_team_allowed extends Migration
9+
{
10+
public $DROP_SQL = "DROP TRIGGER IF EXISTS {{%tad_target_instance}}";
11+
public $CREATE_SQL = "CREATE TRIGGER {{%tad_target_instance}} AFTER DELETE ON {{%target_instance}} FOR EACH ROW
12+
thisBegin:BEGIN
13+
IF (@TRIGGER_CHECKS = FALSE) THEN
14+
LEAVE thisBegin;
15+
END IF;
16+
IF OLD.ip IS NOT NULL THEN
17+
DO memc_delete(CONCAT('target:',OLD.ip));
18+
END IF;
19+
INSERT DELAYED INTO {{%target_instance_audit}} (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('d',OLD.player_id,OLD.target_id,OLD.server_id,OLD.ip,OLD.reboot,OLD.team_allowed,NOW());
20+
END";
21+
22+
public function up()
23+
{
24+
$this->db->createCommand($this->DROP_SQL)->execute();
25+
$this->db->createCommand($this->CREATE_SQL)->execute();
26+
}
27+
28+
public function down()
29+
{
30+
$this->db->createCommand($this->DROP_SQL)->execute();
31+
}
32+
}

0 commit comments

Comments
 (0)