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

Commit

Permalink
v2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Oct 27, 2018
1 parent 58747f2 commit beac886
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 24 deletions.
7 changes: 3 additions & 4 deletions public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ Options +SymLinksIfOwnerMatch

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

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

# Yield static media
# Map all other requests to invoke the API router (except static files)
RewriteCond %{REQUEST_FILENAME} !-f

# Map all other requests to the main front controller, invoking the API router
RewriteRule !^admin index.php?%{QUERY_STRING} [L]
</ifModule>

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.0.3';
const DIRECTUS_VERSION = '2.0.4';

/**
* NOT USED
Expand Down
3 changes: 1 addition & 2 deletions src/core/Directus/Database/Schema/SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ public function getField($tableName, $columnName, $skipCache = false)

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

// Create a column object based of the table schema data
$columnSchema = $this->createFieldFromArray($columnData);
Expand Down
12 changes: 10 additions & 2 deletions src/core/Directus/Database/Schema/Sources/MySQLSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public function getCollection($collectionName)
/**
* @inheritDoc
*/
public function getFields($tableName, $params = null)
public function getFields($tableName, array $params = [])
{
return $this->getAllFields(['collection' => $tableName]);
return $this->getAllFields(array_merge($params, ['collection' => $tableName]));
}

/**
Expand Down Expand Up @@ -202,6 +202,14 @@ public function getAllFields(array $params = [])
]);
}

if (isset($params['field'])) {
$where = $selectOne->where->nest();
$where->equalTo('DF.field', $params['field']);
$where->or;
$where->equalTo('SF.COLUMN_NAME', $params['field']);
$where->unnest();
}

$selectOne->order(['collection' => 'ASC', 'SF.ORDINAL_POSITION' => 'ASC']);

$selectTwo = new Select();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getCollection($collectionName);
*
* @return ResultSet
*/
public function getFields($tableName, $params = null);
public function getFields($tableName, array $params = []);

/**
* Gets all columns in the current schema
Expand Down
11 changes: 10 additions & 1 deletion src/core/Directus/Services/TablesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public function changeColumn($collectionName, $fieldName, array $data, array $pa
$this->validateFieldPayload($data, array_keys($data), $params);

// Remove field from data
ArrayUtils::pull($data, 'field');
ArrayUtils::remove($data, 'field');

// ----------------------------------------------------------------------------

Expand Down Expand Up @@ -813,6 +813,15 @@ protected function addFieldInfo($collection, $field, array $data)
'field' => $field
]);

// Get the Directus based on the source type
if (ArrayUtils::get($data, 'type') === null) {
$fieldObject = $this->getSchemaManager()->getField($collection, $field);

if ($fieldObject) {
$data['type'] = $this->getSchemaManager()->getSource()->getTypeFromSource($fieldObject->getDataType());
}
}

$collectionObject = $this->getSchemaManager()->getCollection('directus_fields');

return $this->getFieldsTableGateway()->createRecord(
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

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

return ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c::getLoader();
return ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b::getLoader();
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c
class ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b
{
private static $loader;

Expand All @@ -19,15 +19,15 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit03fd323c8f999d61dfaf5f19e934938c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit2c883ca79e89c0b0037789721d7a9e1b', 'loadClassLoader'));

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

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

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire03fd323c8f999d61dfaf5f19e934938c($fileIdentifier, $file);
composerRequire2c883ca79e89c0b0037789721d7a9e1b($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequire03fd323c8f999d61dfaf5f19e934938c($fileIdentifier, $file)
function composerRequire2c883ca79e89c0b0037789721d7a9e1b($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c
class ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
Expand Down Expand Up @@ -2963,10 +2963,10 @@ class ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$prefixesPsr0;
$loader->classMap = ComposerStaticInit03fd323c8f999d61dfaf5f19e934938c::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$prefixesPsr0;
$loader->classMap = ComposerStaticInit2c883ca79e89c0b0037789721d7a9e1b::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit beac886

Please sign in to comment.