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

Commit beac886

Browse files
committed
v2.0.4
1 parent 58747f2 commit beac886

File tree

9 files changed

+39
-24
lines changed

9 files changed

+39
-24
lines changed

public/.htaccess

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ Options +SymLinksIfOwnerMatch
77

88
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
99

10-
# Map all admin endpoints to the admin app
10+
# Map all admin endpoints to the admin app (except static files)
11+
RewriteCond %{REQUEST_FILENAME} !-f
1112
RewriteRule ^admin/(.*) admin/index.html [NC,L]
1213

13-
# Yield static media
14+
# Map all other requests to invoke the API router (except static files)
1415
RewriteCond %{REQUEST_FILENAME} !-f
15-
16-
# Map all other requests to the main front controller, invoking the API router
1716
RewriteRule !^admin index.php?%{QUERY_STRING} [L]
1817
</ifModule>
1918

src/core/Directus/Application/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Application extends App
1313
*
1414
* @var string
1515
*/
16-
const DIRECTUS_VERSION = '2.0.3';
16+
const DIRECTUS_VERSION = '2.0.4';
1717

1818
/**
1919
* NOT USED

src/core/Directus/Database/Schema/SchemaManager.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ public function getField($tableName, $columnName, $skipCache = false)
162162

163163
if (!$columnSchema || $skipCache) {
164164
// Get the column schema data from the source
165-
$columnResult = $this->source->getFields($tableName, ['column_name' => $columnName]);
166-
$columnData = $columnResult->current();
165+
$columnData = $this->source->getField($tableName, $columnName);
167166

168167
// Create a column object based of the table schema data
169168
$columnSchema = $this->createFieldFromArray($columnData);

src/core/Directus/Database/Schema/Sources/MySQLSchema.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ public function getCollection($collectionName)
136136
/**
137137
* @inheritDoc
138138
*/
139-
public function getFields($tableName, $params = null)
139+
public function getFields($tableName, array $params = [])
140140
{
141-
return $this->getAllFields(['collection' => $tableName]);
141+
return $this->getAllFields(array_merge($params, ['collection' => $tableName]));
142142
}
143143

144144
/**
@@ -202,6 +202,14 @@ public function getAllFields(array $params = [])
202202
]);
203203
}
204204

205+
if (isset($params['field'])) {
206+
$where = $selectOne->where->nest();
207+
$where->equalTo('DF.field', $params['field']);
208+
$where->or;
209+
$where->equalTo('SF.COLUMN_NAME', $params['field']);
210+
$where->unnest();
211+
}
212+
205213
$selectOne->order(['collection' => 'ASC', 'SF.ORDINAL_POSITION' => 'ASC']);
206214

207215
$selectTwo = new Select();

src/core/Directus/Database/Schema/Sources/SchemaInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getCollection($collectionName);
5353
*
5454
* @return ResultSet
5555
*/
56-
public function getFields($tableName, $params = null);
56+
public function getFields($tableName, array $params = []);
5757

5858
/**
5959
* Gets all columns in the current schema

src/core/Directus/Services/TablesService.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ public function changeColumn($collectionName, $fieldName, array $data, array $pa
588588
$this->validateFieldPayload($data, array_keys($data), $params);
589589

590590
// Remove field from data
591-
ArrayUtils::pull($data, 'field');
591+
ArrayUtils::remove($data, 'field');
592592

593593
// ----------------------------------------------------------------------------
594594

@@ -813,6 +813,15 @@ protected function addFieldInfo($collection, $field, array $data)
813813
'field' => $field
814814
]);
815815

816+
// Get the Directus based on the source type
817+
if (ArrayUtils::get($data, 'type') === null) {
818+
$fieldObject = $this->getSchemaManager()->getField($collection, $field);
819+
820+
if ($fieldObject) {
821+
$data['type'] = $this->getSchemaManager()->getSource()->getTypeFromSource($fieldObject->getDataType());
822+
}
823+
}
824+
816825
$collectionObject = $this->getSchemaManager()->getCollection('directus_fields');
817826

818827
return $this->getFieldsTableGateway()->createRecord(

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_once __DIR__ . '/composer/autoload_real.php';
66

7-
return ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c::getLoader();
7+
return ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b::getLoader();

vendor/composer/autoload_real.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c
5+
class ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b
66
{
77
private static $loader;
88

@@ -19,15 +19,15 @@ public static function getLoader()
1919
return self::$loader;
2020
}
2121

22-
spl_autoload_register(array('ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c', 'loadClassLoader'), true, true);
22+
spl_autoload_register(array('ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b', 'loadClassLoader'), true, true);
2323
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24-
spl_autoload_unregister(array('ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c', 'loadClassLoader'));
24+
spl_autoload_unregister(array('ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b', 'loadClassLoader'));
2525

2626
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
2727
if ($useStaticLoader) {
2828
require_once __DIR__ . '/autoload_static.php';
2929

30-
call_user_func(\Composer\Autoload\ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::getInitializer($loader));
3131
} else {
3232
$classMap = require __DIR__ . '/autoload_classmap.php';
3333
if ($classMap) {
@@ -39,19 +39,19 @@ public static function getLoader()
3939
$loader->register(true);
4040

4141
if ($useStaticLoader) {
42-
$includeFiles = Composer\Autoload\ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$files;
42+
$includeFiles = Composer\Autoload\ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$files;
4343
} else {
4444
$includeFiles = require __DIR__ . '/autoload_files.php';
4545
}
4646
foreach ($includeFiles as $fileIdentifier => $file) {
47-
composerRequire03fd323c8f999d61dfaf5f19e934938c($fileIdentifier, $file);
47+
composerRequire2c883ca79e89c0b0037789721d7a9e1b($fileIdentifier, $file);
4848
}
4949

5050
return $loader;
5151
}
5252
}
5353

54-
function composerRequire03fd323c8f999d61dfaf5f19e934938c($fileIdentifier, $file)
54+
function composerRequire2c883ca79e89c0b0037789721d7a9e1b($fileIdentifier, $file)
5555
{
5656
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
5757
require $file;

vendor/composer/autoload_static.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c
7+
class ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b
88
{
99
public static $files = array (
1010
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@@ -2963,10 +2963,10 @@ class ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c
29632963
public static function getInitializer(ClassLoader $loader)
29642964
{
29652965
return \Closure::bind(function () use ($loader) {
2966-
$loader->prefixLengthsPsr4 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixLengthsPsr4;
2967-
$loader->prefixDirsPsr4 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixDirsPsr4;
2968-
$loader->prefixesPsr0 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixesPsr0;
2969-
$loader->classMap = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$classMap;
2966+
$loader->prefixLengthsPsr4 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixLengthsPsr4;
2967+
$loader->prefixDirsPsr4 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixDirsPsr4;
2968+
$loader->prefixesPsr0 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixesPsr0;
2969+
$loader->classMap = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$classMap;
29702970

29712971
}, null, ClassLoader::class);
29722972
}

0 commit comments

Comments
 (0)