- Add CloudronStack/output/CloudronPackages-Artifacts/tirreno/ directory and its contents - Includes package manifest, Dockerfile, source code, documentation, and build artifacts - Add tirreno-1761840148.tar.gz as a build artifact - Add tirreno-cloudron-package-1761841304.tar.gz as the Cloudron package - Include all necessary files for the tirreno Cloudron package This adds the complete tirreno Cloudron package artifacts to the repository.
70 lines
2.2 KiB
PHP
70 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Tirreno ~ Open source user analytics
|
|
* Copyright (c) Tirreno Technologies Sàrl (https://www.tirreno.com)
|
|
*
|
|
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
* For full copyright and license information, please see the LICENSE
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @copyright Copyright (c) Tirreno Technologies Sàrl (https://www.tirreno.com)
|
|
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
* @link https://www.tirreno.com Tirreno(tm)
|
|
*/
|
|
|
|
namespace Models\Enrichment;
|
|
|
|
class Device extends \Models\Enrichment\Base {
|
|
protected string $ua;
|
|
protected ?string $device;
|
|
protected ?string $browser_name;
|
|
protected ?string $browser_version;
|
|
protected ?string $os_name;
|
|
protected ?string $os_version;
|
|
protected bool $modified;
|
|
protected bool $checked = true;
|
|
|
|
public function __construct() {
|
|
}
|
|
|
|
public function init(array $data): void {
|
|
$this->ua = $data['ua'];
|
|
$this->device = $data['device'];
|
|
$this->browser_name = $data['browser_name'];
|
|
$this->browser_version = $data['browser_version'];
|
|
$this->os_name = $data['os_name'];
|
|
$this->os_version = $data['os_version'];
|
|
$this->modified = $data['modified'];
|
|
}
|
|
|
|
public function prepareUpdate(): array {
|
|
$params = $this->queryParams();
|
|
unset($params[':ua']);
|
|
|
|
$placeholders = array_keys($params);
|
|
$updateString = $this->updateStringByPlaceholders($placeholders);
|
|
|
|
return [$params, $updateString];
|
|
}
|
|
|
|
public function updateEntityInDb(int $entityId, int $apiKey): void {
|
|
// total_visit and total_account should remain still
|
|
[$params, $updateString] = $this->prepareUpdate();
|
|
|
|
$params['entity_id'] = $entityId;
|
|
$params['key'] = $apiKey;
|
|
|
|
$query = ("
|
|
UPDATE event_ua_parsed
|
|
SET {$updateString}
|
|
WHERE
|
|
event_ua_parsed.id = :entity_id AND
|
|
event_ua_parsed.key = :key
|
|
");
|
|
|
|
$model = new \Models\Device();
|
|
$model->execQuery($query, $params);
|
|
}
|
|
}
|