Skip to content

Commit

Permalink
v8.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Feb 3, 2020
1 parent 430ea13 commit b704bf9
Show file tree
Hide file tree
Showing 1,220 changed files with 2,443 additions and 1,680 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Pull on server
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.0.2
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
host: ${{ secrets.DEMO_HOST }}
username: ${{ secrets.DEMO_USERNAME }}
password: ${{ secrets.DEMO_PASSWORD }}
port: ${{ secrets.DEMO_PORT }}
script: ./pull-latest.sh
9 changes: 5 additions & 4 deletions migrations/install/20180220023123_create_fields_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function change()
'default' => false
]);
$table->addColumn('validation', 'string', [
'limit' => 255,
'limit' => 500,
'null' => true,
'default' => null
]);
Expand Down Expand Up @@ -237,15 +237,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
32 changes: 26 additions & 6 deletions migrations/install/20180220023243_create_settings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,22 @@ public function change()
]
])
],
[
'collection' => 'directus_settings',
'field' => 'asset_url_naming',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'dropdown',
'locked' => 1,
'width' => 'half',
'note' => 'Thumbnail URL convention',
'sort' => 32,
'options' => json_encode([
'choices' => [
'private_hash' => 'Private Hash (Obfuscated)',
'filename_download' => 'File Name (Readable)'
]
])
],
[
'collection' => 'directus_settings',
'field' => 'file_mimetype_whitelist',
Expand All @@ -269,7 +285,7 @@ public function change()
'note' => 'Enter a file mimetype then hit enter (eg: image/jpeg)',
'locked' => 1,
'width' => 'half',
'sort' => 32
'sort' => 33
],
[
'collection' => 'directus_settings',
Expand All @@ -278,7 +294,7 @@ public function change()
'interface' => 'repeater',
'width' => 'full',
'note' => 'Defines how the thumbnail will be generated based on the requested params.',
'sort' => 33,
'sort' => 34,
'options' => json_encode([
'template' => '{{key}}',
'fields' => [
Expand Down Expand Up @@ -341,7 +357,7 @@ public function change()
'width' => 'half',
'hidden_browse' => 1,
'hidden_detail' => 1,
'sort' => 34
'sort' => 35
],
[
'collection' => 'directus_settings',
Expand All @@ -354,7 +370,7 @@ public function change()
'locked' => 1,
'width' => 'full',
'note' => 'Allows fetching more YouTube Embed info',
'sort' => 35
'sort' => 36
],
];

Expand Down Expand Up @@ -393,7 +409,7 @@ public function change()
],
[
'key' => 'default_locale',
'value' => 'en-US',
'value' => NULL,
],
[
'key' => 'telemetry',
Expand All @@ -417,7 +433,7 @@ public function change()
],
[
'key' => 'login_attempts_allowed',
'value' => '10'
'value' => '25'
],
[
'key' => 'trusted_proxies',
Expand All @@ -431,6 +447,10 @@ public function change()
'key' => 'file_naming',
'value' => 'uuid'
],
[
'key' => 'asset_url_naming',
'value' => 'private_hash'
],
[
'key' => 'youtube_api_key',
'value' => ''
Expand Down
2 changes: 2 additions & 0 deletions migrations/upgrades/20181105165224_upgrade_070006.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public function up()
'null' => true,
'default' => null,
]);

$table->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public function up()
'null' => true,
'default' => null
]);

