Skip to content

Commit

Permalink
fix: introduce plugin-custom to mount files without breaking permissi…
Browse files Browse the repository at this point in the history
…ons, fixes shyim#1
  • Loading branch information
shyim committed May 30, 2024
1 parent 377402c commit ba85ebd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ If a plugin *requires* parameters to work correctly instead of adding the plugin
```console
$ docker run --link some_database:db -p 8080:8080 -e ADMINER_PLUGINS='login-servers' ghcr.io/shyim/adminerevo:latest
Unable to load plugin file "login-servers", because it has required parameters: servers
Create a file "/var/www/html/plugins-enabled/login-servers.php" with the following contents to load the plugin:
Create a file "/var/www/html/plugins-custom/login-servers.php" with the following contents to load the plugin:
<?php
require_once('plugins/login-servers.php');
Expand All @@ -67,7 +67,7 @@ return new AdminerLoginServers(
);
```

To load a custom plugin you can add PHP scripts that return the instance of the plugin object to `/var/www/html/plugins-enabled/`.
To load a custom plugin you can add PHP scripts that return the instance of the plugin object to `/var/www/html/plugins-custom/`.

### Choosing a design

Expand Down
6 changes: 6 additions & 0 deletions rootfs/var/www/html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function _callParent($function, $args) {
$plugins[] = require($plugin);
}

if (is_dir('plugins-custom')) {
foreach (glob('plugins-custom/*.php') as $plugin) {
$plugins[] = require($plugin);
}
}

return new Adminer($plugins);
}
}
Expand Down
2 changes: 1 addition & 1 deletion rootfs/var/www/html/plugin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it has required parameters: '.implode(', ', array_map(function ($item) {
return $item->getName();
}, $requiredParameters))."\n".
'Create a file /var/www/html/plugins-enabled/'.$name.'.php" with the following contents to load the plugin:'."\n\n".
'Create a file /var/www/html/plugins-custom/'.$name.'.php" with the following contents to load the plugin:'."\n\n".
'<?php
require_once('.var_export($file, true).');
Expand Down

0 comments on commit ba85ebd

Please sign in to comment.