update unlink

This commit is contained in:
dongpd 2022-04-18 14:59:29 +07:00
parent 2b3e30ad0e
commit 74d8ab31bf

View File

@ -69,7 +69,7 @@ class ApiController extends Controller {
$totalsLogs = CaptureLogs::find()->count();
if ($totalsLogs >= \Yii::$app->params['maxLogs']) {
$lastLogs = CaptureLogs::find()->orderBy(["id" => SORT_ASC])->limit(1)->one();
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $lastLogs->image);
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $lastLogs->image);
$lastLogs->delete();
}
@ -269,18 +269,18 @@ class ApiController extends Controller {
$updating->data = "false";
$updating->save();
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
return ["status" => false];
} else {
$txt = "\n" . date("H:i:s d/m/Y") . " " . "updating";
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
return ["status" => false];
}
}
if ($currentCache['n_128'] == $currentCache['n_512']) {
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
return ["status" => false];
}
@ -322,7 +322,7 @@ class ApiController extends Controller {
$finish = $this->getCurrentTime();
$processTime["updateDB"] = round(($finish - $start), 4);
$txt = "\n" . json_encode($processTime);
file_put_contents(date('Ymd') . ".txt", $txt, FILE_APPEND);
// file_put_contents(date('Ymd') . ".txt", $txt, FILE_APPEND);
}
}
@ -481,6 +481,12 @@ class ApiController extends Controller {
}
public function actionTest() {
$logs = CaptureLogs::find()->andWhere(["<=", "time", 1646092799])->count();
foreach ($logs as $key => $value) {
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image);
$value->delete();
}
exit();
// $updating = \app\models\SyncUrl::findOne(['key_config' => 'token']);
$updating = \app\models\SyncUrl::find()->all();
foreach ($updating as $key => $value) {
@ -639,7 +645,7 @@ class ApiController extends Controller {
if ($value['serverKey'] !== $files_name)
$ft[] = $value;
else
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);
}
$model->image = json_encode($ft);
$model->last_modified = time();
@ -677,7 +683,7 @@ class ApiController extends Controller {
if ($model) {
$images = json_decode($model->image, true);
foreach ($images as $k => $v) {
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
}
$model->delete();
}