mirror of
https://github.com/YGGverse/Yo.git
synced 2026-03-31 17:55:35 +00:00
complete local snaps feature #2
This commit is contained in:
parent
3be2f3ce09
commit
100806af02
2 changed files with 129 additions and 3 deletions
|
|
@ -86,7 +86,47 @@ $filepath = implode(
|
|||
)
|
||||
);
|
||||
|
||||
/// Local snaps @TODO
|
||||
/// Local snaps
|
||||
if ($config->snap->storage->local->enabled)
|
||||
{
|
||||
/// absolute
|
||||
if ('/' === substr($config->snap->storage->local->directory, 0, 1))
|
||||
{
|
||||
$prefix = $config->snap->storage->local->directory;
|
||||
}
|
||||
|
||||
/// relative
|
||||
else
|
||||
{
|
||||
$prefix = __DIR__ . '/../../' . $config->snap->storage->local->directory;
|
||||
}
|
||||
|
||||
foreach ((array) scandir(sprintf('%s/%s', $prefix, $filepath)) as $filename)
|
||||
{
|
||||
if (in_array($filename, ['.', '..']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$basename = basename($filename);
|
||||
$time = preg_replace('/\D/', '', $basename);
|
||||
|
||||
$snaps[_('Local')][] = (object)
|
||||
[
|
||||
'source' => 'local',
|
||||
'md5url' => $md5url,
|
||||
'name' => $basename,
|
||||
'time' => $time,
|
||||
'size' => filesize(
|
||||
sprintf(
|
||||
'%s/%s',
|
||||
$prefix,
|
||||
$filepath
|
||||
)
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/// Remote snaps
|
||||
foreach ($config->snap->storage->remote->ftp as $i => $ftp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue