From d038fa7c53c700751c26cf2e4d3debc08ca4ff6e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 31 Jul 2021 17:20:49 +0200 Subject: [PATCH] bug fixes and template adjustments --- Controller/ApiController.php | 4 ++-- Models/CollectionMapper.php | 2 +- Models/MediaMapper.php | 2 +- Theme/Backend/media-list.tpl.php | 5 +++-- composer.json | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index b917e20..812013a 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -209,8 +209,8 @@ final class ApiController extends Controller */ public static function createMediaPath(string $basePath = '/Modules/Media/Files') : string { - $rndPath = \str_pad(\dechex(\mt_rand(0, 65535)), 4, '0', \STR_PAD_LEFT); - return $basePath . '/_' . $rndPath[0] . $rndPath[1] . '/' . $rndPath[2] . $rndPath[3]; + $rndPath = \str_pad(\dechex(\mt_rand(0, 4294967295)), 8, '0', \STR_PAD_LEFT); + return $basePath . '/_' . $rndPath[0] . $rndPath[1] . $rndPath[2] . $rndPath[3] . '/_' . $rndPath[4] . $rndPath[5] . $rndPath[6] . $rndPath[7]; } /** diff --git a/Models/CollectionMapper.php b/Models/CollectionMapper.php index 60bb6ec..3616b07 100755 --- a/Models/CollectionMapper.php +++ b/Models/CollectionMapper.php @@ -99,7 +99,7 @@ final class CollectionMapper extends MediaMapper public static function getByVirtualPath(string $virtualPath = '/', bool $hidden = false) : array { $depth = 3; - $query = self::getQuery(); + $query = self::getQuery(depth: $depth); $query->where(self::$table . '_d' . $depth . '.media_virtual', '=', $virtualPath); $query->where(self::$table . '_d' . $depth . '.media_collection', '=', 1); diff --git a/Models/MediaMapper.php b/Models/MediaMapper.php index 79db48b..0eda17e 100755 --- a/Models/MediaMapper.php +++ b/Models/MediaMapper.php @@ -140,7 +140,7 @@ class MediaMapper extends DataMapperAbstract public static function getByVirtualPath(string $virtualPath = '/', bool $hidden = false) : array { $depth = 3; - $query = self::getQuery(); + $query = self::getQuery(depth: $depth); $query->where(self::$table . '_d' . $depth . '.media_virtual', '=', $virtualPath); if ($hidden === false) { diff --git a/Theme/Backend/media-list.tpl.php b/Theme/Backend/media-list.tpl.php index 6cc55a6..cd7704a 100755 --- a/Theme/Backend/media-list.tpl.php +++ b/Theme/Backend/media-list.tpl.php @@ -164,6 +164,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id= + $value) : @@ -199,11 +200,11 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id= size); echo $this->printHtml($value->extension !== 'collection' ? \number_format($size[0], 1, '.', ',') . $size[1] : ''); ?> - printHtml($value->createdBy->name1); ?> + printHtml($value->createdBy->name1); ?> printHtml($value->createdAt->format('Y-m-d')); ?> - getHtml('Empty', '0', '0'); ?> + getHtml('Empty', '0', '0'); ?>
diff --git a/composer.json b/composer.json index 7ad134b..7cf5769 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "require-dev": { "phpunit/phpunit": ">=9.4", "friendsofphp/php-cs-fixer": ">=3.0", - "squizlabs/php_codesniffer": ">=3.5", + "squizlabs/php_codesniffer": ">=3.6", "phpmd/phpmd": ">=2.9", "phpstan/phpstan": ">=0.12.58", "phan/phan": ">=3.2.6"