summaryrefslogtreecommitdiff
path: root/databases/adminer
diff options
context:
space:
mode:
Diffstat (limited to 'databases/adminer')
-rw-r--r--databases/adminer/Makefile35
-rw-r--r--databases/adminer/distinfo4
-rw-r--r--databases/adminer/files/makephar.php104
-rw-r--r--databases/adminer/files/pkg-message.in8
-rw-r--r--databases/adminer/pkg-descr11
5 files changed, 137 insertions, 25 deletions
diff --git a/databases/adminer/Makefile b/databases/adminer/Makefile
index d96c35ee7b08..b8372b3a5209 100644
--- a/databases/adminer/Makefile
+++ b/databases/adminer/Makefile
@@ -1,29 +1,44 @@
PORTNAME= adminer
DISTVERSION= 5.3.0
+PORTREVISION= 1
CATEGORIES= databases www
-MASTER_SITES= https://github.com/vrana/adminer/releases/download/v${DISTVERSION}/
-EXTRACT_SUFX= .php
-EXTRACT_ONLY=
+MASTER_SITES= https://github.com/vrana/${PORTNAME}/releases/download/v${DISTVERSION}/
+PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX}
+DISTFILES= ${PORTNAME}-${DISTVERSION}.php ${PORTNAME}-${DISTVERSION}.zip
+EXTRACT_ONLY= ${PORTNAME}-${DISTVERSION}.zip
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= pkaipila@gmail.com
COMMENT= Full-featured database management tool written in PHP
WWW= https://www.adminer.org
LICENSE= APACHE20
-USES= cpe php
-USE_PHP= session
+USES= cpe php:build,flavors
+USE_PHP= phar session zlib
NO_ARCH= yes
-NO_BUILD= yes
-SUB_FILES= pkg-message
-SUB_LIST= PHPVER="${PHP_VER}"
PLIST_SUB= WWWGRP="${WWWGRP}" \
WWWOWN="${WWWOWN}"
+OPTIONS_DEFINE= MYSQL PGSQL SQLITE
+OPTIONS_DEFAULT= MYSQL SQLITE
+
+MYSQL_DESC= MySQL and MariaDB driver
+PGSQL_DESC= PostgreSQL driver
+SQLITE_DESC= SQLite driver
+
+MYSQL_USE= PHP=mysqli
+PGSQL_USE= PHP=pgsql
+SQLITE_USE= PHP=sqlite3
+
+do-build:
+ ${CP} ${DISTDIR}/${PORTNAME}-${DISTVERSION}.php ${WRKSRC}/${PORTNAME}.php
+ ${CP} ${FILESDIR}/makephar.php ${WRKSRC}
+ ${LOCALBASE}/bin/php -d phar.readonly=0 ${WRKSRC}/makephar.php
+
do-install:
${MKDIR} ${STAGEDIR}${WWWDIR}
- ${INSTALL_DATA} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ${STAGEDIR}${WWWDIR}/index.php
+ ${INSTALL_DATA} ${WRKSRC}/index.php ${STAGEDIR}${WWWDIR}
.include <bsd.port.mk>
diff --git a/databases/adminer/distinfo b/databases/adminer/distinfo
index e3c273062e47..8f067ad01e51 100644
--- a/databases/adminer/distinfo
+++ b/databases/adminer/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1749839680
+TIMESTAMP = 1754700167
SHA256 (adminer-5.3.0.php) = 7dcc196e941b18b74635afe1740dcd86970ab08b8eba0f00f149925aea3972ed
SIZE (adminer-5.3.0.php) = 504560
+SHA256 (adminer-5.3.0.zip) = ec49d9d1faf1f22e835c73b913feb993e87e5ae7e54e8f1e0583515409a1eca8
+SIZE (adminer-5.3.0.zip) = 873271
diff --git a/databases/adminer/files/makephar.php b/databases/adminer/files/makephar.php
new file mode 100644
index 000000000000..4e463e7fdc4e
--- /dev/null
+++ b/databases/adminer/files/makephar.php
@@ -0,0 +1,104 @@
+<?php
+/***********************************************************
+ *
+ * Merges adminer.php and it's plugins to a phar archive
+ *
+ ***********************************************************/
+
+$phar = new Phar(
+ $tmpFile = __DIR__ . '/adminer_' . bin2hex(random_bytes(8)) . '.phar',
+ 0,
+ 'adminer.phar'
+);
+
+$stub = <<<STUB
+<?php
+/******************************************************************************
+ *
+ * All Adminer plugins are now included in this
+ * FreeBSD ports edition, no need to download
+ * them separately.
+ * https://www.adminer.org/en/plugins/
+ *
+ * copyright Paavo-Einari Kaipila (FreeBSD ports edition)
+ * copyright Jakub Vrana (original Adminer)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+if (file_exists(\$adminerObjectFile = __DIR__ . '/adminer-object.php'))
+{
+ require \$adminerObjectFile;
+}
+Phar::mapPhar('adminer.phar');
+define('ADMINER_PLUGIN_CLASSMAP', json_decode('%s', true));
+require 'phar://adminer.phar/autoload.php';
+__HALT_COMPILER();
+STUB;
+
+$classMap = [];
+$plugins = [];
+
+foreach(new DirectoryIterator(__DIR__ . '/plugins') as $file)
+{
+ if ($file->isFile())
+ {
+ $contents = php_strip_whitespace($file->getRealPath());
+ $pharFile = 'adminer-plugins/' . $file->getFileName();
+ $plugins[$pharFile] = $contents;
+ if (preg_match('/class\s(A[a-zA-Z]+)\sextends\sAdminer/', $contents, $m))
+ {
+ $classMap[$m[1]] = $file->getFileName();
+ }
+ }
+}
+
+$phar->setStub(
+ sprintf(
+ $stub,
+ json_encode($classMap, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
+ )
+);
+
+$autoLoader = <<<LOADER
+<?php
+spl_autoload_register(function(\$class)
+{
+ if (isset(ADMINER_PLUGIN_CLASSMAP[\$class]))
+ {
+ require __DIR__ . '/adminer-plugins/' . ADMINER_PLUGIN_CLASSMAP[\$class];
+ return true;
+ }
+});
+require __DIR__ . '/adminer.php';
+LOADER;
+
+$phar->addFromString(
+ 'autoload.php',
+ $autoLoader
+);
+
+foreach($plugins as $file => $contents)
+{
+ $phar->addFromString(
+ $file,
+ $contents
+ );
+}
+
+$phar->addFromString(
+ 'adminer.php',
+ php_strip_whitespace(__DIR__ . '/adminer.php'),
+);
+
+rename($tmpFile, __DIR__ . '/index.php');
diff --git a/databases/adminer/files/pkg-message.in b/databases/adminer/files/pkg-message.in
deleted file mode 100644
index 64a90680749d..000000000000
--- a/databases/adminer/files/pkg-message.in
+++ /dev/null
@@ -1,8 +0,0 @@
-[
-{ type: install
- message: <<EOM
-You should install the database extension(s) what you want to use:
-php%%PHPVER%%-mysqli, php%%PHPVER%%-mssql, php%%PHPVER%%-odbc, php%%PHPVER%%-pgsql or php%%PHPVER%%-pdo_sqlite.
-EOM
-}
-]
diff --git a/databases/adminer/pkg-descr b/databases/adminer/pkg-descr
index 8bc21a4f1858..8a364c1f0beb 100644
--- a/databases/adminer/pkg-descr
+++ b/databases/adminer/pkg-descr
@@ -1,7 +1,6 @@
-Adminer (formerly phpMinAdmin) is a full-featured database
-management tool written in PHP. Conversely to phpMyAdmin,
-it consist of a single file ready to deploy to the target
-server.
+Adminer is a full-featured database management tool in a
+single PHP file. Supports MySQL, SQLite and PostgreSQL.
-Adminer is available for MySQL, PostgreSQL, SQLite, MS SQL
-and Oracle.
+This port has been completely revamped. It is now flavored
+and plugins are built in to the same 600K file too, no
+need to download them separately or to track their updates.