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

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Jun 27, 2019
1 parent b8739c9 commit b508d09
Show file tree
Hide file tree
Showing 144 changed files with 807 additions and 491 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@

> _The Directus 7 App has been rebuilt from the ground-up in Vue.js and decoupled from our new "versionless" API. Both can easily be customized and extended to suit your project's needs._

<p align="center">
<img src="https://semaphoreci.com/api/v1/directus/app/branches/build/badge.svg">
</p>

<p>&nbsp;</p>

## 🐰 Introduction
Expand Down Expand Up @@ -121,7 +116,7 @@ Directus allows you to manage multilingual content in as many languages as your
We have two online demos available so you can easily check out Directus in action. These demos are public and is therefore susceptible to trolls who think it's funny to write offensive things or change the master user password. The entire database is reset each hour to mitigate this. The login credentials for both demos: `admin@example.com` and `password`

* **[Stable](https://directus.app)** — This demo showcases the [latest release](https://github.com/directus/directus/releases/latest) of the Directus suite.
* **[Canary](https://next.directus.app)** — This demo uses the [latest commits](https://github.com/directus/directus/commits/master) from the `master` branch.
* **[Nightly](https://nightly.directus.app)** — This demo uses the [latest commits](https://github.com/directus/directus/commits/master) from the `master` branch.

<p>&nbsp;</p>

Expand Down
102 changes: 59 additions & 43 deletions migrations/db/seeds/FieldsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ public function run()
'interface' => 'many-to-many',
'locked' => 1,
'options' => json_encode([
'fields' => "first_name,last_name"
'fields' => "first_name,last_name"
])
],
[
Expand Down Expand Up @@ -1123,6 +1123,22 @@ public function run()
'note' => 'This image will be used when trying to generate a thumbnail with invalid options or an error happens on the server when creating the image.',
'sort' => 13
],
[
'collection' => 'directus_settings',
'field' => 'file_naming',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'dropdown',
'locked' => 1,
'width' => 'full',
'note' => 'The file-system naming convention for uploads.',
'sort' => 14,
'options' => json_encode([
'choices' => [
'uuid' => 'File Hash (Obfuscated)',
'file_name' => 'File Name (Readable)'
]
])
],


// Users
Expand All @@ -1143,48 +1159,48 @@ public function run()
'type' => \Directus\Database\Schema\DataTypes::TYPE_STATUS,
'interface' => 'status',
'options' => json_encode([
'status_mapping' => [
'draft' => [
'name' => 'Draft',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'invited' => [
'name' => 'Invited',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'active' => [
'name' => 'Active',
'text_color' => 'white',
'background_color' => 'success',
'listing_subdued' => false,
'listing_badge' => false,
'soft_delete' => false,
],
'suspended' => [
'name' => 'Suspended',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'deleted' => [
'name' => 'Deleted',
'text_color' => 'white',
'background_color' => 'danger',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => true,
]
]
'status_mapping' => [
'draft' => [
'name' => 'Draft',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'invited' => [
'name' => 'Invited',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'active' => [
'name' => 'Active',
'text_color' => 'white',
'background_color' => 'success',
'listing_subdued' => false,
'listing_badge' => false,
'soft_delete' => false,
],
'suspended' => [
'name' => 'Suspended',
'text_color' => 'white',
'background_color' => 'light-gray',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => false,
],
'deleted' => [
'name' => 'Deleted',
'text_color' => 'white',
'background_color' => 'danger',
'listing_subdued' => false,
'listing_badge' => true,
'soft_delete' => true,
]
]
]),
'locked' => 1,
'sort' => 2,
Expand Down
130 changes: 67 additions & 63 deletions migrations/db/seeds/SettingsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,72 @@

class SettingsSeeder extends AbstractSeed
{
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run()
{
$data = [
[
'key' => 'logo',
'value' => ''
],
[
'key' => 'color',
'value' => 'darkest-gray',
],
[
'key' => 'default_limit',
'value' => '200'
],
[
'key' => 'sort_null_last',
'value' => '1'
],
[
'key' => 'auto_sign_out',
'value' => '60'
],
[
'key' => 'youtube_api_key',
'value' => ''
],
[
'key' => 'trusted_proxies',
'value' => ''
],
[
'key' => 'thumbnail_dimensions',
'value' => '200x200'
],
[
'key' => 'thumbnail_quality_tags',
'value' => '{"poor": 25, "good": 50, "better": 75, "best": 100}'
],
[
'key' => 'thumbnail_actions',
'value' => '{"contain":{"options":{"resizeCanvas":false,"position":"center","resizeRelative":false,"canvasBackground":"ccc"}},"crop":{"options":{"position":"center"}}}'
],
[
'key' => 'thumbnail_cache_ttl',
'value' => '86400'
],
[
'key' => 'thumbnail_not_found_location',
'value' => ''
]
];
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run()
{
$data = [
[
'key' => 'logo',
'value' => ''
],
[
'key' => 'color',
'value' => 'darkest-gray',
],
[
'key' => 'default_limit',
'value' => '200'
],
[
'key' => 'sort_null_last',
'value' => '1'
],
[
'key' => 'auto_sign_out',
'value' => '60'
],
[
'key' => 'youtube_api_key',
'value' => ''
],
[
'key' => 'trusted_proxies',
'value' => ''
],
[
'key' => 'thumbnail_dimensions',
'value' => '200x200'
],
[
'key' => 'thumbnail_quality_tags',
'value' => '{"poor": 25, "good": 50, "better": 75, "best": 100}'
],
[
'key' => 'thumbnail_actions',
'value' => '{"contain":{"options":{"resizeCanvas":false,"position":"center","resizeRelative":false,"canvasBackground":"ccc"}},"crop":{"options":{"position":"center"}}}'
],
[
'key' => 'thumbnail_cache_ttl',
'value' => '86400'
],
[
'key' => 'thumbnail_not_found_location',
'value' => ''
],
[
'key' => 'file_naming',
'value' => 'uuid'
]
];

$groups = $this->table('directus_settings');
$groups->insert($data)->save();
}
$groups = $this->table('directus_settings');
$groups->insert($data)->save();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
use Phinx\Migration\AbstractMigration;
use function GuzzleHttp\json_encode;

class AddFileNamingInSetting extends AbstractMigration
{
public function up()
{
$fieldObject = [
'field' => 'file_naming',
'type' => 'string',
'interface' => 'dropdown',
'options' => ['choices' => ['uuid' => 'File Hash (Obfuscated)', 'file_name' => 'File Name (Readable)']]
];
$collection = 'directus_settings';
$checkSql = sprintf('SELECT 1 FROM `directus_fields` WHERE `collection` = "%s" AND `field` = "%s";', $collection, $fieldObject['field']);
$result = $this->query($checkSql)->fetch();
if (!$result) {
$insertSqlFormat = "INSERT INTO `directus_fields` (`collection`, `field`, `type`, `interface`, `options`) VALUES ('%s', '%s', '%s', '%s' , '%s');";
$insertSql = sprintf($insertSqlFormat, $collection, $fieldObject['field'], $fieldObject['type'], $fieldObject['interface'], json_encode($fieldObject['options']));
$this->execute($insertSql);
}
}
}
5 changes: 3 additions & 2 deletions public/uploads/_/originals/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
ExpiresDefault "access 1 year"
</IfModule>

<FilesMatch "\.(php|phps|php5|htm|shtml|xhtml|cgi.+)$">
ForceType text/plain
<FilesMatch "\.(php|phps|php5|phtml|htm|shtml|xhtml|cgi.+)$">
order allow,deny
deny from all
</FilesMatch>

# Respond with 404 if the file doesn't exists
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Application extends App
*
* @var string
*/
const DIRECTUS_VERSION = '2.2.0';
const DIRECTUS_VERSION = '2.2.1';

/**
* NOT USED
Expand Down
17 changes: 12 additions & 5 deletions src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ protected function getEmitter()

return $payload;
});
$addFilesUrl = function ($rows, $params = []) {
return \Directus\append_storage_information($rows, $params);
$addFilesUrl = function ($rows) {
return \Directus\append_storage_information($rows);
};
$emitter->addFilter('item.read.directus_files:before', function (Payload $payload) {
$columns = $payload->get('columns');
Expand Down Expand Up @@ -526,7 +526,7 @@ protected function getEmitter()
// Add file url and thumb url
$emitter->addFilter('item.read.directus_files', function (Payload $payload) use ($addFilesUrl, $container) {

$rows = $addFilesUrl($payload->getData(), $payload->attribute('params'));
$rows = $addFilesUrl($payload->getData());

$payload->replace($rows);

Expand Down Expand Up @@ -947,7 +947,7 @@ protected function getCache()
} else {
$host = (isset($poolConfig['host'])) ? $poolConfig['host'] : 'localhost';
$port = (isset($poolConfig['port'])) ? $poolConfig['port'] : 11211;

$client->addServer($host, $port);
}
$pool = $adapter == 'memcached' ? new MemcachedCachePool($client) : new MemcacheCachePool($client);
Expand All @@ -956,9 +956,16 @@ protected function getCache()
if ($adapter == 'redis') {
$host = (isset($poolConfig['host'])) ? $poolConfig['host'] : 'localhost';
$port = (isset($poolConfig['port'])) ? $poolConfig['port'] : 6379;
$socket = (isset($poolConfig['socket'])) ? $poolConfig['socket'] : null;

$client = new \Redis();
$client->connect($host, $port);

if ($socket) {
$client->connect($socket);
} else {
$client->connect($host, $port);
}

$pool = new RedisCachePool($client);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public function __construct()
{
parent::__construct('Expired Request Token');
}

public function getStatusCode()
{
return 401;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public function __construct()
{
parent::__construct('Invalid Request Token');
}

public function getStatusCode()
{
return 401;
}
}

0 comments on commit b508d09

Please sign in to comment.