This commit is contained in:
Marko
2025-07-17 18:43:41 +02:00
parent 5461d4be67
commit 24dd57cb18
58 changed files with 1731 additions and 830 deletions

BIN
.DS_Store vendored

Binary file not shown.

5
.ddev/.global_commands/.gitattributes vendored Executable file
View File

@@ -0,0 +1,5 @@
# #ddev-generated
# Everything in the commands directory needs LF line-endings
# Not CRLF as from Windows.
# bash especially just can't cope if it finds CRLF in a script.
* -text eol=lf

11
.ddev/.global_commands/db/mysql Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
## #ddev-generated
## Description: run mysql client in db container
## Usage: mysql [flags] [args]
## Example: "ddev mysql" or "ddev mysql -uroot -proot" or "echo 'SHOW TABLES;' | ddev mysql"
## `ddev mysql --database=mysql -uroot -proot` gets you to the 'mysql' database with root privileges
## DBTypes: mysql,mariadb
## ExecRaw: true
mysql -udb -pdb "$@"

10
.ddev/.global_commands/db/psql Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#ddev-generated
## Description: run pgsql client in db container
## Usage: psql [flags] [args]
## Example: "ddev psql" or "ddev psql -U db somedb" or "echo 'SELECT current_database();' | ddev psql"
## DBTypes: postgres
## ExecRaw: true
psql "$@"

View File

@@ -0,0 +1,47 @@
#!/bin/bash
## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Run DBeaver against current db
## Usage: dbeaver
## Example: "ddev dbeaver [db] [user]"
## OSTypes: darwin,linux
## HostBinaryExists: /Applications/DBeaver.app,/usr/bin/dbeaver,/usr/bin/dbeaver-ce,/usr/bin/dbeaver-le,/usr/bin/dbeaver-ue,/usr/bin/dbeaver-ee,/var/lib/flatpak/exports/bin/io.dbeaver.DBeaverCommunity,/snap/bin/dbeaver-ce
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
database="${1:-db}"
user="${2:-root}"
type="$(echo $DDEV_DATABASE | sed 's/:.*//')"
if [ "${type}" = "postgres" ]; then
type="postgresql"
user="${2:-db}"
fi
# See: https://dbeaver.com/docs/wiki/Command-Line/#connection-parameters
CONNECTION="name=ddev-${DDEV_PROJECT}|driver=${type}|database=${database}|user=${user}|password=${user}|savePassword=true|host=127.0.0.1|port=${DDEV_HOST_DB_PORT}|openConsole=true|folder=DDEV"
case $OSTYPE in
"linux-gnu")
# Check for different binaries. Launch the first one found.
BINARIES=(
/usr/bin/dbeaver{,-ce,-le,-ue,-ee}
/var/lib/flatpak/exports/bin/io.dbeaver.DBeaverCommunity
/snap/bin/dbeaver-ce
)
for binary in "${BINARIES[@]}"; do
if [ -x "$binary" ]; then
echo "Launching $binary"
$binary -con "$CONNECTION" &> /dev/null & disown
exit 0
fi
done
;;
"darwin"*)
open -a dbeaver.app --args -con "$CONNECTION" &
echo "Attempted to launch DBeaver.app"
;;
esac

View File

@@ -0,0 +1,25 @@
#!/bin/bash
## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Run HeidiSQL against current db
## Usage: heidisql
## Example: "ddev heidisql"
## OSTypes: windows,wsl2
## HostBinaryExists: /mnt/c/Program Files/HeidiSQL/heidisql.exe,C:\Program Files\HeidiSQL\Heidisql.exe
arguments="--host=\"127.0.0.1\" --port=${DDEV_HOST_DB_PORT} --user=root --password=root --description=${DDEV_SITENAME}"
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
case $OSTYPE in
"win*"* | "msys"*)
'/c/Program Files/HeidiSQL/heidisql.exe' $arguments &
;;
# linux-gnu in this case is only WSL2 as selected in OSTypes above
"linux-gnu")
# HeidiSQL is Microsoft only, but we want to start it from WSL2
"/mnt/c/Program Files/HeidiSQL/heidisql.exe" $arguments &
;;
esac

View File

