Skip to content

Commit

Permalink
v8.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Jan 14, 2020
1 parent 7c2e887 commit c894e67
Show file tree
Hide file tree
Showing 1,283 changed files with 4,716 additions and 8,615 deletions.
17 changes: 9 additions & 8 deletions migrations/install/20180220023208_create_files_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class CreateFilesTable extends AbstractMigration
{
/**
/**
* Create Files Table
*/
public function change()
Expand Down Expand Up @@ -162,7 +162,7 @@ public function change()
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'wysiwyg',
'options' => json_encode([
'toolbar' => ['bold','italic','underline','link','code']
'toolbar' => ['bold', 'italic', 'underline', 'link', 'code']
]),
'sort' => 5,
'width' => 'full',
Expand Down Expand Up @@ -198,7 +198,7 @@ public function change()
'collection' => 'directus_files',
'field' => 'private_hash',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface'=> 'slug',
'interface' => 'slug',
'width' => 'half',
'locked' => 1,
'sort' => 8,
Expand Down Expand Up @@ -237,8 +237,8 @@ public function change()
[
'collection' => 'directus_files',
'field' => 'uploaded_by',
'type' => \Directus\Database\Schema\DataTypes::TYPE_USER_CREATED,
'interface' => 'user-created',
'type' => \Directus\Database\Schema\DataTypes::TYPE_OWNER,
'interface' => 'owner',
'locked' => 1,
'readonly' => 1,
'sort' => 11,
Expand Down Expand Up @@ -384,15 +384,16 @@ public function change()
]
];

foreach($data as $value){
if(!$this->checkFieldExist($value['collection'], $value['field'])){
foreach ($data as $value) {
if (!$this->checkFieldExist($value['collection'], $value['field'])) {
$fileds = $this->table('directus_fields');
$fileds->insert($value)->save();
}
}
}

public function checkFieldExist($collection,$field){
public function checkFieldExist($collection, $field)
{
$checkSql = sprintf('SELECT 1 FROM `directus_fields` WHERE `collection` = "%s" AND `field` = "%s";', $collection, $field);
return $this->query($checkSql)->fetch();
}
Expand Down
105 changes: 45 additions & 60 deletions migrations/install/20180220023243_create_settings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,6 @@ public function change()
]
])
],
[
'collection' => 'directus_settings',
'field' => 'file_max_size',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'text-input',
'options' => json_encode([
'placeholder' => 'eg: 4MB',
'iconRight' => 'storage'
]),
'locked' => 1,
'width' => 'half',
'sort' => 32
],
[
'collection' => 'directus_settings',
'field' => 'file_mimetype_whitelist',
Expand All @@ -279,9 +266,10 @@ public function change()
'options' => json_encode([
'placeholder' => 'Enter a file mimetype then hit enter (eg: image/jpeg)'
]),
'note' => 'Enter a file mimetype then hit enter (eg: image/jpeg)',
'locked' => 1,
'width' => 'full',
'sort' => 33
'width' => 'half',
'sort' => 32
],
[
'collection' => 'directus_settings',
Expand All @@ -290,7 +278,7 @@ public function change()
'interface' => 'repeater',
'width' => 'full',
'note' => 'Defines how the thumbnail will be generated based on the requested params.',
'sort' => 34,
'sort' => 33,
'options' => json_encode([
'template' => '{{key}}',
'fields' => [
Expand Down Expand Up @@ -353,7 +341,7 @@ public function change()
'width' => 'half',
'hidden_browse' => 1,
'hidden_detail' => 1,
'sort' => 35
'sort' => 34
],
[
'collection' => 'directus_settings',
Expand All @@ -366,12 +354,12 @@ public function change()
'locked' => 1,
'width' => 'full',
'note' => 'Allows fetching more YouTube Embed info',
'sort' => 36
'sort' => 35
],
];

foreach($data as $value){
if(!$this->checkFieldExist($value['collection'], $value['field'])){
foreach ($data as $value) {
if (!$this->checkFieldExist($value['collection'], $value['field'])) {
$fileds = $this->table('directus_fields');
$fileds->insert($value)->save();
}
Expand All @@ -380,76 +368,72 @@ public function change()
// Insert into settings table
$data = [
[
'key' => 'project_url',
'value' => ''
'key' => 'project_url',
'value' => ''
],
[
'key' => 'project_logo',
'value' => ''
'key' => 'project_logo',
'value' => ''
],
[
'key' => 'project_color',
'value' => '#263238',
'key' => 'project_color',
'value' => '#263238',
],
[
'key' => 'project_foreground',
'value' => '',
'key' => 'project_foreground',
'value' => '',
],
[
'key' => 'project_background',
'value' => '',
'key' => 'project_background',
'value' => '',
],
[
'key' => 'project_public_note',
'value' => '',
'key' => 'project_public_note',
'value' => '',
],
[
'key' => 'default_locale',
'value' => 'en-US',
'key' => 'default_locale',
'value' => 'en-US',
],
[
'key' => 'telemetry',
'value' => '1',
'key' => 'telemetry',
'value' => '1',
],
[
'key' => 'default_limit',
'value' => '200'
'key' => 'default_limit',
'value' => '200'
],
[
'key' => 'sort_null_last',
'value' => '1'
'key' => 'sort_null_last',
'value' => '1'
],
[
'key' => 'password_policy',
'value' => ''
'key' => 'password_policy',
'value' => ''
],
[
'key' => 'auto_sign_out',
'value' => '10080'
'key' => 'auto_sign_out',
'value' => '10080'
],
[
'key' => 'login_attempts_allowed',
'value' => '10'
'key' => 'login_attempts_allowed',
'value' => '10'
],
[
'key' => 'trusted_proxies',
'value' => ''
'key' => 'trusted_proxies',
'value' => ''
],
[
'key' => 'file_max_size',
'value' => '100MB'
],
[
'key' => 'file_mimetype_whitelist',
'value' => ''
'key' => 'file_mimetype_whitelist',
'value' => ''
],
[
'key' => 'file_naming',
'value' => 'uuid'
],
[
'key' => 'youtube_api_key',
'value' => ''
'key' => 'youtube_api_key',
'value' => ''
],
[
'key' => 'asset_whitelist',
Expand Down Expand Up @@ -510,13 +494,14 @@ public function change()
]
])
]
];
];

$groups = $this->table('directus_settings');
$groups->insert($data)->save();
$groups = $this->table('directus_settings');
$groups->insert($data)->save();
}

