Willkommen bei WordPress. Dies ist dein erster Beitrag. Bearbeite oder lösche ihn und beginne mit dem Schreiben!
Hallo Welt!
von raredesign | Dez 3, 2019 | Allgemein | 0 Kommentare
Cokiee Shell
Current Path : /var/www/web28/html/wp-content/plugins/matomo/app/core/ArchiveProcessor/ |
Current File : //var/www/web28/html/wp-content/plugins/matomo/app/core/ArchiveProcessor/LoaderLock.php |
<?php /** * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ namespace Piwik\ArchiveProcessor; use Piwik\Db; use Piwik\SettingsPiwik; class LoaderLock { public const MAX_LEN_LOCK_NAME = 64; public const MAX_LOCK_TIME = 60; //in seconds protected $id; /** * @param string $id * @throws \Exception */ public function __construct($id) { // instanceId is needed for multi tenant database solution $id = SettingsPiwik::getPiwikInstanceId() . $id; if (mb_strlen($id) >= self::MAX_LEN_LOCK_NAME) { //convert ot prefix and md5 full length $id = mb_substr($id, 0, 32) . md5($id); } $this->id = $id; } public function setLock() { Db::fetchOne('SELECT GET_LOCK(?,?)', array($this->id, self::MAX_LOCK_TIME)); } public function unLock() { Db::query('DO RELEASE_LOCK(?)', array($this->id)); } public function getId() { return $this->id; } /** * @description check if the lock is available to user * @param string $key * @return bool * @throws \Exception */ public static function isLockAvailable($key) { return (bool) Db::fetchOne('SELECT IS_FREE_LOCK(?)', [$key]); } }
Cokiee Shell Web 1.0, Coded By Razor
Neueste Kommentare