@@ -0,0 +1,75 @@
#!/bin/bash
## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Launch a browser with the current site
## Usage: launch [path] [-m|--mailpit]
## Example: "ddev launch" or "ddev launch /admin/reports/status/php" or "ddev launch phpinfo.php", for Mailpit "ddev launch -m"
## Flags: [{"Name":"mailpit","Shorthand":"m","Usage":"ddev launch -m launches the mailpit UI"}]
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
FULLURL=${DDEV_PRIMARY_URL}
HTTPS=""
if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then HTTPS=true; fi
while :; do
case ${1:-} in
-p|--phpmyadmin)
echo "phpMyAdmin is no longer built into DDEV, please 'ddev get ddev/ddev-phpmyadmin' and use 'ddev phpmyadmin' to launch phpMyAdmin" && exit 2
;;
-m|--mailpit|--mailhog)
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]] || [[ "${CODESPACES}" == "true" ]]; then
FULLURL="${FULLURL/-${DDEV_HOST_WEBSERVER_PORT}/-${DDEV_HOST_MAILPIT_PORT}}"
else
if [ "${HTTPS}" = "" ]; then
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILPIT_PORT}"
else
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILPIT_HTTPS_PORT}"
fi
fi
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
if [ -n "${1:-}" ] ; then
if [[ ${1::1} != "/" ]] ; then
FULLURL="${FULLURL}/";
fi
FULLURL="${FULLURL}${1}";
fi
if [ ! -z ${DDEV_DEBUG:-} ]; then
printf "FULLURL $FULLURL\n" && exit 0
fi
case $OSTYPE in
linux-gnu)
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]]; then
gp preview ${FULLURL}
else
xdg-open ${FULLURL}
fi
;;
"darwin"*)
open ${FULLURL}
;;
"win*"* | "msys"*)
start ${FULLURL}
;;
esac

View File

@@ -0,0 +1,8 @@
#!/bin/bash
## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Launch a browser with Mailpit (an email & SMTP testing tool)
## Usage: mailpit
## Example: "ddev mailpit"
ddev launch -m

View File

@@ -0,0 +1,19 @@
#!/bin/bash
#ddev-generated
# Support for Querious, https://www.araelium.com/querious
## Description: Run querious with current project database
## Usage: querious [database]
## Example: "ddev querious"
## OSTypes: darwin
## HostBinaryExists: /Applications/Querious.app
## DBTypes: mysql,mariadb
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
DATABASE="${1:-db}"
open "querious://connect/new?host=127.0.0.1&user=db&password=db&use-compression=false&database=${DATABASE}&port=${DDEV_HOST_DB_PORT}"

View File

@@ -0,0 +1,44 @@
#!/bin/bash
#ddev-generated
## Description: Explain how to upgrade DDEV
## Usage: self-upgrade
## Example: "ddev self-upgrade"
## CanRunGlobally: true
mypath=$(which ddev)
case $mypath in
"/usr/bin/ddev")
if [[ ${OSTYPE} = "linux-gnu"* ]]; then
if command -v apt; then echo "You seem to have an apt-installed ddev, upgrade with 'sudo apt update && sudo apt upgrade -y ddev'";
elif [ -f /etc/arch-release ] && command -v yay >/dev/null ; then echo "You seem to have yay-installed ddev (AUR), upgrade with 'yay -Syu ddev-bin'";
elif command -v dnf; then echo "You seem to have dnf-installed ddev, upgrade with 'sudo dnf install --refresh ddev'"; fi
fi
;;
"/usr/local/bin/ddev")
if [ ! -L /usr/local/bin/ddev ]; then
printf "DDEV appears to have been installed with install_ddev.sh, you can run that script again to update.\ncurl -fsSL https://raw.githubusercontent.com/ddev/ddev/master/scripts/install_ddev.sh | bash\n"
elif command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;
"/opt/homebrew/bin/ddev" | "/home/linuxbrew/.linuxbrew/bin/ddev")
if [ -L "$(which ddev)" ] && command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;
"/c/Program Files/DDEV/ddev")
printf "DDEV was either installed with\nchoco install -y ddev\nor with the installer package.\n"
echo "You can upgrade with 'choco upgrade -y ddev'"
echo "Or by downloading the Windows installer from https://github.com/ddev/ddev/releases"
;;
*)
echo "Unable to determine how you installed ddev, but you can remove $mypath and reinstall with one of the techniques in https://ddev.readthedocs.io/en/latest/users/install/ddev-installation/"
esac

View File

@@ -0,0 +1,21 @@
#!/bin/bash
#ddev-generated
## Description: Run sequelace with current project database
## Usage: sequelace
## Example: "ddev sequelace" or "ddev sequelace database2" to open a database named "database2".
## OSTypes: darwin
## HostBinaryExists: /Applications/Sequel ace.app
## DBTypes: mysql,mariadb
DATABASE="${1:-db}"
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
query="mysql://root:root@${DDEV_PROJECT}.${DDEV_TLD}:${DDEV_HOST_DB_PORT}/${DATABASE}"
set -x
open "$query" -a "/Applications/Sequel Ace.app/Contents/MacOS/Sequel Ace"

View File

