Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adminer-pematon: init at 4.12 #358530

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

JohnRTitor
Copy link
Contributor

@JohnRTitor JohnRTitor commented Nov 23, 2024

Link: https://github.com/pematon/adminer

This is an active fork of adminer by pematon.
Seems to be in rapid development.

The index.php is required for plugins to work, and the upstream provides an example, but not a ".php" file in the src. We need to modify it for NixOS use anyway.

The index.php file is the same one used by adminerevo, I wasn't sure if I should reference a file out of the package's dir, so I copied it here.

Closes #353454

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@JohnRTitor JohnRTitor marked this pull request as draft November 24, 2024 08:09
@JohnRTitor JohnRTitor requested a review from drupol November 24, 2024 08:50
@JohnRTitor JohnRTitor marked this pull request as ready for review November 24, 2024 08:50
@JohnRTitor
Copy link
Contributor Author

JohnRTitor commented Nov 24, 2024

@ofborg build adminer-pematon

Closes #353454, I originally wanted it to replace the original adminer, but since it didn't gain interest, let's init the fork as a separate package

@@ -0,0 +1,35 @@
<?php

namespace nixos {
Copy link
Contributor

@drupol drupol Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinionated: I would modify this into something more functional, like:

<?php

declare(strict_types=1);

namespace nixos {
    use AdminerPlugin;

    use function sprintf;

    function adminer_object(): object
    {
        require_once __DIR__ . '/plugins/plugin.php';

        if (!file_exists(__DIR__ . '/plugins.json')) {
            return new AdminerPlugin();
        }

        $plugins = array_map(
            static function (string $name): ?object {
                $plugin = sprintf('%s/plugins/%s.php', __DIR__, $name);

                if (!is_readable($plugin)) {
                    return null;
                }

                require $plugin;

                preg_match_all('/(\w+)/', $name, $matches);

                return new sprintf('Adminer%s', implode('', array_map('ucfirst', $matches[1])));
            },
            json_decode(file_get_contents(sprintf('%s/plugins.json', __DIR__), true))
        );

        return new AdminerPlugin(array_filter($plugins));
    }
}

Copy link
Contributor Author

@JohnRTitor JohnRTitor Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks, tested and it works.

One thing I might add though, do you know perhaps a way to override to use adminer-theme?

I am currently removing the index.php provided by this package, and adding an index.php with modifications for adminer theme.

This is an active fork of adminer by pematon. Seems to be in rapid development.
The index.php is required for plugins to work, and the upstream provides an example, but not a ".php" file.
We need to modify it for NixOS use anyway.

Co-authored-by: Pol Dellaiera <[email protected]>
Signed-off-by: John Titor <[email protected]>
@JohnRTitor JohnRTitor merged commit d1d5334 into NixOS:master Nov 27, 2024
33 of 34 checks passed
@JohnRTitor JohnRTitor added the backport release-24.11 Backport PR automatically label Nov 27, 2024
Copy link
Contributor

Successfully created backport PR for release-24.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update request: adminer 4.8.1 → 4.11 (pematon fork)
2 participants