From 9db5f1b5e3b6393c091b972911c0a0b41296ddde Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Aug 2021 16:11:37 +0200 Subject: [PATCH] Initial --- .gitignore | 1 + .hooks/pre-commit | 12 +++++ .prettierignore | 1 + .prettierrc | 11 ++++ .vscode/settings.json | 17 +++++++ Plugin.php | 20 ++++++++ README.md | 2 + composer.json | 9 ++++ config/config.php | 25 +++++++++ lang/en/lang.php | 9 ++++ package.json | 16 ++++++ plugin.yaml | 11 ++++ updates/builder_table_create_airports.php | 27 ++++++++++ ...builder_table_create_deferred_bindings.php | 30 +++++++++++ updates/version.yaml | 7 +++ yarn.lock | 51 +++++++++++++++++++ 16 files changed, 249 insertions(+) create mode 100644 .gitignore create mode 100755 .hooks/pre-commit create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .vscode/settings.json create mode 100644 Plugin.php create mode 100644 README.md create mode 100644 composer.json create mode 100644 config/config.php create mode 100644 lang/en/lang.php create mode 100644 package.json create mode 100644 plugin.yaml create mode 100644 updates/builder_table_create_airports.php create mode 100644 updates/builder_table_create_deferred_bindings.php create mode 100644 updates/version.yaml create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.hooks/pre-commit b/.hooks/pre-commit new file mode 100755 index 0000000..0b3203c --- /dev/null +++ b/.hooks/pre-commit @@ -0,0 +1,12 @@ +#!/bin/sh +FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.php' '*.html' '*.yaml' | sed 's| |\\ |g') +[ -z "$FILES" ] && exit 0 + +# Prettify all selected files +echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write + +# Add back the modified/prettified files to staging +echo "$FILES" | xargs git add + +exit 0 + diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5657f6e --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +vendor \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..2a038b8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 120, + "tabWidth": 2, + "singleQuote": true, + + "semi": true, + "trailingComma": "es5", + "arrowParens": "always", + + "phpVersion": "7.1" +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4ad0103 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[php]": + { + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + }, + "search.exclude": { + "**/vendor": true, + "**/node_modules": true, + "yarn.lock": true, + "package.json": true, + "tsconfig.json": true, + ".*": true, + }, +} \ No newline at end of file diff --git a/Plugin.php b/Plugin.php new file mode 100644 index 0000000..23a5bfa --- /dev/null +++ b/Plugin.php @@ -0,0 +1,20 @@ + [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => 'germanairlinesva_routes', + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => 'InnoDB', + 'options' => extension_loaded('pdo_mysql') + ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) + : [], + ], +]; diff --git a/lang/en/lang.php b/lang/en/lang.php new file mode 100644 index 0000000..599a624 --- /dev/null +++ b/lang/en/lang.php @@ -0,0 +1,9 @@ + [ + 'name' => 'GA Routes', + 'description' => '', + ], + 'menu' => [ + 'routes' => 'GA Routes', + ], +]; diff --git a/package.json b/package.json new file mode 100644 index 0000000..170549d --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "routes", + "version": "1.0.0", + "main": "Plugin.php", + "repository": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Routes.git", + "author": "German Airlines VA", + "license": "MIT", + "devDependencies": { + "@prettier/plugin-php": "^0.17.3", + "prettier": "^2.3.0" + }, + "scripts": { + "preinstall": "git config core.hooksPath .hooks", + "format": "prettier --write './**/*.{php,html,yaml}'" + } +} diff --git a/plugin.yaml b/plugin.yaml new file mode 100644 index 0000000..2f14875 --- /dev/null +++ b/plugin.yaml @@ -0,0 +1,11 @@ +plugin: + name: 'germanairlinesva.routes::lang.plugin.name' + description: 'germanairlinesva.routes::lang.plugin.description' + author: 'German Airlines VA' + icon: oc-icon-location-arrow + homepage: '' +navigation: + main-menu-item: + label: 'germanairlinesva.routes::lang.menu.routes' + url: / + icon: icon-location-arrow diff --git a/updates/builder_table_create_airports.php b/updates/builder_table_create_airports.php new file mode 100644 index 0000000..97cdd32 --- /dev/null +++ b/updates/builder_table_create_airports.php @@ -0,0 +1,27 @@ +create('airports', function ($table) { + $table->engine = 'InnoDB'; + $table->bigIncrements('id')->unsigned(); + $table->string('iata', 3); + $table->string('icao', 3); + $table->string('name'); + $table->string('country'); + $table->string('elevation'); + $table->string('latitude'); + $table->string('longitude'); + }); + } + + public function down() + { + Schema::connection('germanairlinesva_routes')->dropIfExists('airports'); + } +} diff --git a/updates/builder_table_create_deferred_bindings.php b/updates/builder_table_create_deferred_bindings.php new file mode 100644 index 0000000..be40996 --- /dev/null +++ b/updates/builder_table_create_deferred_bindings.php @@ -0,0 +1,30 @@ +create('deferred_bindings', function ($table) { + $table->engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->string('master_type'); + $table->string('master_field'); + $table->string('slave_type'); + $table->integer('slave_id'); + $table->mediumText('pivot_data')->nullable(); + $table->string('session_key'); + $table->boolean('is_bind')->default(true); + $table->timestamps(); + }); + } + + public function down() + { + Schema::connection('germanairlinesva_routes')->disableForeignKeyConstraints(); + Schema::connection('germanairlinesva_routes')->dropIfExists('deferred_bindings'); + Schema::connection('germanairlinesva_routes')->enableForeignKeyConstraints(); + } +} diff --git a/updates/version.yaml b/updates/version.yaml new file mode 100644 index 0000000..f0b4938 --- /dev/null +++ b/updates/version.yaml @@ -0,0 +1,7 @@ +1.0.1: + - 'Initialize plugin.' + - 'Create table deferred_bindings' + - builder_table_create_deferred_bindings.php +1.0.2: + - 'Create table airports' + - builder_table_create_airports.php diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..afc768a --- /dev/null +++ b/yarn.lock @@ -0,0 +1,51 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@prettier/plugin-php@^0.17.3": + version "0.17.3" + resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.17.3.tgz#193a18e308db7416f26f6e1dc0d2605d1ff01416" + integrity sha512-kD5IrGyKWF/p3XActVZ+GfbMl9knoK3XKBTG2bytpOtCO0+Q8eozimSgk/493rgFkXL3W2Ap/4GKgZf7u64+ow== + dependencies: + linguist-languages "^7.5.1" + mem "^8.0.0" + php-parser "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1" + +linguist-languages@^7.5.1: + version "7.15.0" + resolved "https://registry.yarnpkg.com/linguist-languages/-/linguist-languages-7.15.0.tgz#a93bed6b93015d8133622cb05da6296890862bfa" + integrity sha512-qkSSNDjDDycZ2Wcw+GziNBB3nNo3ddYUInM/PL8Amgwbd9RQ/BKGj2/1d6mdxKgBFnUqZuaDbkIwkE4KUwwmtQ== + +map-age-cleaner@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + +mem@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/mem/-/mem-8.1.1.tgz#cf118b357c65ab7b7e0817bdf00c8062297c0122" + integrity sha512-qFCFUDs7U3b8mBDPyz5EToEKoAkgCzqquIgi9nkkR9bixxOVOre+09lbuH7+9Kn2NFpm56M3GUWVbU2hQgdACA== + dependencies: + map-age-cleaner "^0.1.3" + mimic-fn "^3.1.0" + +mimic-fn@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-3.1.0.tgz#65755145bbf3e36954b949c16450427451d5ca74" + integrity sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ== + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= + +"php-parser@git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1": + version "3.0.2" + resolved "git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1" + +prettier@^2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" + integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==