• Resolved predaytor

    (@predaytor)


    <?php
    
    function extend_configuration() {
        function adminer_object() {
            include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';
            include_once "./plugins/plugin.php";
            include_once "./plugins/login-password-less.php";
    
            class AdminerCustomization extends \AdminerPlugin  {
                function loginFormField($name, $heading, $value) {
                    return parent::loginFormField($name, $heading, str_replace('value="server"', 'value="sqlite"', $value));
                }
                function database() {
    
                    return WP_CONTENT_DIR . '/database/.ht.sqlite';
                }
            }
    
            return new AdminerCustomization(array(
                new \Pexlechris_Adminer(),
                new \AdminerLoginPasswordLess(password_hash("password", PASSWORD_DEFAULT)),
            ));
        }
    }
    add_action('pexlechris_adminer_before_adminer_loads', 'extend_configuration', 999);
    

    Following setup for Adminer Plugins, I cannot get this work for sqlite ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Pexle Chris

    (@pexlechris)

    Hi,

    First of all why do you need to login without a password?

    In adminers documentation, I have found this

    https://github.com/vrana/adminer/blob/master/adminer/sqlite.php

    In your code there is \ for different namespace… I don’t know your folders and the namespace that you use. Have you tested that your function is executed?

    And also

        include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';
        include_once "./plugins/plugin.php";
        include_once "./plugins/login-password-less.php";

    these are included successfully?

    Plugin Author Pexle Chris

    (@pexlechris)

    You could try to do something like this…

    
    
    
    function extend_configuration() {
    	function adminer_object() {
    
    		include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';
    
    		class AdminerLoginPasswordLess extends Pexlechris_Adminer{
    			/** @access protected */
    			var $password_hash;
    
    			/** Set allowed password
    			 * @param string result of password_hash
    			 */
    			function __construct($password_hash) {
    				$this->password_hash = $password_hash;
    			}
    
    			function credentials() {
    				$password = get_password();
    				return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
    			}
    
    			function login($login, $password) {
    				if ($password != "") {
    					return true;
    				}
    			}
    
    		}
    
    		class AdminerCustomization extends AdminerLoginPasswordLess  {
    			function loginFormField($name, $heading, $value) {
    				return parent::loginFormField($name, $heading, str_replace('value="server"', 'value="sqlite"', $value));
    			}
    			function database() {
    
    				return WP_CONTENT_DIR . '/database/.ht.sqlite';
    			}
    		}
    		return new AdminerCustomization();
    
    	}
    }
    add_action('pexlechris_adminer_before_adminer_loads', 'extend_configuration', 999);

    but I think you dont need to include AdminerLoginPasswordLess plugin because I have its methods in my class Pexlechris_Adminer

    Plugin Author Pexle Chris

    (@pexlechris)

    And also have in mind that adminer’s hook customizations can be placed in a mu-plugin or a custom plugin. If you try to place to your child theme, the code will not work

    Thread Starter predaytor

    (@predaytor)

    I thank you for fast response. But, unfortunately, this setup does not work. I have used this hook in functions.php in currently active theme. Actually, it seems this hook is never fired, I cannot output some data to debug.log ??

    I’m using Bedrock setup with SQLite database as mu-plugin.

    Plugin Author Pexle Chris

    (@pexlechris)

    Yes ffrom theme dont fired.

    You nneed to Place it either in a must use plugin or in a custom plugin.

    Instructions on how to create a mu plugin you can find here https://www.pexlechris.dev/how-to-add-php-hooks-in-your-wordpress-site/

    Have iin mind that display errors is disabled even WP_DEBUG_DISPLAY is set to true

    Thread Starter predaytor

    (@predaytor)

    Thank you! I will try later.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Setup with SQLite Database Integration’ is closed to new replies.