mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
apcu functions namespace
This commit is contained in:
parent
c29fe61ad1
commit
36efe4f1e3
2 changed files with 6 additions and 6 deletions
|
|
@ -29,17 +29,17 @@ class TempController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(string $key, string $path): string {
|
public function register(string $key, string $path): string {
|
||||||
apcu_store($key, $path);
|
\apcu_store($key, $path);
|
||||||
|
|
||||||
return $this->webRoot . $key;
|
return $this->webRoot . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unregister(string $key) {
|
public function unregister(string $key) {
|
||||||
apcu_dec($key);
|
\apcu_dec($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function serve(string $key) {
|
public function serve(string $key) {
|
||||||
$path = apcu_fetch($key);
|
$path = \apcu_fetch($key);
|
||||||
if ($path) {
|
if ($path) {
|
||||||
$handle = fopen($path, 'r');
|
$handle = fopen($path, 'r');
|
||||||
fpassthru($handle);
|
fpassthru($handle);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class AuthProvider extends BaseProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUser(string $token, \SteamId $steamid, string $key) {
|
public function setUser(string $token, \SteamId $steamid, string $key) {
|
||||||
apcu_store($token, [
|
\apcu_store($token, [
|
||||||
'name' => $steamid->getNickname(),
|
'name' => $steamid->getNickname(),
|
||||||
'steamid' => $steamid->getSteamId64(),
|
'steamid' => $steamid->getSteamId64(),
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
|
|
@ -32,12 +32,12 @@ class AuthProvider extends BaseProvider {
|
||||||
|
|
||||||
public function getUser(string $token) {
|
public function getUser(string $token) {
|
||||||
$found = true;
|
$found = true;
|
||||||
$result = apcu_fetch($token, $found);
|
$result = \apcu_fetch($token, $found);
|
||||||
|
|
||||||
return $found ? $result : ['name' => null, 'steamid' => null, 'key' => null];
|
return $found ? $result : ['name' => null, 'steamid' => null, 'key' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logout($token) {
|
public function logout($token) {
|
||||||
apcu_delete($token);
|
\apcu_delete($token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue