Created
January 19, 2013 21:39
-
-
Save alixaxel/4575374 to your computer and use it in GitHub Desktop.
Collection of Adminer Plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** plugin_DatabaseHide.php | |
* @author Alix Axel | |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 | |
*/ | |
class AdminerDatabaseHide { | |
protected $disabled; | |
function AdminerDatabaseHide($disabled) { | |
$this->disabled = $disabled; | |
} | |
function databases($flush = true) { | |
return preg_grep('~' . $this->disabled . '~i', get_databases($flush), PREG_GREP_INVERT); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** plugin_ForeignConvention.php | |
* @author Alix Axel | |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 | |
*/ | |
class AdminerForeignConvention { | |
function foreignKeys($table) { | |
$result = array(); | |
foreach (preg_grep('~^id_|_id$~', array_keys(fields($table))) as $field) { | |
$result[] = array('table' => preg_replace('~^id_|_id$~', '', $field), 'source' => array($field), 'target' => array('id')); | |
} | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment