Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Release 2.4.0 (#1182)
Browse files Browse the repository at this point in the history
* Parent + Nested validation changes (#1138)

* Issue Fix #1109 (#1146)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Issue Fix #1109

* Add Special characters in the radom string generator

* Issue Fix #1109

* Remove other option

* Imagick changes

* Update logo without page refresh (#1162)

* Resolve the error of validation of primary key (#1166)

* Don't use special characters in creation of project auth tokens (#1169)

* Comment PHP variables in htaccess. (#1145)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Remove warning of undefined index size (#1140)

* Add thumbnails for PDF. (#1141)

* Remove PHP vaeiable from htaccess.

* Update .htaccess

* Update public/.htaccess

Co-Authored-By: Rijk van Zanten <[email protected]>

* Issue Fix #1161 (#1165)

* Issue fix #1161

* Check for O2M

* Add option to prevent upsizing contained thumbnails. (#1168)

* Issue Fix #1170 (#1175)

* Release 2.3.1 (#1158)

* Parent + Nested validation changes (#1138)

* #1121 (#1126)

* Public Role : UserId should be set 0 instead of null

* Change : invalid token

* Issue Fix #1109 (#1146)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Issue Fix #1109

* Add Special characters in the radom string generator

* Issue Fix #1109

* Remove other option

* Imagick changes

* Issue Fix #1148 (#1152)

* Fix 1149 (#1156)

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Fixed namespace of InvalidLoggerConfigurationException (#1153)

* Bump version to v2.3.1

* Merge conflict resolve

* Issue Fix #1170

* Rebase files

* Issue fix/1176 (#1177)

* added array type to schema (#1163)

* Parent + Nested validation changes (#1138)

* #1121 (#1126)

* Public Role : UserId should be set 0 instead of null

* Change : invalid token

* Issue Fix #1109 (#1146)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Issue Fix #1109

* Add Special characters in the radom string generator

* Issue Fix #1109

* Remove other option

* Imagick changes

* Issue Fix #1148 (#1152)

* Fix 1149 (#1156)

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Fixed namespace of InvalidLoggerConfigurationException (#1153)

* added array type to schema

* Update logo without page refresh (#1162)

* skipped schema validation for config from api.php

* Resolve the error of validation of primary key (#1166)

* Don't use special characters in creation of project auth tokens (#1169)

* Comment PHP variables in htaccess. (#1145)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Remove warning of undefined index size (#1140)

* Add thumbnails for PDF. (#1141)

* Remove PHP vaeiable from htaccess.

* Update .htaccess

* Update public/.htaccess

Co-Authored-By: Rijk van Zanten <[email protected]>

* Issue Fix #1161 (#1165)

* Issue fix #1161

* Check for O2M

* Add option to prevent upsizing contained thumbnails. (#1168)

* Issue Fix #1170 (#1175)

* Release 2.3.1 (#1158)

* Parent + Nested validation changes (#1138)

* #1121 (#1126)

* Public Role : UserId should be set 0 instead of null

* Change : invalid token

* Issue Fix #1109 (#1146)

* Added file support for 7.0 (Explained) (#1124)

* Bump version to 2.3.0 (#1120)

* Added file support for 7.0 (Explained)

Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin.

Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt.

Explained here:
https://stackoverflow.com/a/51568547

* Issue Fix #1114 (#1128)

* Issue Fix #1114

* Change exception message

* Update .gitignore (#1129)

* Bump version to 2.3.0 (#1120)

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Issue Fix #1125 (#1134)

* Issue Fix #1131 (#1135)

* create thumb for pdf if imagick is available (#1123)

* Bump version to 2.3.0 (#1120)

* create thumb for pdf if imagick is available

* Issue Fix #1109

* Add Special characters in the radom string generator

* Issue Fix #1109

* Remove other option

* Imagick changes

* Issue Fix #1148 (#1152)

* Fix 1149 (#1156)

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Process relation & non relatinal fields sequentially to solve logical operator issue

* Fixed namespace of InvalidLoggerConfigurationException (#1153)

* Bump version to v2.3.1

* Merge conflict resolve

* Issue Fix #1170

* Rebase files

* added new config key "ext" for all external config with type ARRAY.
added tests.

* made "ext" key optional

* Issue fix/1176 (#1177)

* Issue fix #1179 (#1181)

* Release v2.4.0
  • Loading branch information
rijkvanzanten committed Aug 8, 2019
1 parent bf1330e commit 77a95be
Show file tree
Hide file tree
Showing 23 changed files with 206 additions and 171 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "@directus/api",
"private": true,
"version": "2.3.1",
"version": "2.4.0",
"description": "Directus API",
"main": "index.js",
"repository": "directus/api",
Expand Down
9 changes: 5 additions & 4 deletions public/.htaccess
Expand Up @@ -20,7 +20,8 @@ Options +SymLinksIfOwnerMatch
RewriteRule !^admin index.php?%{QUERY_STRING} [L]
</ifModule>

<IfModule mod_php7.c>
php_value upload_max_filesize 50M
php_value post_max_size 100M
</IfModule>
# Uncomment the following lines to modify PHP settings. The lines below can be used to increase the max upload size of files in Directus
#<IfModule mod_php7.c>
#php_value upload_max_filesize 50M
#php_value post_max_size 100M
#</IfModule>
2 changes: 1 addition & 1 deletion src/core/Directus/Application/Application.php
Expand Up @@ -13,7 +13,7 @@ class Application extends App
*
* @var string
*/
const DIRECTUS_VERSION = '2.3.1';
const DIRECTUS_VERSION = '2.4.0';

/**
* NOT USED
Expand Down
13 changes: 13 additions & 0 deletions src/core/Directus/Config/Schema/Base.php
Expand Up @@ -113,4 +113,17 @@ public function optional($value = null)
}
return $this->_optional;
}

/**
* Returns the $context with normalized array keys.
* @param $context
* @return mixed
*/
protected function normalize($context) {
foreach ($context as $context_key => $context_value) {
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
}

return $context;
}
}
4 changes: 1 addition & 3 deletions src/core/Directus/Config/Schema/Group.php
Expand Up @@ -25,9 +25,7 @@ public function value($context)
$value = [];
$current = [];

foreach ($context as $context_key => $context_value) {
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
}
$context = $this->normalize($context);

if (!isset($context[$this->key()])) {
if ($this->optional()) {
Expand Down
15 changes: 8 additions & 7 deletions src/core/Directus/Config/Schema/Schema.php
Expand Up @@ -77,17 +77,17 @@ public static function get() {
]),
new Group('cors', [
new Value('enabled', Types::BOOLEAN, true),
new Value('origin', 'array', ['*']),
new Value('methods', 'array', [
new Value('origin', Types::ARRAY, ['*']),
new Value('methods', Types::ARRAY, [
'GET',
'POST',
'PUT',
'PATCH',
'DELETE',
'HEAD'
]),
new Value('headers', 'array', []),
new Value('exposed_headers', 'array', []),
new Value('headers', Types::ARRAY, []),
new Value('exposed_headers', Types::ARRAY, []),
new Value('max_age', Types::INTEGER, null),
new Value('credentials', Types::BOOLEAN, false),
]),
Expand All @@ -101,14 +101,14 @@ public static function get() {
new Value('timeout', Types::INTEGER, 10),
]),
new Group('hooks', [
new Value('actions', 'array', []),
new Value('filters', 'array', []),
new Value('actions', Types::ARRAY, []),
new Value('filters', Types::ARRAY, []),
]),
new Group('feedback', [
new Value('token', Types::STRING, 'a-kind-of-unique-token'),
new Value('login', Types::STRING, true),
]),
new Value('tableBlacklist', 'array', []),
new Value('tableBlacklist', Types::ARRAY, []),
new Group('auth', [
new Value('secret_key', Types::STRING, '<type-a-secret-authentication-key-string>'),
new Value('public_key', Types::STRING, '<type-a-public-authentication-key-string>'),
Expand Down Expand Up @@ -139,6 +139,7 @@ public static function get() {
]),
]),
]),
new Value('ext?', Types::ARRAY, []),
]);
}
}
1 change: 1 addition & 0 deletions src/core/Directus/Config/Schema/Types.php
Expand Up @@ -11,4 +11,5 @@ interface Types
const FLOAT = 'float';
const STRING = 'string';
const BOOLEAN = 'boolean';
const ARRAY = 'array';
}
31 changes: 15 additions & 16 deletions src/core/Directus/Config/Schema/Value.php
Expand Up @@ -35,9 +35,7 @@ public function __construct($name, $type, $default = null)
*/
public function value($context)
{
foreach ($context as $context_key => $context_value) {
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
}
$context = $this->normalize($context);

if (!isset($context) || !isset($context[$this->key()])) {
if ($this->optional()) {
Expand All @@ -50,19 +48,20 @@ public function value($context)
$value = $context[$this->key()];

switch ($this->_type) {
case Types::INTEGER:
return intval($value);
case Types::BOOLEAN:
$value = strtolower($value);
return $value === "true" || $value === "1" || $value === "on" || $value === "yes" || boolval($value);
case Types::FLOAT:
return floatval($value);
// TODO: add support to arrays
case 'array':
return $this->_default;
case Types::STRING:
default:
return $value;
case Types::INTEGER:
return intval($value);
case Types::BOOLEAN:
$value = strtolower($value);
return $value === "true" || $value === "1" || $value === "on" || $value === "yes" || boolval($value);
case Types::FLOAT:
return floatval($value);
case Types::ARRAY:
if (!is_array($value)) {
return $this->_default;
}
case Types::STRING:
default:
return $value;
}
}
}
5 changes: 4 additions & 1 deletion src/core/Directus/Filesystem/Files.php
Expand Up @@ -259,6 +259,9 @@ public function saveData($fileData, $fileName, $replace = false)
// When file is uploaded via multipart form data then We will get object of Slim\Http\UploadFile
// When file is uploaded via URL (Youtube, Vimeo, or image link) then we will get base64 encode string.
$size = null;

$title = $fileName;

if (is_object($fileData)) {
$size = $fileData->getSize();
$checksum = hash_file('md5', $fileData->file);
Expand All @@ -281,7 +284,7 @@ public function saveData($fileData, $fileName, $replace = false)
unset($fileData);

$fileData = $this->getFileInfo($fileName);
$fileData['title'] = Formatting::fileNameToFileTitle($fileName);
$fileData['title'] = Formatting::fileNameToFileTitle($title);
$fileData['filename'] = basename($filePath);
$fileData['storage'] = $this->config['adapter'];

Expand Down
5 changes: 4 additions & 1 deletion src/core/Directus/Filesystem/Thumbnailer.php
Expand Up @@ -179,9 +179,12 @@ public function contain()
// crop image
$img->resize($this->width, $this->height, function ($constraint) {
$constraint->aspectRatio();
if (ArrayUtils::get($options, 'preventUpsize')) {
$constraint->upsize();
}
});

if( ArrayUtils::get($options, 'resizeCanvas')) {
if (ArrayUtils::get($options, 'resizeCanvas')) {
$img->resizeCanvas($this->width, $this->height, ArrayUtils::get($options, 'position', 'center'), ArrayUtils::get($options, 'resizeRelative', false), ArrayUtils::get($options, 'canvasBackground', [255, 255, 255, 0]));
}

Expand Down

0 comments on commit 77a95be

Please sign in to comment.