@@ -0,0 +1,82 @@
#!/bin/bash
#ddev-generated
## Description: Run sequelpro with current project database
## Usage: sequelpro
## Example: "ddev sequelpro"
## OSTypes: darwin
## HostBinaryExists: /Applications/Sequel Pro.app
## DBTypes: mysql,mariadb
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
tmpdir=$(mktemp -d -t sequelpro-XXXXXXXXXX)
templatepath="$tmpdir/sequelpro.spf"
cat >$templatepath <<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ContentFilters</key>
<dict/>
<key>auto_connect</key>
<true/>
<key>data</key>
<dict>
<key>connection</key>
<dict>
<key>database</key>
<string>db</string>
<key>host</key>
<string>127.0.0.1</string>
<key>name</key>
<string>${DDEV_SITENAME}</string>
<key>password</key>
<string>root</string>
<key>port</key>
<integer>$DDEV_HOST_DB_PORT</integer>
<key>rdbms_type</key>
<string>mysql</string>
<key>sslCACertFileLocation</key>
<string></string>
<key>sslCACertFileLocationEnabled</key>
<integer>0</integer>
<key>sslCertificateFileLocation</key>
<string></string>
<key>sslCertificateFileLocationEnabled</key>
<integer>0</integer>
<key>sslKeyFileLocation</key>
<string></string>
<key>sslKeyFileLocationEnabled</key>
<integer>0</integer>
<key>type</key>
<string>SPTCPIPConnection</string>
<key>useSSL</key>
<integer>0</integer>
<key>user</key>
<string>root</string>
</dict>
</dict>
<key>encrypted</key>
<false/>
<key>format</key>
<string>connection</string>
<key>queryFavorites</key>
<array/>
<key>queryHistory</key>
<array/>
<key>rdbms_type</key>
<string>mysql</string>
<key>rdbms_version</key>
<string>5.5.44</string>
<key>version</key>
<integer>1</integer>
</dict>
</plist>
END
open "${templatepath}"

View File

@@ -0,0 +1,32 @@
#!/bin/bash
#ddev-generated
# Support for TablePlus, https://tableplus.com/
# This command is available on macOS and WSL2 if TablePlus is installed in the default location.
## Description: Run tableplus with current project database
## Usage: tableplus
## Example: "ddev tableplus"
## OSTypes: darwin,wsl2
## HostBinaryExists: /Applications/TablePlus.app,/mnt/c/Program Files/TablePlus/TablePlus.exe
if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
echo "Project ${DDEV_PROJECT} is not running, starting it"
ddev start
fi
dbtype=${DDEV_DBIMAGE%:*}
driver=mysql
if [[ $dbtype == "postgres" ]]; then
driver=$dbtype
fi
query="${driver}://db:db@127.0.0.1:${DDEV_HOST_DB_PORT}/db?Enviroment=local&Name=ddev-${DDEV_SITENAME}"
case $OSTYPE in
"linux-gnu")
"/mnt/c/Program Files/TablePlus/TablePlus.exe" $query >/dev/null &
;;
"darwin"*)
set -x
open "$query" -a "/Applications/TablePlus.app/Contents/MacOS/TablePlus"
;;
esac

View File

@@ -0,0 +1,11 @@
#!/bin/bash
#ddev-generated
## Description: Run artisan CLI inside the web container
## Usage: artisan [flags] [args]
## Example: "ddev artisan list" or "ddev artisan cache:clear"
## ProjectTypes: laravel
## ExecRaw: true
php ./artisan "$@"

View File

@@ -0,0 +1,65 @@
#!/bin/bash
#ddev-generated: Remove this line to take over this script
## Description: Enable or disable blackfire.io profiling
## Usage: blackfire start|stop|on|off|enable|disable|true|false|status
## Example: "ddev blackfire" (default is "on"), "ddev blackfire off", "ddev blackfire on", "ddev blackfire status"
## ExecRaw: false
## Flags: []
function enable {
if [ -z ${BLACKFIRE_SERVER_ID} ] || [ -z ${BLACKFIRE_SERVER_TOKEN} ]; then
echo "BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN environment variables must be set" >&2
echo "See docs for how to set in global or project config" >&2
echo "For example, ddev config global --web-environment-add=BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>"
exit 1
fi
phpdismod xhprof xdebug
phpenmod blackfire
killall -USR2 php-fpm && killall -HUP nginx
# Can't use killall here because it kills this process!
pid=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ "${pid}" != "" ]; then kill $pid; fi
nohup blackfire agent:start --log-level=4 >/tmp/blackfire_nohup.out 2>&1 &
sleep 1
echo "Enabled blackfire PHP extension and started blackfire agent"
exit
}
function disable {
phpdismod blackfire
killall -USR2 php-fpm
# Can't use killall here because it kills this process!
pid=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ "${pid}" != "" ]; then kill ${pid}; fi
echo "Disabled blackfire PHP extension and stopped blackfire agent"
exit
}
if [ $# -eq 0 ] ; then
enable
fi
case $1 in
on|true|enable|start)
disable_xdebug
enable
;;
off|false|disable|stop)
disable
;;
status)
php --version | grep "with blackfire" >/dev/null 2>&1
phpstatus=$?
# Can't use killall here because it kills this process!
agentstatus=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ ${phpstatus} -eq 0 ]; then echo "blackfire PHP extension enabled"; else echo "blackfire PHP extension disabled"; fi
if [ "${agentstatus}" != "" ]; then echo "blackfire agent running"; else echo "blackfire agent not running"; fi
if [ ${phpstatus} -eq 0 ]; then printf "probe version %s\n" "$(php -v | awk -F '[ ,\~]+' '/blackfire/{ print $4; }')"; fi
printf "blackfire version %s\n" "$(blackfire version | awk '{print $3;}')"
;;
*)
echo "Invalid argument: $1"
;;
esac

