Also check folder permissions for the EEPROM scripts.
This commit is contained in:
parent
9d70505ad8
commit
55dc011df6
8 changed files with 144 additions and 117 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
20250327.1
|
20250403
|
||||||
|
|
|
@ -7,8 +7,8 @@ use Misuzu\Storage\HashHelpers;
|
||||||
|
|
||||||
class FilesStorage {
|
class FilesStorage {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private string $localPath,
|
public private(set) string $localPath,
|
||||||
private string $remotePath,
|
public private(set) string $remotePath,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public static function stringifyHash(FileInfo|string $infoOrHash): string {
|
public static function stringifyHash(FileInfo|string $infoOrHash): string {
|
||||||
|
|
|
@ -250,6 +250,9 @@ try {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!empty($msz->storageCtx->filesCtx->storage->localPath)
|
||||||
|
&& is_dir($msz->storageCtx->filesCtx->storage->localPath)
|
||||||
|
&& fileowner($msz->storageCtx->filesCtx->storage->localPath) === posix_getuid()) {
|
||||||
msz_sched_task_func('Removing stale entries from storage pools...', false, function() use ($msz) {
|
msz_sched_task_func('Removing stale entries from storage pools...', false, function() use ($msz) {
|
||||||
$pools = [];
|
$pools = [];
|
||||||
$getPool = fn($ruleRaw) => array_key_exists($ruleRaw->poolId, $pools) ? $pools[$ruleRaw->poolId] : (
|
$getPool = fn($ruleRaw) => array_key_exists($ruleRaw->poolId, $pools) ? $pools[$ruleRaw->poolId] : (
|
||||||
|
@ -367,6 +370,7 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
echo 'Running ' . count($schedTasks) . ' tasks...' . PHP_EOL;
|
echo 'Running ' . count($schedTasks) . ' tasks...' . PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,13 @@ use Index\XNumber;
|
||||||
|
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
|
if(empty($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('No storage path is specified.%s', PHP_EOL));
|
||||||
|
if(!is_dir($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('Storage directory does not exist.%s', PHP_EOL));
|
||||||
|
if(fileowner($msz->storageCtx->filesCtx->storage->localPath) !== posix_getuid())
|
||||||
|
die(sprintf('Script must be run as the owner of the storage directory.%s', PHP_EOL));
|
||||||
|
|
||||||
$options = getopt('s', [
|
$options = getopt('s', [
|
||||||
'base62',
|
'base62',
|
||||||
], $restIndex);
|
], $restIndex);
|
||||||
|
|
|
@ -6,6 +6,13 @@ use Misuzu\Storage\Files\FileInfoGetFileField;
|
||||||
|
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
|
if(empty($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('No storage path is specified.%s', PHP_EOL));
|
||||||
|
if(!is_dir($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('Storage directory does not exist.%s', PHP_EOL));
|
||||||
|
if(fileowner($msz->storageCtx->filesCtx->storage->localPath) !== posix_getuid())
|
||||||
|
die(sprintf('Script must be run as the owner of the storage directory.%s', PHP_EOL));
|
||||||
|
|
||||||
$options = getopt('hsur:', [
|
$options = getopt('hsur:', [
|
||||||
'hash',
|
'hash',
|
||||||
'base62',
|
'base62',
|
||||||
|
|
|
@ -5,6 +5,13 @@ use Misuzu\Storage\Files\FileInfoGetFileField;
|
||||||
|
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
|
if(empty($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('No storage path is specified.%s', PHP_EOL));
|
||||||
|
if(!is_dir($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('Storage directory does not exist.%s', PHP_EOL));
|
||||||
|
if(fileowner($msz->storageCtx->filesCtx->storage->localPath) !== posix_getuid())
|
||||||
|
die(sprintf('Script must be run as the owner of the storage directory.%s', PHP_EOL));
|
||||||
|
|
||||||
$options = getopt('hsuv:', [
|
$options = getopt('hsuv:', [
|
||||||
'hash',
|
'hash',
|
||||||
'base62',
|
'base62',
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
namespace Misuzu;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
$path = $msz->tplCtx->cachePath;
|
if(empty($msz->tplCtx->cachePath))
|
||||||
if(empty($path))
|
|
||||||
die(sprintf('No cache path is specified.%s', PHP_EOL));
|
die(sprintf('No cache path is specified.%s', PHP_EOL));
|
||||||
|
if(!is_dir($msz->tplCtx->cachePath))
|
||||||
if(!is_dir($path))
|
|
||||||
die(sprintf('Cache directory does not exist.%s', PHP_EOL));
|
die(sprintf('Cache directory does not exist.%s', PHP_EOL));
|
||||||
|
if(fileowner($msz->tplCtx->cachePath) !== posix_getuid())
|
||||||
if(fileowner($path) !== posix_getuid())
|
|
||||||
die(sprintf('Script must be run as the owner of the cache directory.%s', PHP_EOL));
|
die(sprintf('Script must be run as the owner of the cache directory.%s', PHP_EOL));
|
||||||
|
|
||||||
echo `rm -rv {$path}`;
|
echo `rm -rv {$msz->tplCtx->cachePath}`;
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
|
if(empty($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('No storage path is specified.%s', PHP_EOL));
|
||||||
|
if(!is_dir($msz->storageCtx->filesCtx->storage->localPath))
|
||||||
|
die(sprintf('Storage directory does not exist.%s', PHP_EOL));
|
||||||
|
if(fileowner($msz->storageCtx->filesCtx->storage->localPath) !== posix_getuid())
|
||||||
|
die(sprintf('Script must be run as the owner of the storage directory.%s', PHP_EOL));
|
||||||
|
|
||||||
if($argc <= 1)
|
if($argc <= 1)
|
||||||
die(sprintf('No uploader ID specified.%s', PHP_EOL));
|
die(sprintf('No uploader ID specified.%s', PHP_EOL));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue