mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
Merge branch 'php8' into section
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Nexus\Database;
|
||||
|
||||
use Illuminate\Cache\LuaScripts;
|
||||
use Illuminate\Cache\RedisLock;
|
||||
|
||||
class NexusLock extends RedisLock
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Redis
|
||||
*/
|
||||
protected $redis;
|
||||
/**
|
||||
* NexusLock constructor.
|
||||
* @param string $name
|
||||
* @param int $seconds
|
||||
* @param null $owner
|
||||
*/
|
||||
public function __construct($name, $seconds, $owner = null)
|
||||
{
|
||||
parent::__construct(NexusDB::redis(), $name, $seconds, $owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function acquire()
|
||||
{
|
||||
if ($this->seconds > 0) {
|
||||
return $this->redis->set($this->name, $this->owner, ['nx', 'ex' => $this->seconds]) == true;
|
||||
} else {
|
||||
return $this->redis->setnx($this->name, $this->owner) == true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the lock.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function release()
|
||||
{
|
||||
return (bool) $this->redis->eval(LuaScripts::releaseLock(), [$this->name, $this->owner], 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -568,6 +568,7 @@ class Install
|
||||
$this->doLog("[SAVE SETTING], prefix: $prefix, nameAndValues: " . json_encode($group));
|
||||
saveSetting($prefix, $group);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function createSymbolicLinks($symbolicLinks)
|
||||
|
||||
@@ -386,6 +386,7 @@ class Update extends Install
|
||||
}
|
||||
// $command = sprintf('cp -raf %s/. %s', $path, ROOT_PATH);
|
||||
$command = "rsync -rvq $path/ " . ROOT_PATH;
|
||||
$command .= " --include=public/vendor";
|
||||
foreach ($excludes as $exclude) {
|
||||
$command .= " --exclude=$exclude";
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ return array (
|
||||
'view_special_torrent' => '4',
|
||||
'torrent_hr' => User::CLASS_ADMINISTRATOR,
|
||||
'torrent-approval' => User::CLASS_ADMINISTRATOR,
|
||||
'torrent-delete' => User::CLASS_ADMINISTRATOR,
|
||||
),
|
||||
'tweak' =>
|
||||
array (
|
||||
|
||||
Reference in New Issue
Block a user