View File

@@ -0,0 +1,17 @@
#!/bin/bash
#ddev-generated
## Description: Run Craft CMS command inside the web container
## Usage: craft [flags] [args]
## Example: "ddev craft db/backup" or "ddev craft db/backup ./my-backups" (see https://craftcms.com/docs/4.x/console-commands.html)
## ProjectTypes: craftcms,php
## ExecRaw: true
if [ "${DDEV_PROJECT_TYPE}" != "craftcms" ]; then
echo "The craft command is only available in the craftcms project type. You can update this in your project's config file, followed by restarting the DDEV project."
else
CRAFT_CMD_ROOT=${CRAFT_CMD_ROOT:="./"}
cd "${CRAFT_CMD_ROOT}"
php craft "$@"
fi

View File

@@ -0,0 +1,14 @@
#!/bin/bash
#ddev-generated
## Description: Run drush CLI inside the web container
## Usage: drush [flags] [args]
## Example: "ddev drush uli" or "ddev drush sql-cli" or "ddev drush --version"
## ProjectTypes: drupal7,drupal8,drupal9,drupal10,backdrop
## ExecRaw: true
if ! command -v drush >/dev/null; then
echo "drush is not available. You may need to 'ddev composer require drush/drush'"
exit 1
fi
drush "$@"

View File

@@ -0,0 +1,16 @@
#!/bin/bash
#ddev-generated
## Description: Run magento CLI inside the web container
## Usage: magento [flags] [args]
## Example: "ddev magento list" or "ddev magento maintenance:enable" or "ddev magento sampledata:reset"
## ProjectTypes: magento2
## ExecRaw: true
if [ ! -f bin/magento ]; then
echo 'bin/magento does not exist in your project root directory.'
echo 'Please verify that you installed the shop in your project directory.'
exit 1
fi
php bin/magento "$@"

9
.ddev/.global_commands/web/npm Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
#ddev-generated
## Description: Run npm inside the web container
## Usage: npm [flags] [args]
## Example: "ddev npm install" or "ddev npm update"
## ExecRaw: true
## HostWorkingDir: true
npm "$@"

9
.ddev/.global_commands/web/nvm Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash -i
#ddev-generated
## Description: Run nvm inside the web container
## Usage: nvm [flags] [args]
## Example: "ddev nvm install 6"
## ExecRaw: true
nvm "$@"

9
.ddev/.global_commands/web/php Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
#ddev-generated
## Description: Run php inside the web container
## Usage: php [flags] [args]
## Example: "ddev php --version"
## ExecRaw: true
php "$@"

View File

@@ -0,0 +1,11 @@
#!/bin/bash
#ddev-generated
## Description: Run python inside the web container, in the same relative directory as on host
## Usage: python [flags] [args]
## Example: "ddev python --version"
## ExecRaw: true
## HostWorkingDir: true
## ProjectTypes: django4,python
python "$@"

11
.ddev/.global_commands/web/sake Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
#ddev-generated
## Description: Run Silverstripe sake CLI inside the web container
## Usage: sake [flags] [args]
## Example: "ddev sake dev/build" or "ddev sake dev/tasks"
## ProjectTypes: silverstripe
## ExecRaw: true
sake "$@"

View File

@@ -0,0 +1,12 @@
#!/bin/bash
#ddev-generated
# This assumes that the typo3 command will be in the $PATH; if in vendor/bin/ it will be
## Description: Run TYPO3 CLI (typo3) command inside the web container
## Usage: typo3 [args]
## Example: "ddev typo3 site:list" or "ddev typo3 list" or "ddev typo3 extension:list"
## ProjectTypes: typo3
## ExecRaw: true
typo3 "$@"

View File

@@ -0,0 +1,12 @@
#!/bin/bash
#ddev-generated
# This assumes that the typo3cms command will be in the $PATH; if in vendor/bin/ it will be
## Description: Run TYPO3 Console (typo3cms) command inside the web container
## Usage: typo3cms [args]
## Example: "ddev typo3cms cache:flush" or "ddev typo3cms database:export"
## ProjectTypes: typo3
## ExecRaw: true
typo3cms "$@"

9
.ddev/.global_commands/web/wp Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
#ddev-generated
## Description: Run WordPress CLI inside the web container
## Usage: wp [flags] [args]
## Example: "ddev wp core version" or "ddev wp plugin install user-switching --activate"
## ProjectTypes: wordpress
## ExecRaw: true
wp "$@"

View File