public function checkFieldExist($collection,$field){
public function checkFieldExist($collection, $field)
{
$checkSql = sprintf('SELECT 1 FROM `directus_fields` WHERE `collection` = "%s" AND `field` = "%s";', $collection, $field);
return $this->query($checkSql)->fetch();
}
Expand Down
24 changes: 21 additions & 3 deletions migrations/install/20180220023248_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ public function change()
'default' => null
]);

$table->addColumn('password_reset_token', 'string', [
'limit' => 520,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addIndex('email', [
'unique' => true,
'name' => 'idx_users_email'
Expand Down Expand Up @@ -514,6 +521,7 @@ public function change()
'hidden_detail' => 1,
'sort' => 18
],

[
'collection' => 'directus_users',
'field' => 'last_page',
Expand All @@ -535,17 +543,27 @@ public function change()
'hidden_detail' => 1,
'hidden_browse' => 1
],
[
'collection' => 'directus_users',
'field' => 'password_reset_token',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'text-input',
'locked' => 1,
'readonly' => 1,
'hidden_detail' => 1
],
];

foreach($data as $value){
if(!$this->checkFieldExist($value['collection'], $value['field'])){
foreach ($data as $value) {
if (!$this->checkFieldExist($value['collection'], $value['field'])) {
$fileds = $this->table('directus_fields');
$fileds->insert($value)->save();
}
}
}

public function checkFieldExist($collection,$field){
public function checkFieldExist($collection, $field)
{
$checkSql = sprintf('SELECT 1 FROM `directus_fields` WHERE `collection` = "%s" AND `field` = "%s";', $collection, $field);
return $this->query($checkSql)->fetch();
}
Expand Down
29 changes: 0 additions & 29 deletions migrations/upgrades/20190709053719_add_file_max_size_setting.php

This file was deleted.

Loading

0 comments on commit c894e67

Please sign in to comment.