Hi, > > 1) Mandatory adminer/ directory > > > > I have not found any way to make adminer work without a /adminer/ directory. > > > > This makes it a bit complicated to to deploy in a custom path or without > > exposing the whole /usr/share/adminer even if other files are not required. > > > > As I understand it, this is what is described in this bug report: the > > problem > > is the hardcoded paths in CSS/js resources. > > It looks like Adminer is actually supposed to be compiled from the files > included in this package—I was able to get it working using the instructions > provided here for Ubuntu 18.04: > > https://stackoverflow.com/questions/52480057/install-adminer-on-ubuntu-18-04-bionic > > These instructions don't solve the problem of exposing all the other files > over HTTP, however, so after compiling I moved the resulting file to a new > subdirectory "/usr/share/adminer/web” and aliased that in Apache rather than > the parent directory—once it’s been compiled, it doesn’t look like the paths > to CSS and JS files have to be maintained, so this appears to work fine.
Then maybe the compiled version should be provided by the binary package. > > 2) No config file support > > > > I have found no ovious way of configuring adminer using the files from the > > Debian package (e.g. enabling a plugin). > > I think that this issue will go away once you’re using a compiled version > rather than the sources, and you’ll be able to use the instructions at > adminer.org to customize the configuration. > > I’ve only just started working with this, so I’m not sure that what I’ve > described here is the right way to get everything working, but so far it > appears to be the right track. Maybe the binary package should prepare for this. Using the attached patch, it seems I can achieve what I want to do. Thanks, Alex
diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..6bae7b3 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,48 @@ +# Setup overview + +The compiled version of adminer is located at /usr/share/adminer/adminer.php + +The recommended ways to deploy adminer are: +- symlinking adminer.php into your directory of choice viewable by a + php-enabled webserver. +- if you want to enable plugins, pointing your webserver configuration to + /etc/adminer with conf.php a directory index. Editing conf.php lets you + enable plugins. + +# Setup with apache + +The following configuration snippet should do the trick. + + Alias /adminer.php /etc/adminer/conf.php + +# Setup with apache+uwsgi + +uwsgi configuration file: + + [uwsgi] + master = True + cheap = True + + plugins = 0:php + + project_dir = /etc/adminer + chdir = %(project_dir) + php-docroot = %(project_dir) + php-index = conf.php + + plugins = router_rewrite + route = ^/adminer/(.*) rewrite:/conf.php + + buffer-size = 8192 + + # PHP sessions storage + cache2 = name=dbadmsessions,items=200,store=/var/lib/www/adminer/uwsgi.cache,expires=3600 + php-set = session.save_handler=uwsgi + php-set = session.save_path=dbadmsessions + +apache: + + ProxyPassMatch "^/adminer/(.*)?$" "unix:/var/run/uwsgi/adminer.socket|uwsgi://uwsgi-uds-adminer/" + <Location /adminer> + Require all granted + </Location> diff --git a/debian/conf.php b/debian/conf.php new file mode 100644 index 0000000..b60352c --- /dev/null +++ b/debian/conf.php @@ -0,0 +1,32 @@ +<?php + +define('ADMINER_DIR', '/usr/share/adminer'); + +function adminer_object() { + // required to run any plugin + include_once ADMINER_DIR . "/plugins/plugin.php"; + + // autoloader + foreach (glob(ADMINER_DIR . "/plugins/*.php") as $filename) { + include_once $filename; + } + + $plugins = array( + // specify enabled plugins here + //new AdminerLoginServers([ + // 'my' => ['server' => 'localhost', 'driver' => 'mysql'], + // 'pg' => ['server' => 'localhost', 'driver' => 'pgsql'], + //]), + ); + + /* It is possible to combine customization and plugins: + class AdminerCustomization extends AdminerPlugin { + } + return new AdminerCustomization($plugins); + */ + + return new AdminerPlugin($plugins); +} + +include ADMINER_DIR . "/adminer.php"; +?> diff --git a/debian/control b/debian/control index 5d3a612..44eb589 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: web Priority: optional Maintainer: Chris Lamb <la...@debian.org> Build-Depends: - debhelper-compat (= 11), + debhelper-compat (= 11), php-cli Standards-Version: 4.3.0 Homepage: https://www.adminer.org/ Vcs-Git: https://salsa.debian.org/lamby/pkg-adminer.git diff --git a/debian/install b/debian/install index c0ac2b6..791d1ce 100644 --- a/debian/install +++ b/debian/install @@ -4,3 +4,4 @@ designs usr/share/adminer editor usr/share/adminer externals usr/share/adminer plugins usr/share/adminer +debian/conf.php etc/adminer/ diff --git a/debian/rules b/debian/rules index dd54c24..0cfc638 100755 --- a/debian/rules +++ b/debian/rules @@ -15,3 +15,12 @@ override_dh_installdocs: set -e; for X in designs plugins; do \ mv -v $(SHARE)/adminer/$$X/readme.txt $(SHARE)/doc/adminer/readme-$$X.txt; \ done + +override_dh_auto_build: + dh_auto_build + php compile.php + mv adminer-*.php adminer.php + +override_dh_auto_clean: + rm -f adminer.php + dh_auto_clean