@@ -0,0 +1,75 @@
#!/bin/bash
## #ddev-generated
## Description: Enable or disable xdebug
## Usage: xdebug on|off|enable|disable|true|false|toggle|status
## Example: "ddev xdebug" (default is "on"), "ddev xdebug off", "ddev xdebug on", "ddev xdebug toggle", "ddev xdebug status"
## Execraw: false
## Flags: []
if [ $# -eq 0 ] ; then
enable_xdebug
exit
fi
xdebug_version=$(php --version | awk '/Xdebug v/ {print $3}')
case $1 in
on|true|enable)
enable_xdebug
;;
off|false|disable)
disable_xdebug
;;
toggle)
case ${xdebug_version} in
v3*)
status=$(php -r 'echo ini_get("xdebug.mode");' 2>/dev/null)
if [[ "${status}" =~ .*"debug".* ]]; then
disable_xdebug
else
enable_xdebug
fi
;;
v2*)
status=$(php -r 'echo ini_get("xdebug.remote_enable");')
if [ "${status}" = "1" ]; then
disable_xdebug
else
enable_xdebug
fi
;;
*)
enable_xdebug
;;
esac
;;
status)
case ${xdebug_version} in
v3*)
status=$(php -r 'echo ini_get("xdebug.mode");' 2>/dev/null)
if [[ "${status}" =~ .*"debug".* ]]; then
result="xdebug enabled"
else
result="xdebug disabled"
fi
;;
v2*)
status=$(php -r 'echo ini_get("xdebug.remote_enable");')
if [ "${status}" = "1" ]; then
result="xdebug enabled"
else
result="xdebug disabled"
fi
;;
*)
result="xdebug disabled"
;;
esac
echo $result
;;
*)
echo "Invalid argument: $1"
;;
esac

View File

@@ -0,0 +1,34 @@
#!/bin/bash
## #ddev-generated
## Description: Enable or disable xhprof
## Usage: xhprof on|off|enable|disable|true|false|status
## Example: "ddev xhprof" (default is "on"), "ddev xhprof off", "ddev xhprof on", "ddev xhprof status"
## ExecRaw: false
## Flags: []
if [ $# -eq 0 ]; then
enable_xhprof
exit
fi
case $1 in
on | true | enable)
enable_xhprof
;;
off | false | disable)
disable_xhprof
;;
status)
status=$(php -m | grep 'xhprof')
if [ "${status}" = "xhprof" ]; then
result="xhprof is enabled"
else
result="xhprof is disabled"
fi
echo $result
;;
*)
echo "Invalid argument: $1"
;;
esac

10
.ddev/.global_commands/web/yarn Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#ddev-generated
## Description: Run yarn inside the web container in the root of the project (Use --cwd for another directory)
## Usage: yarn [flags] [args]
## Example: "ddev yarn install" or "ddev yarn add learna" or "ddev yarn --cwd web/core add learna"
## ExecRaw: true
## HostWorkingDir: true
yarn "$@"

View File

