Closed noseshimself closed 1 year ago
I did some debugging...
My database configuration doesn't contain a port number (as the database is running on the default port). Your script should generated a mysqldump command that did not work at all:
[2022-10-03 14:25:02] INFO: mysqldump-commandline: '/usr/bin/mysqldump --user=kimai --password=$882934$6166472$1151515 --host=db-bnc-net/kimai --port=3306 --single-transaction --force --no-tablespaces'.
1) This is probably a result of my specification in the Docker configuration as
environment:
- APP_ENV=prod
- DATABASE_URL=mysql://kimai:$882934$6166472$1151515@db-bnc-net/kimai
and your parsing it going completely wrong (although Kimai likes it that way).
2) You should escape the password on your command line (and yes, I changed my password).
Thanks for your feedback. I will implement a solution that respects the default port / no port and escapes the password.
I updated my implementation using parse_url. I tested it with your URL which leads to
array(5) {
["scheme"]=>
string(5) "mysql"
["host"]=>
string(10) "db-bnc-net"
["user"]=>
string(5) "kimai"
["pass"]=>
string(23) "$882934$6166472$1151515"
["path"]=>
string(6) "/kimai"
}
I trim all slashes (/) from the path and I remove the whole --port={port}
part when no "port" key exits.
This should solve your problem. Please give me feedback about it.
Regarding 2.) password escaping: Do you have any idea how to do this with proc_open when executing command lines without knowing something about the keystore of the machine? Maybe you can configure your machine to work without a password needed for the mysqldump command: https://unix.stackexchange.com/a/227657
Thanks. 1) Working as expected now. Sorry for my late answer but I was so concentrated on not getting Covid that the flu (which is just as deadly) caught up with me.
Regarding 2) I can use any password I want so I can obviously create one without any $ sign but you might warn users that the shell may and will interact with the command line it will receive from you.
Current version of plugin and Kimai2.
The plugin was pulled from git without any modifications or configuration:
Running it results in
so it looks like the correct parameters are not found in the Kimai configuration...