Skip to content

Commit

Permalink
Exception Handling improved; syntax fixes, some dependencies updated. (
Browse files Browse the repository at this point in the history
…directus#829)

* JSON syntax fixed.

* composer dev dependencies updated.

* one missed PDOException being caught & handled.

* IfModule updated; checking for mod_fastcgi & mod_proxy_fcgi.

* check for mod_fastcgi removed.

* minor: syntax fixed.

* vuepress updated (automatically).

* phpunit 7.x actually is required.

* ignore added.

* ignore added.
  • Loading branch information
syslogic authored and rijkvanzanten committed Mar 18, 2019
1 parent be18300 commit bfd8d4d
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Icon
node_modules
yarn.lock
package-lock.json
/nbproject/

# Don't track composer phar/vendors
composer.phar
Expand Down Expand Up @@ -54,3 +55,4 @@ composer.lock
# Keep gitkeep files
# This will make sure empty directories has at least one file so it can be tracked by git
!**/.gitkeep
/docs/
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
"ext-gd": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.7.25"
"phpunit/phpunit": "^7.0.0",
"phpunit/php-code-coverage": "^6.1.4",
"phpunit/php-token-stream": "^3.0.0",
"phpunit/php-invoker": "^2.0.0",
"ext-tokenizer": "*"
},
"suggest": {
"paragonie/random_compat": "Generates cryptographically more secure pseudo-random bytes",
Expand Down
2 changes: 1 addition & 1 deletion config/api_sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
'app' => [
'env' => 'production',
'timezone' => 'America/New_York',
'timezone' => 'America/New_York'
],

'settings' => [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
},
"homepage": "https://github.com/directus/api#readme",
"devDependencies": {
"vuepress": "^0.7.1"
"vuepress": "^0.14.10"
}
}
14 changes: 10 additions & 4 deletions public/.htaccess
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Comment this line if you are getting: "Option SymLinksIfOwnerMatch not allowed here" error
# in Apache
# Comment this line if you are getting: "Option SymLinksIfOwnerMatch not allowed here" error in Apache
Options +SymLinksIfOwnerMatch

php_value upload_max_filesize 50M
php_value post_max_size 100M

# php5_module automatically handles HTTP_AUTHORIZATION headers, but fcgi_module does not.
<IfModule mod_setenvif.c>
<IfModule mod_proxy_fcgi.c>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
</IfModule>

<ifModule mod_rewrite.c>
RewriteEngine On

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

# Map all admin endpoints to the admin app (except static files)
RewriteCond %{REQUEST_FILENAME} !-f
Expand All @@ -17,4 +22,5 @@ php_value post_max_size 100M
# Map all other requests to invoke the API router (except static files)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^admin index.php?%{QUERY_STRING} [L]

</ifModule>
13 changes: 13 additions & 0 deletions src/core/Directus/Console/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,22 @@ private function cmd()
echo PHP_EOL . PHP_EOL . 'Module ' . $module . ' error: ' . $e->getMessage() . PHP_EOL . PHP_EOL;
} catch (UnsupportedCommandException $e) {
echo PHP_EOL . PHP_EOL . 'Module ' . $module . ' error: ' . $e->getMessage() . PHP_EOL . PHP_EOL;
} catch(\PDOException $e) {
$this->handlePdoException($e);
}
}

private function handlePdoException(\PDOException $e) {
$expected = "Duplicate entry 'directus_activity-id' for key 'idx_collection_field'";
if((int) $e->errorInfo[0] == 23000 && $e->errorInfo[2] == $expected) {
echo "The Database for ".$this->directusPath." had already been deployed.\n";
echo "You may use option -f to enforce the overwriting of existing data.";
} else {
throw($e);
}
exit(1);
}

private function showHelp()
{
echo PHP_EOL . 'Directus CLI Modules: ' . PHP_EOL . PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Exception/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"license": "GPL-3.0-only",
"require": {
"php": "^7.1",
"php": "^7.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Hook/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"license": "GPL-3.0-only",
"require": {
"php": "^7.1",
"php": "^7.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Util/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"license": "GPL-3.0-only",
"require": {
"php": "^7.1",
"php": "^7.1"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit bfd8d4d

Please sign in to comment.