@@ -6,20 +6,25 @@
# 1. Get your Acquia API token from your Account Settings->API Tokens.
# 2. Make sure your ssh key is authorized on your Acquia account at Account Settings->SSH Keys
# 3. `ddev auth ssh` (this typically needs only be done once per ddev session, not every pull).
# 4. Add / update the web_environment section in ~/.ddev/global_config.yaml
# or your project config.yamlwith the API keys:
# 4. Add / update the web_environment section in ~/.ddev/global_config.yaml with the API keys:
# ```yaml
# web_environment:
# - ACQUIA_API_KEY=xxxxxxxx
# - ACQUIA_API_SECRET=xxxxx
# - ACQUIA_API_KEY=xxxxxxxx
# - ACQUIA_API_SECRET=xxxxx
# ```
# 5. Add the ACQUIA_ENVIRONMENT_ID environment variable to your project config.yaml, for example:
# You can also do this with `ddev config global --web-environment-add="ACQUIA_API_KEY=xxxxxxxx,ACQUIA_API_SECRET=xxxxx"`.
#
# 5. Add the ACQUIA_ENVIRONMENT_ID environment variable to your project `.ddev/config.yaml`, for example:
# ```yaml
# web_environment:
# - ACQUIA_ENVIRONMENT_ID=project1.dev
# - On the Acquia Cloud Platform you can find this out by navigating to the environments page,
# clicking on the header and look for the "SSH URL" line.
# Eg. `project1.dev@cool-projects.acquia-sites.com` would have a project ID of `project1.dev`
# - ACQUIA_ENVIRONMENT_ID=project1.dev
# ```
# You can also do this with `ddev config --web-environment-add="ACQUIA_ENVIRONMENT_ID=project1.dev"`.
#
# On the Acquia Cloud Platform you can find this out by navigating to the environments page,
# clicking on the header and look for the "SSH URL" line.
# Eg. `project1.dev@cool-projects.acquia-sites.com` would have a project ID of `project1.dev`
#
# 6. `ddev restart`
# 7. Use `ddev pull acquia` to pull the project database and files.
# 8. Optionally use `ddev push acquia` to push local files and database to Acquia. Note that `ddev push` is a command that can potentially damage your production site, so this is not recommended.
@@ -31,11 +36,11 @@
auth_command:
command: |
set -eu -o pipefail
if [ -z "${ACQUIA_API_KEY:-}" ] || [ -z "${ACQUIA_API_SECRET:-}" ]; then echo "Please make sure you have set ACQUIA_API_KEY and ACQUIA_API_SECRET in ~/.ddev/global_config.yaml" && exit 1; fi
if [ -z "${ACQUIA_ENVIRONMENT_ID:-}" ] ; then echo "Please set ACQUIA_ENVIRONMENT_ID via config.yaml or with '--environment=ACQUIA_ENVIRONMENT_ID=xxx'" && exit 1; fi
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
acli -n auth:login -n --key="${ACQUIA_API_KEY}" --secret="${ACQUIA_API_SECRET}"
set -eu -o pipefail
if [ -z "${ACQUIA_API_KEY:-}" ] || [ -z "${ACQUIA_API_SECRET:-}" ]; then echo "Please make sure you have set ACQUIA_API_KEY and ACQUIA_API_SECRET in ~/.ddev/global_config.yaml" && exit 1; fi
if [ -z "${ACQUIA_ENVIRONMENT_ID:-}" ] ; then echo "Please set ACQUIA_ENVIRONMENT_ID via config.yaml or with '--environment=ACQUIA_ENVIRONMENT_ID=xxx'" && exit 1; fi
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
acli -n auth:login -n --key="${ACQUIA_API_KEY}" --secret="${ACQUIA_API_SECRET}"
db_pull_command:
command: |
@@ -45,21 +50,20 @@ db_pull_command:
# just using `acli pull:db ${ACQUIA_ENVIRONMENT_ID}`
echo "Using ACQUIA_ENVIRONMENT_ID=${ACQUIA_ENVIRONMENT_ID}"
set -x # You can enable bash debugging output by uncommenting
db_dump=$(acli pull:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction --no-import | tail -2l | xargs | sed 's/^.* //')
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
db_dump=$(acli pull:db ${ACQUIA_ENVIRONMENT_ID} default --no-interaction --no-import | tail -2l | xargs | sed 's/^.* //')
cp ${db_dump} /var/www/html/.ddev/.downloads/db.sql.gz
files_import_command:
command: |
# set -x # You can enable bash debugging output by uncommenting
set -eu -o pipefail
acli -n pull:files ${ACQUIA_ENVIRONMENT_ID}
acli -n pull:files ${ACQUIA_ENVIRONMENT_ID} default
# push is a dangerous command. If not absolutely needed it's better to delete these lines.
db_push_command:
command: |
set -eu -o pipefail
export ACLI_DB_HOST=db ACLI_DB_NAME=db ACLI_DB_USER=db ACLI_DB_PASSWORD=db
export ACLI_DB_HOST=db ACLI_DB_NAME=db ACLI_DB_USER=root ACLI_DB_PASSWORD=root
set -x # You can enable bash debugging output by uncommenting
acli push:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction

2
.idea/dataSources.xml generated
View File

@@ -14,7 +14,7 @@
<configured-by-url>true</configured-by-url>
<remarks>DDEV generated data source</remarks>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://127.0.0.1:32770/db?user=db&amp;password=db</jdbc-url>
<jdbc-url>jdbc:mariadb://127.0.0.1:32780/db?user=db&amp;password=db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>

1
.php-cs-fixer.cache Normal file
View File

@@ -0,0 +1 @@
{"php":"8.3.7","version":"3.61.1","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"hashes":{"src\/Repository\/HlsCountryRepository.php":"f5dbe2349e9da86078d86380914d98de","src\/Repository\/ProductRepository.php":"7ff9f8bca451320f49900e126d74a780","src\/Repository\/SettingsRepository.php":"4edf283456dc2a1e1d08a2ff0b13cf8f","src\/Repository\/StockRepository.php":"c02e174e2ec6a17f17e8392142898e52","src\/Repository\/OrderRepository.php":"88834c7b734d5f83804583115ee129c5","src\/Repository\/WarehouseRepository.php":"8839f7a56ab6dc9838762da71e795c74","src\/Security\/ApiKeyAuthenticator.php":"e636d3594b8ea726ddb964a57b0401f0","src\/Entity\/Settings.php":"19012dbbfce64550884b67d83f59f1c5","src\/Entity\/Product.php":"940a06569e34698c2acf170b1e0c91b2","src\/Entity\/Order.php":"08bc5fc1dc25e5bfb42f721dd0777293","src\/Entity\/Stock.php":"ef46886514d7f56cd5c16ff33e1c22a0","src\/Entity\/Warehouse.php":"09b935ac2c2becc5bc89ba133e16af62","src\/Command\/HiltesExportCommand.php":"d3b51cc10f92618fb4151c195d2ba688","src\/Command\/JtlExportCommand.php":"4749e0bb7c0652b2138ec52d7fff1cf6","src\/Command\/HiltesImportCommand.php":"a11af8331d63da04d9a80b23e69e1b7a","src\/EventSubscriber\/ExportHiltesSubscriber.php":"b5e1ec62500ad670ba1621d68cc797c5","src\/EventSubscriber\/SlackNotifySubscriber.php":"08f4278d7c5732ffd72dc18fbe7a0973","src\/Helper\/Hiltes.php":"937df859648279608b1865683dbb74d7","src\/Helper\/HiltesImport.php":"35a6e8de7eba72013e520760f5c29960","src\/Helper\/Ftp.php":"d35cc0a6b467b8c1450755db5d7c6db9","src\/Helper\/Jtl.php":"4d29cc40fe2b86dd65b619e3fc80cff6","src\/Kernel.php":"065c02fc2d62bfff3cd16f3a0b46d9ee"}}

16
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"hostname": "0.0.0.0",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
},
"preLaunchTask": "DDEV: Enable Xdebug",
"postDebugTask": "DDEV: Disable Xdebug"
}
]
}

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"intelephense.environment.phpVersion": "8.2"
}

23
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "DDEV: Enable Xdebug",
"type": "shell",
"command": "ddev xdebug on",
"presentation": {
"reveal": "silent",
"close": true
}
},
{
"label": "DDEV: Disable Xdebug",
"type": "shell",
"command": "ddev xdebug off",
"presentation": {
"reveal": "silent",
"close": true
}
}
]
}

View File

@@ -9,14 +9,14 @@ Connector zwischen Hiltes und JTL Wawi
--------------
> git clone https://gitbase.de/OrangeJungle/CdsConnector.git
> cd CdsConnector
> cd CdsConnector
Installiere Abhängigkeiten
> make install
Erstelle .env.local Datei und füge folgendes ein:
> DATABASE_URL=mysql://root:root@mysql:3306/cds_connector
> DATABASE_URL=mysql://root:root@mysql:3306/cds_connector
Starte MySQL-Server:
> docker compose up
@@ -31,51 +31,16 @@ Update der Datenbank
> bin/console doctrine:migrations:execute
Starte Server
> make dev-server
> make dev-server
API-Übersicht
> https://127.0.0.1:8000/api
Update Symphony
Update Symphony
> composer update
# Benutzen
--------------
Hiltes Import full Import
Kompletter Abgleich aller Bestände
> bin/console hiltes:import
Delta Import
Die Delta Datei baut sich über den Tag auf und enthält alle Änderungen seit dem letzten full export von Hiltes
> bin/console hiltes:import --d
# Hosting
--------------
https://cloud.iteckse.de/
hier laufen 2 Cronjobs:
Täglich um 01:01 Uhr der full Import
> /home/users/orangejungle/www/bin/console hiltes:import
Alle 5 Minuten der Delta Import
> 1-56/5 0-1,2-23 * * * /home/users/orangejungle/www/bin/console hiltes:import --d
# JTL
--------------
In Windows Aufgabenplanung die Aufgabe JTL Bestandsimport alle 5 Minuten ausgeführt
Diese ruft das Script C:\CloudFTP\import_delta.bat auf
Einmal um 01:008 Uhr läuft die Aufgabe für den komplett Import diese ruft das Script C:\CloudFTP\import_full.bat auf
die Scripte sind im Order "jtlscript" zu finden
# Slack
--------------
Um Slack zu benutzen, muss die .env.local Datei angepasst werden:
> SLACK_DSN="https://hooks.slack.com/services/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_TEST"
Nachrichten werden je nach Filiale in den Channel online_verkäufe_<filialname> gepostet
Hiltes Import
> bin/console hiltes:import

1491
composer.lock generated

File diff suppressed because it is too large Load Diff

17
deploy.yaml Normal file
View File

@@ -0,0 +1,17 @@
import:
- recipe/symfony.php
config:
repository: 'https://gitbase.de/OrangeJungle/CdsConnector.git'
hosts:
https://connector.orangejungle.eu/:
remote_user: deployer
deploy_path: '~/CdsConnector'
tasks:
build:
- run: uptime
after:
deploy:failed: deploy:unlock

BIN
hiltes/.DS_Store vendored

Binary file not shown.

View File

@@ -61,9 +61,7 @@ class HiltesExportCommand extends Command
foreach ($orders as $order) {
if ($order->getStatus() > 0) {
continue;
}
if ($order->getStatus() > 0) continue;
$tA = $order->getData();#json_decode($order->getData());
$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
@@ -182,4 +180,4 @@ class HiltesExportCommand extends Command
return Command::SUCCESS;
}
}
}

View File

@@ -17,7 +17,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\HttpKernel\KernelInterface;
use function Sentry\captureCheckIn;
#[AsCommand(
@@ -36,7 +35,8 @@ class HiltesImportCommand extends Command
StockRepository $stockRepository,
WarehouseRepository $warehouseRepository,
LoggerInterface $logger
) {
)
{
$this->productRepository = $productRepository;
$this->stockRepository = $stockRepository;
$this->warehouseRepository = $warehouseRepository;
@@ -125,4 +125,4 @@ class HiltesImportCommand extends Command
//POST: $dirs = /app/public
return implode('/', $dirs);
}
}
}

