• Cyberchicken

    (@cyberchicken)


    I know how to write and add plugins to the standard Adminer.
    I am able to add plugins to the AriAdminer, by modifing wrapper.php or by redefining function adminer_object.
    But I don’t like this method a 100% because it needs to tamper the code one way or another.

    I noticed that the loading of the code is dynamic:

            foreach ( glob( $plugins_path . '*.php' ) as $plugin_file ) {
                require_once $plugin_file;
            }
    

    but the instantiation is not:

            $plugins = array(
                new AdminerDatabaseHide(
                    array( 'information_schema' )
                ),
    
                new AdminerDumpBz2,
    

    etc

    I have a tested snippet of code that is able to detect which new classes are loaded with each inlude/require.

    static::$loadedClasses = [];
    foreach (glob( $plugins_path.'*.php')as $plugin_file) {
    	require_once $plugin_file; // this can lead to compilation problems if the new class name is already present
    	$newDeclaredClasses = get_declared_classes();
    	$justLoadedClasses = array_diff($newDeclaredClasses, $previousDeclaredClasses);
    	foreach ($justLoadedClasses as $className) {
    		// take note of the class name or instatiate an object
    	}
    	$previousDeclaredClasses = $newDeclaredClasses;
    }
    

    feel free to use it! (anybody)

    BTW I’m adding “PHP Serialized Data” by Don Wilson.

  • The topic ‘add Adminer’s plugins’ is closed to new replies.