forked from Public/pics
Refactor leftover old-style arrays into new-style arrays.
This commit is contained in:
@@ -25,7 +25,7 @@ class Download extends HTMLController
|
||||
throw new UnexpectedValueException('Specified tag does not correspond to an album');
|
||||
|
||||
//Yes TOCTOU but it does not need to be perfect.
|
||||
$lock_file = join('/', array(sys_get_temp_dir(), 'pics-export.lock'));
|
||||
$lock_file = join('/', [sys_get_temp_dir(), 'pics-export.lock']);
|
||||
if(!file_exists($lock_file))
|
||||
{
|
||||
try
|
||||
@@ -34,12 +34,12 @@ class Download extends HTMLController
|
||||
|
||||
if(!$fp)
|
||||
throw new UnexpectedValueException('Could not open lock-file');
|
||||
|
||||
|
||||
$this->exportAlbum($album);
|
||||
}
|
||||
finally
|
||||
{
|
||||
fclose($fp);
|
||||
fclose($fp);
|
||||
unlink($lock_file);
|
||||
}
|
||||
}
|
||||
@@ -51,26 +51,26 @@ class Download extends HTMLController
|
||||
|
||||
private function exportAlbum($album)
|
||||
{
|
||||
$files = array();
|
||||
$files = [];
|
||||
|
||||
$album_ids = array_merge(array($album->id_tag), $this->getChildAlbumIds($album->id_tag));
|
||||
$album_ids = array_merge([$album->id_tag], $this->getChildAlbumIds($album->id_tag));
|
||||
foreach($album_ids as $album_id)
|
||||
{
|
||||
$iterator = AssetIterator::getByOptions(
|
||||
array(
|
||||
[
|
||||
'id_tag' => $album_id
|
||||
)
|
||||
]
|
||||
);
|
||||
while($asset = $iterator->Next())
|
||||
{
|
||||
$files[] = join(DIRECTORY_SEPARATOR, array('.', $asset->getSubdir(), $asset->getFilename()));
|
||||
$files[] = join(DIRECTORY_SEPARATOR, ['.', $asset->getSubdir(), $asset->getFilename()]);
|
||||
}
|
||||
}
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => array('pipe', 'r'),
|
||||
1 => array('pipe', 'w'),
|
||||
);
|
||||
$descriptorspec = [
|
||||
0 => ['pipe', 'r'],
|
||||
1 => ['pipe', 'w'],
|
||||
];
|
||||
|
||||
$command = 'tar --null -cf - -T -';
|
||||
|
||||
@@ -108,7 +108,7 @@ class Download extends HTMLController
|
||||
|
||||
private function getChildAlbumIds($parent_id)
|
||||
{
|
||||
$ids = array();
|
||||
$ids = [];
|
||||
|
||||
$albums = Tag::getAlbums($parent_id, 0, PHP_INT_MAX, 'object');
|
||||
foreach($albums as $album)
|
||||
|
||||
Reference in New Issue
Block a user