commit
daf0ed6822
|
@ -16,7 +16,7 @@
|
|||
"spatie/array-to-xml": "3.1.0",
|
||||
"ezyang/htmlpurifier": "4.14.0",
|
||||
"brick/phonenumber": "0.4.0",
|
||||
"sentry/sdk": "^3.1",
|
||||
"sentry/sdk": "3.1.1",
|
||||
"azuyalabs/yasumi": "2.4.0",
|
||||
"ministryofweb/php-osm-tiles": "2.0.0",
|
||||
"delight-im/db": "1.3.1",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "e58e898319723a7aa04ce911f357185f",
|
||||
"content-hash": "9193956804bd765f7fe3f29d0c61472e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "azuyalabs/yasumi",
|
||||
|
@ -3272,5 +3272,5 @@
|
|||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
|
|
@ -5,22 +5,31 @@ $executed_actions = [];
|
|||
|
||||
function job_reset_availability() {
|
||||
global $db, $executed_actions;
|
||||
$profiles = $db->select("SELECT * FROM `".DB_PREFIX."_profiles`");
|
||||
if(!is_null($profiles) && count($profiles) > 0) {
|
||||
$list = [];
|
||||
foreach($profiles as $profile){
|
||||
$list[] = [$profile["id"] => $profile["availability_minutes"]];
|
||||
if(
|
||||
(int) date("j") === 1 &&
|
||||
(int) date("H") === 0 &&
|
||||
(int) date("i") - 5 < 0
|
||||
) {
|
||||
$profiles = $db->select("SELECT * FROM `".DB_PREFIX."_profiles`");
|
||||
if(!is_null($profiles) && count($profiles) > 0) {
|
||||
$list = [];
|
||||
foreach($profiles as $profile){
|
||||
$list[] = [$profile["id"] => $profile["availability_minutes"]];
|
||||
}
|
||||
$db->insert(
|
||||
DB_PREFIX."_minutes",
|
||||
["month" => date("m"), "year" => date("Y"), "list"=> json_encode($list)]
|
||||
);
|
||||
$db->exec("UPDATE `".DB_PREFIX."_profiles` SET `availability_minutes` = 0");
|
||||
$output = $list;
|
||||
$output_status = "ok";
|
||||
} else {
|
||||
$output = ["profiles array empty"];
|
||||
$output_status = "error";
|
||||
}
|
||||
$db->insert(
|
||||
DB_PREFIX."_minutes",
|
||||
["month" => date("m"), "year" => date("Y"), "list"=> json_encode($list)]
|
||||
);
|
||||
$db->exec("UPDATE `".DB_PREFIX."_profiles` SET `availability_minutes` = 0");
|
||||
$output = $list;
|
||||
$output_status = "ok";
|
||||
} else {
|
||||
$output = ["profiles array empty"];
|
||||
$output_status = "error";
|
||||
$output = ["not time to reset"];
|
||||
$output_status = "ok";
|
||||
}
|
||||
$executed_actions[] = [
|
||||
"title" => "Reset availability minutes",
|
||||
|
|
|
@ -136,7 +136,7 @@ function requireLogin()
|
|||
$token = getBearerToken();
|
||||
if($users->auth->isTokenValid($token)) {
|
||||
$users->auth->authenticateWithToken($token);
|
||||
if(SENTRY_LOADED) {
|
||||
if(defined('SENTRY_LOADED')) {
|
||||
\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($users): void {
|
||||
$scope->setUser([
|
||||
'id' => $users->auth->getUserId(),
|
||||
|
@ -184,7 +184,7 @@ if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
|
|||
}
|
||||
|
||||
try {
|
||||
if(SENTRY_LOADED) {
|
||||
if(defined('SENTRY_LOADED')) {
|
||||
\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($uri): void {
|
||||
$scope->setTag('page.route', $uri);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue