Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ RUN set -x \

COPY *.php /var/www/html/

ENV ADMINER_VERSION=5.1.0
ENV ADMINER_DOWNLOAD_SHA256=b11edcee53cef7e64776adfcc21bb1971123c7de55b7d4eef3cd0020142b900e
ENV ADMINER_SRC_DOWNLOAD_SHA256=de4dd39ade03d2ebb145782c8fb5bb176eecb8ec4a9cf4ee63b4669be2b1b80c
ENV ADMINER_VERSION=5.2.1
ENV ADMINER_DOWNLOAD_SHA256=572118dff2305f136a4b8d59404d01c3d8450e99e3abd506081ffdddd8816573
ENV ADMINER_SRC_DOWNLOAD_SHA256=64e6b6c9e049ddab694cc8793485f1f1888abaf70ab5a389544c0a1b2926bed6

RUN set -x \
&& curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \
Expand Down
6 changes: 3 additions & 3 deletions 5/fastcgi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ RUN set -x \

COPY *.php /var/www/html/

ENV ADMINER_VERSION=5.1.0
ENV ADMINER_DOWNLOAD_SHA256=b11edcee53cef7e64776adfcc21bb1971123c7de55b7d4eef3cd0020142b900e
ENV ADMINER_SRC_DOWNLOAD_SHA256=de4dd39ade03d2ebb145782c8fb5bb176eecb8ec4a9cf4ee63b4669be2b1b80c
ENV ADMINER_VERSION=5.2.1
ENV ADMINER_DOWNLOAD_SHA256=572118dff2305f136a4b8d59404d01c3d8450e99e3abd506081ffdddd8816573
ENV ADMINER_SRC_DOWNLOAD_SHA256=64e6b6c9e049ddab694cc8793485f1f1888abaf70ab5a389544c0a1b2926bed6

RUN set -x \
&& curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \
Expand Down
54 changes: 29 additions & 25 deletions 5/fastcgi/index.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
<?php
namespace docker {
final class DefaultServerPlugin {
public function __construct(
private \AdminerPlugin $adminer
) { }

public function loginFormField(...$args) {
return (function (...$args) {
$field = \Adminer\Adminer::loginFormField(...$args);

return \str_replace(
'name="auth[server]" value="" title="hostname[:port]"',
\sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')),
$field,
);
})->call($this->adminer, ...$args);
}
}

function adminer_object() {
require_once('plugins/plugin.php');
/**
* Prefills the “Server” field with the ADMINER_DEFAULT_SERVER environment variable.
*/
final class DefaultServerPlugin extends \Adminer\Plugin {
public function __construct(
private \Adminer\Adminer $adminer
) { }

public function loginFormField(...$args) {
return (function (...$args) {
$field = $this->loginFormField(...$args);

return \str_replace(
'name="auth[server]" value="" title="hostname[:port]"',
\sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')),
$field,
);
})->call($this->adminer, ...$args);
}
}

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

// Load the DefaultServerPlugin last to give other plugins a chance to
// override loginFormField() if they wish to.
$plugins[] = &$loginFormPlugin;

$adminer = new \AdminerPlugin($plugins);
$adminer = new \Adminer\Plugins($plugins);

$loginFormPlugin = new DefaultServerPlugin($adminer);
(function () {
$last = &$this->hooks['loginFormField'][\array_key_last($this->hooks['loginFormField'])];
if ($last instanceof \Adminer\Adminer) {
$defaultServerPlugin = new DefaultServerPlugin($last);
$this->plugins[] = $defaultServerPlugin;
$last = $defaultServerPlugin;
}
})->call($adminer);

return $adminer;
}
Expand Down
54 changes: 29 additions & 25 deletions 5/index.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
<?php
namespace docker {
final class DefaultServerPlugin {
public function __construct(
private \AdminerPlugin $adminer
) { }

public function loginFormField(...$args) {
return (function (...$args) {
$field = \Adminer\Adminer::loginFormField(...$args);

return \str_replace(
'name="auth[server]" value="" title="hostname[:port]"',
\sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')),
$field,
);
})->call($this->adminer, ...$args);
}
}

function adminer_object() {
require_once('plugins/plugin.php');
/**
* Prefills the “Server” field with the ADMINER_DEFAULT_SERVER environment variable.
*/
final class DefaultServerPlugin extends \Adminer\Plugin {
public function __construct(
private \Adminer\Adminer $adminer
) { }

public function loginFormField(...$args) {
return (function (...$args) {
$field = $this->loginFormField(...$args);

return \str_replace(
'name="auth[server]" value="" title="hostname[:port]"',
\sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')),
$field,
);
})->call($this->adminer, ...$args);
}
}

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

// Load the DefaultServerPlugin last to give other plugins a chance to
// override loginFormField() if they wish to.
$plugins[] = &$loginFormPlugin;

$adminer = new \AdminerPlugin($plugins);
$adminer = new \Adminer\Plugins($plugins);

$loginFormPlugin = new DefaultServerPlugin($adminer);
(function () {
$last = &$this->hooks['loginFormField'][\array_key_last($this->hooks['loginFormField'])];
if ($last instanceof \Adminer\Adminer) {
$defaultServerPlugin = new DefaultServerPlugin($last);
$this->plugins[] = $defaultServerPlugin;
$last = $defaultServerPlugin;
}
})->call($adminer);

return $adminer;
}
Expand Down