mxgross / EasyBackupBundle

Kimai 2 Plugin for easier backups
MIT License
24 stars 6 forks source link

Ignoring changed bin path on an Synology NAS (similar to #37) #43

Closed Sarmingsteiner closed 1 year ago

Sarmingsteiner commented 2 years ago

Hi,

I host my Kimai on an Synology NAS. The paths are different compared to a usual linux server. My Synology has it installed at: /usr/local/mariadb10/bin

When I recently wanted to do a backup, the database is not included in the backup file anymore. The log says: "[2022-05-22 22:21:38] ERROR: mysqldump: 'sh: /usr/bin/mysqldump: No such file or directory'."

However, a long time ago, I changed the default mysqldump command in the Kimai settings to: "/usr/local/mariadb10/bin/mysqldump --user={user} --password={password} --host={host} --port={port} --single-transaction --force {database}"

For some reason, the setting seems to be ignored? In January 2022, it worked fine. I tried to switch back to PHP 7.4 (instead of PHP 8.0), but it did not help.

mxgross commented 1 year ago

Hi, what does it show in the status check of the plugin in line with "[...] mysqldump --version" Is there a warning icon and what path is shown there?

When you change the kimai settings of the EasyBackup Plugin it should use the given path, I just tested it. Maybe on your NAS there is some symlink / redirection from /usr/local/mariadb10/bin to /usr/bin/mysqldump and this mysqldump has the wrong access rights?

mxgross commented 1 year ago

I reproduced this behaviour. Somehow the updated settings are stored into the database but not updated in the EasyBackupController.php. I always get older values. As if they are cached. Maybe because are they only read once during the lifetime of my class?

But after bin/console kimai:reload --env=prod, which always messes up my file permissions by the way. And after

sudo chown -R :www-data .
sudo chmod -R g+r .
sudo chmod -R g+rw var/
sudo chmod -R g+rw public/avatars/

the correct configuration value is read.

@kevinpapst would you be so kind and take a look at my code, what can still be improved regarding the configurations? It should be possible to receive the configured values right after the user has changed them. What have I done wrong?

Thanks a lot.

kevinpapst commented 1 year ago

which always messes up my file permissions by the way

If you execute the reload command as sudo...

would you be so kind and take a look at my code, what can still be improved regarding the configurations

Can you please add some links to the relevant code pieces here.

mxgross commented 1 year ago

My DependencyInjection/Configuration.php seems to work, because the stored values are also loaded there.

In EasyBackupExtension.php I'm not sure about Line 31 as I did not found these in the DemoBundle or CustomCSSCundle examples.

Then there is EasyBackupConfiguration.php which provides methods that I use e.g. in the EasyBackupController.php#L451 where the wrong/outdated value is received.

$this->configuration->getMysqlDumpCommand();

Maybe a problem how I handle the configuration in the Constructor?

Thanks

kevinpapst commented 1 year ago

Sorry, I was quicker, already fixed in https://github.com/mxgross/EasyBackupBundle/pull/47 The main problem was the setup of your config class.