$table->save();
}
}
51 changes: 45 additions & 6 deletions migrations/upgrades/20190318173400_add_nav_override.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,60 @@ class AddNavOverride extends AbstractMigration
{
public function up()
{
$table = $this->table('directus_roles');
if (!$table->hasColumn('nav_override')) {
$table->addColumn('nav_override', 'text', [
$rolesTable = $this->table('directus_roles');
$fieldsTable = $this->table('directus_fields');

if (!$rolesTable->hasColumn('nav_override')) {
$rolesTable->addColumn('nav_override', 'text', [
'null' => true
]);

$table->save();
$rolesTable->save();
}

$checkSql = 'SELECT 1 FROM `directus_fields` WHERE `field` = "nav_override" AND `collection` = "directus_roles";';
$result = $this->query($checkSql)->fetch();

if (!$result) {
$insertSql = 'INSERT INTO `directus_fields` (`collection`, `field`, `type`, `interface`, `options`, `locked`) VALUES ("directus_roles", "nav_override", "json", "code", "{\"template\":[{\"title\":\"$t:collections\",\"include\":\"collections\"},{\"title\":\"$t:bookmarks\",\"include\":\"bookmarks\"},{\"title\":\"$t:extensions\",\"include\":\"extensions\"},{\"title\":\"Custom Links\",\"links\":[{\"name\":\"RANGER Studio\",\"path\":\"https:\/\/rangerstudio.com\",\"icon\":\"star\"},{\"name\":\"Movies\",\"path\":\"\/collections\/movies\"}]}]}", 1);';
$this->execute($insertSql);
$fieldsTable->insert([
'collection' => 'directus_roles',
'field' => 'nav_override',
'type' => 'json',
'interface' => 'code',
'options' => json_encode([
'template' => [
[
'title' => '$t:collections',
'include' => 'collections'
],
[
'title' => '$t:bookmarks',
'include' => 'bookmarks'
],
[
'title' => '$t:extensions',
'include' => 'extensions'
],
[
'title' => 'Custom Links',
'links' => [
[
'name' => 'RANGER Studio',
'path' => 'https://rangerstudio.com',
'icon' => 'star'
],
[
'name' => 'Movies',
'path' => '/collections/movies'
]
]
]
]
]),
'locked' => 1
]);

$fieldsTable->save();
}
}
}
2 changes: 2 additions & 0 deletions migrations/upgrades/20190415125300_set_width.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ public function up()
$this->execute("UPDATE directus_fields SET width = 'half' WHERE width = '2';");
$this->execute("UPDATE directus_fields SET width = 'full' WHERE width = '3';");
$this->execute("UPDATE directus_fields SET width = 'full' WHERE width = '4';");

$table->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ public function up()
$table->changeColumn('value', 'text', [
'null' => true
]);

$table->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ public function up()
],
['collection' => 'directus_files', 'field' => 'duration']
));


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function change()
$this->getAdapter(),
'directus_fields',
[
'type' => \Directus\Database\Schema\DataTypes::TYPE_USER_CREATED,
'type' => \Directus\Database\Schema\DataTypes::TYPE_OWNER,
'interface' => 'user-created',
'sort' => 9
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function change()
],
[
'key' => 'default_locale',
'value' => 'en-US',
'value' => NULL,
],
[
'key' => 'telemetry',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public function change()
[
'collection' => 'directus_files',
'field' => 'uploaded_by',
'type' => \Directus\Database\Schema\DataTypes::TYPE_USER_CREATED,
'type' => \Directus\Database\Schema\DataTypes::TYPE_OWNER,
'interface' => 'user-created',
'locked' => 1,
'readonly' => 1,
Expand Down
110 changes: 110 additions & 0 deletions migrations/upgrades/20200108122313_add_asset_url_naming_setting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php


use Phinx\Migration\AbstractMigration;

class AddAssetURLNamingSetting extends AbstractMigration
{
public function change()
{
$fieldsTable = $this->table('directus_fields');
$settingsTable = $this->table('directus_settings');

if (!$this->checkFieldExist('directus_settings', 'asset_url_naming')) {
$fieldsTable->insert([
'collection' => 'directus_settings',
'field' => 'asset_url_naming',
'type' => \Directus\Database\Schema\DataTypes::TYPE_STRING,
'interface' => 'dropdown',
'locked' => 1,
'sort' => 32,
'width' => 'half',
'note' => 'Thumbnail URL convention',
'options' => json_encode([
'choices' => [
'private_hash' => 'Private Hash (Obfuscated)',
'filename_download' => 'File Name (Readable)'
]
])
])->save();
}

if ($this->checkFieldExist('directus_settings', 'file_mimetype_whitelist')) {
$this->execute(\Directus\phinx_update(
$this->getAdapter(),
'directus_fields',
[
'sort' => 33
],
['collection' => 'directus_settings', 'field' => 'file_mimetype_whitelist']
));
}

if ($this->checkFieldExist('directus_settings', 'asset_whitelist')) {
$this->execute(\Directus\phinx_update(
$this->getAdapter(),
'directus_fields',
[
'sort' => 34
],
['collection' => 'directus_settings', 'field' => 'asset_whitelist']
));
}

if ($this->checkFieldExist('directus_settings', 'asset_whitelist_system')) {
$this->execute(\Directus\phinx_update(
$this->getAdapter(),
'directus_fields',
[
'sort' => 35
],
['collection' => 'directus_settings', 'field' => 'asset_whitelist_system']
));
}

if ($this->checkFieldExist('directus_settings', 'youtube_api_key')) {
$this->execute(\Directus\phinx_update(
$this->getAdapter(),
'directus_fields',
[
'sort' => 36
],
['collection' => 'directus_settings', 'field' => 'youtube_api_key']
));
}

// -------------------------------------------------------------------------
// Add new setting fields
// -------------------------------------------------------------------------
$newSettings = [
[
'key' => 'asset_url_naming',
'value' => 'private_hash'
],
];

foreach ($newSettings as $setting) {
if ($this->hasSetting($setting['key']) == false) {
$settingsTable->insert($setting);
}
}

// -------------------------------------------------------------------------
// Save the changes
// -------------------------------------------------------------------------
$fieldsTable->save();
$settingsTable->save();
}

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();
}

public function hasSetting($field)
{
$checkSql = sprintf('SELECT 1 FROM `directus_settings` WHERE `key` = "%s"', $field);
return $this->query($checkSql)->fetch();
}
}
Loading

0 comments on commit b704bf9

Please sign in to comment.