update Adminer to AdminerEvo (#2632)

This commit is contained in:
Daniel Hansson 2024-05-11 14:31:26 +02:00 committed by GitHub
parent 1cced01e6d
commit bbe98eeeb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 3 deletions

View File

@ -52,9 +52,13 @@ a2enmod ssl
# Install Adminer
apt-get update -q4 & spinner_loading
install_if_not adminer
curl_to_dir "http://www.adminer.org" "latest.php" "$ADMINERDIR"
curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Adminer/master" "adminer.css" "$ADMINERDIR"
ln -s "$ADMINERDIR"/latest.php "$ADMINERDIR"/adminer.php
curl_to_dir "https://download.adminerevo.org/latest/adminer" "adminer-pgsql.zip" "$ADMINERDIR"
install_if_not unzip
# Unzip the latest version
unzip "$ADMINERDIR"/adminer-pgsql.zip -d "$ADMINERDIR"
rm -f "$ADMINERDIR"/adminer-pgsql.zip
# curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Adminer/master" "adminer.css" "$ADMINERDIR"
ln -s "$ADMINERDIR"/adminer-pgsql.php "$ADMINERDIR"/adminer.php
# Only add TLS 1.3 on Ubuntu later than 22.04
if version 22.04 "$DISTRO" 24.04.10
@ -65,6 +69,46 @@ fi
# Get PHP version for the conf file
check_php
# shellcheck disable=2154
# Add ability to add plugins easily
cat << ADMINER_CREATE_PLUGIN > "$ADMINER_CONF_PLUGIN"
<?php
function adminer_object() {
// required to run any plugin
include_once "./plugins/plugin.php";
// autoloader
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
// enable extra drivers just by including them
//~ include "./plugins/drivers/simpledb.php";
$plugins = array(
// specify enabled plugins here
new AdminerDumpXml(),
new AdminerTinymce(),
new AdminerFileUpload("data/"),
new AdminerSlugify(),
new AdminerTranslation(),
new AdminerForeignSystem(),
);
/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/
return new AdminerPlugin($plugins);
}
// include original Adminer or Adminer Editor
include "./adminer.php";
ADMINER_CREATE_PLUGIN
cat << ADMINER_CREATE > "$ADMINER_CONF"
<VirtualHost *:80>
RewriteEngine On

1
lib.sh
View File

@ -162,6 +162,7 @@ NOTIFY_PUSH_SERVICE_PATH="/etc/systemd/system/notify_push.service"
# Adminer
ADMINERDIR=/usr/share/adminer
ADMINER_CONF="$SITES_AVAILABLE/adminer.conf"
ADMINER_CONF_PLUGIN="$ADMINERDIR/extra_plugins.php"
# Redis
REDIS_CONF=/etc/redis/redis.conf
REDIS_SOCK=/var/run/redis/redis-server.sock