View File

@@ -32,7 +32,8 @@ class JtlExportCommand extends Command
StockRepository $stockRepository,
WarehouseRepository $warehouseRepository,
LoggerInterface $logger
) {
)
{
$this->productRepository = $productRepository;
$this->stockRepository = $stockRepository;
$this->warehouseRepository = $warehouseRepository;
@@ -84,4 +85,4 @@ class JtlExportCommand extends Command
return implode('/', $dirs);
}
}
}

View File

@@ -9,6 +9,7 @@ use DateTimeInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/*
* Bestellungen Status:
* 1 = Bestellung eingegangen
@@ -107,4 +108,4 @@ class Order
return $this;
}
}
}

View File

@@ -60,4 +60,4 @@ class Product
return $this;
}
}
}

View File

@@ -126,4 +126,4 @@ class Stock
return $this;
}
}
}

View File

@@ -93,4 +93,4 @@ class Warehouse
return $this;
}
}
}

View File

@@ -40,4 +40,4 @@ class ExportHiltesSubscriber implements EventSubscriberInterface
KernelEvents::VIEW => ['onPatchOrder', EventPriorities::POST_WRITE]
];
}
}
}

View File

@@ -70,7 +70,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
$warehouse = $this->getWarehouseByGtin($item['gtin']);
if (!$warehouse) {
# $this->logger->error('Warehouse not found for GTIN: ' . $item['gtin']);
// $this->logger->error('Warehouse not found for GTIN: ' . $item['gtin']);
continue;
}
@@ -110,7 +110,9 @@ class SlackNotifySubscriber implements EventSubscriberInterface
if ($gtin == null) {
return false;
}
$warehouse = false;
//standart push in 8?
$warehouse = 8;
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);

View File

@@ -2,6 +2,7 @@
namespace App\Helper;
use Exception;
class Ftp
@@ -129,4 +130,4 @@ class Ftp
{
$this->remoteDir = $remoteDir;
}
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Helper;
use App\Entity\Product;
use App\Entity\Stock;
use App\Entity\Warehouse;
@@ -322,4 +323,4 @@ class HiltesImport
return false;
}
}
}

View File

@@ -12,6 +12,7 @@ use Exception;
use League\Csv\Writer;
use Psr\Log\LoggerInterface;
class Jtl
{
private $productRepository;
@@ -44,8 +45,8 @@ class Jtl
WarehouseRepository $warehouseRepository,
StockRepository $stockRepository,
LoggerInterface $logger,
string $rootPath
) {
string $rootPath)
{
$this->productRepository = $productRepository;
$this->warehouseRepository = $warehouseRepository;
$this->stockRepository = $stockRepository;
@@ -127,4 +128,4 @@ class Jtl
$this->logger->error($e->getMessage());
}
}
}
}

View File

@@ -39,28 +39,28 @@ class HlsCountryRepository extends ServiceEntityRepository
}
}
// /**
// * @return HlsCountry[] Returns an array of HlsCountry objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('h.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// /**
// * @return HlsCountry[] Returns an array of HlsCountry objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('h.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?HlsCountry
// {
// return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
// public function findOneBySomeField($value): ?HlsCountry
// {
// return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -59,30 +59,30 @@ class OrderRepository extends ServiceEntityRepository
}
}
// /**
// * @return Order[] Returns an array of Order objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('o.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// /**
// * @return Order[] Returns an array of Order objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('o.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Order
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
// public function findOneBySomeField($value): ?Order
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
/**
* @throws Exception
*/
@@ -90,4 +90,4 @@ class OrderRepository extends ServiceEntityRepository
{
throw new Exception($string);
}
}
}

View File

@@ -77,4 +77,4 @@ class ProductRepository extends ServiceEntityRepository
return $product_ids;
}
}
}

View File

@@ -39,28 +39,28 @@ class SettingsRepository extends ServiceEntityRepository
}
}
// /**
// * @return Settings[] Returns an array of Settings objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// /**
// * @return Settings[] Returns an array of Settings objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Settings
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
// public function findOneBySomeField($value): ?Settings
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -75,4 +75,4 @@ class StockRepository extends ServiceEntityRepository
$this->getEntityManager()->flush();
$this->batch = [];
}
}
}

View File

@@ -55,13 +55,13 @@ class WarehouseRepository extends ServiceEntityRepository
->getResult();
}
// public function findOneBySomeField($value): ?Warehouse
// {
// return $this->createQueryBuilder('w')
// ->andWhere('w.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}
// public function findOneBySomeField($value): ?Warehouse
// {
// return $this->createQueryBuilder('w')
// ->andWhere('w.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -15,6 +15,7 @@ use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPasspor
class ApiKeyAuthenticator extends AbstractAuthenticator
{
/**
* Called on every request to decide if this authenticator should be
* used for the request. Returning `false` will cause this authenticator
@@ -60,4 +61,4 @@ class ApiKeyAuthenticator extends AbstractAuthenticator
return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
}
}
}