-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editing Factory.php when implementing custom adapter #124
Comments
To use a custom Adapter you have to register it at the Factory. <phpbu bootstrap="init.php"> And within your bootstrap file register the Adapter. <?php
use phpbu\App\Factory;
use phpbu\App\Adapter\RPass;
require 'vendor/autoload.php';
Factory::register('adapter', 'rpass', RPass::class); With this you can put the <?php
use phpbu\App\Factory;
use My\Name\Space\RPass;
require 'vendor/autoload.php';
Factory::register('adapter', 'rpass', RPass::class); |
Hi, Thanks for the quick response. I'm now using the bootstrap attribute but the file is never executed (even if I just put a die() statement there). Here's my XML:
Even when I run ./phpbu --bootstrap=file (file has a die() statement) I get:
I've tried seeing where it dies out and it's in https://github.com/sebastianfeldmann/phpbu/blob/master/src/Configuration/Loader/File.php#L73 I believe it breaks due to the tag where I set the options. Thanks, |
oO, I will look right into this ... tomorrow morning |
Which version of I tried this configuration <?xml version="1.0" encoding="UTF-8"?>
<phpbu bootstrap="backup/bootstrap.php" verbose="false"> with this bootstrap file <?php
// bootstrap demo file
echo "foo\n";
exit(1); and this is the output I get
If I change the xml config to an invalid file I get the following output.
|
Hi Sebastian, sorry for the delay. I'm using 5.0.7 and here's what I have confirmed at the moment. When I set an actual password it works (I get "foo"):
When I use any adapter for the password, it doesn't (no "foo" for me!).
Thanks, |
You are sorry... what should I be, I totally overlooked this the whole time. Shame on me. Did you manage to make sure your <?php
// bootstrap demo file
echo "foo\n";
exit(1); |
Forget what I said, I can reproduce your error now. It's a chicken and egg problem. Currently I create the configuration and setup the adapters first. So ... I have to restructure some things and will fix this as soon as possible. |
Bootstrapping and config creation is kind of a chicken and egg problem. To actually use a custom adapter the bootstrap file has to be loaded before creating the configuration. So from now on all config loader have to use the new Bootstrapper to handle the bootstrap loading before creating the actual configuration instance.
Ok I just released phpbu 5.0.9 including a bugfix for this problem. |
Thank you Sebastian, works like a charm now! Pavel |
No worries, it took me way too long to recognize the severity of your problem and that it was an error on my side. Thank you for letting me know that it works and reporting it in the first place. |
Hi,
I've implemented a custom adapter to support remotepassword.com (so that I don't have to hardcode a password in the XML file), but in order to make it work I had to add to update Factory.php as well.
Code is here: https://github.com/sadreck/phpbu/blob/1f79ec45ebe18052514942ddd9bdd5d8be8bc04f/src/Factory.php#L37
The documentation says that you only need the file in /Adapter but that didn't seem to work for me. Is this a bug or am I missing something obvious?
Thanks,
Pavel
The text was updated successfully, but these errors were encountered: