Squashed commit

Always execute migration 9999 (can be used to fix things manually)
Optimized meal plan navigation / date range filtering
Prepared next release
Pulled translations from Transifex
Various code optimizations
This commit is contained in:
Bernd Bestel
2021-07-16 17:32:08 +02:00
parent 2d1d5d46f6
commit edfa404ed6
58 changed files with 312 additions and 513 deletions

View File

@@ -8,6 +8,30 @@ class FilesService extends BaseService
{
const FILE_SERVE_TYPE_PICTURE = 'picture';
public function __construct()
{
$this->StoragePath = GROCY_DATAPATH . '/storage';
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
}
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
{
$dbSuffix = GROCY_DEFAULT_LOCALE;
if (defined('GROCY_DEMO_DB_SUFFIX'))
{
$dbSuffix = GROCY_DEMO_DB_SUFFIX;
}
$this->StoragePath = $this->StoragePath . '/' . $dbSuffix;
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
}
}
}
private $StoragePath;
public function DownscaleImage($group, $fileName, $bestFitHeight = null, $bestFitWidth = null)
@@ -58,8 +82,9 @@ class FilesService extends BaseService
$fileNameWithoutExtension = pathinfo($filePath, PATHINFO_FILENAME);
$fileExtension = pathinfo($filePath, PATHINFO_EXTENSION);
// Then the file is an image
if (getimagesize($filePath) !== false)
{ // Then the file is an image
{
// Also delete all corresponding "__downscaledto" files when deleting an image
$groupFolderPath = $this->StoragePath . '/' . $group;
$files = scandir($groupFolderPath);
@@ -87,32 +112,4 @@ class FilesService extends BaseService
return $groupFolderPath . '/' . $fileName;
}
public function __construct()
{
parent::__construct();
$this->StoragePath = GROCY_DATAPATH . '/storage';
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
}
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
{
$dbSuffix = GROCY_DEFAULT_LOCALE;
if (defined('GROCY_DEMO_DB_SUFFIX'))
{
$dbSuffix = GROCY_DEMO_DB_SUFFIX;
}
$this->StoragePath = $this->StoragePath . '/' . $dbSuffix;
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
}
}
}
}