Refactor leftover old-style arrays into new-style arrays.

This commit is contained in:
2019-09-29 14:47:56 +02:00
parent 3694819d13
commit c48ba786c1
5 changed files with 56 additions and 59 deletions

View File

@@ -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)

View File

@@ -53,7 +53,7 @@ class ProvideAutoSuggest extends JSONController
// It better not already exist!
if (Tag::exactMatch($_REQUEST['tag']))
{
$this->payload = ['error' => true, 'msg' => "Tag already exists!"];
$this->payload = ['error' => true, 'msg' => 'Tag already exists!'];
return;
}
@@ -68,7 +68,7 @@ class ProvideAutoSuggest extends JSONController
// Did we succeed?
if (!$tag)
{
$this->payload = ['error' => true, 'msg' => "Could not create tag."];
$this->payload = ['error' => true, 'msg' => 'Could not create tag.'];
return;
}