Skip to content

Commit

Permalink
Adjust directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Ko committed Sep 19, 2017
1 parent 6ece716 commit 24a234f
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
config.ini
adminer.php

.verbose
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Adminer installation with auto-update script

git clone https://github.com/K-Ko/Adminer-autoupdated.git /var/www/html

You can point your web server root directory also to `public`.

## Copy configuration template

cp config/config.conf.dist config/config.conf
Expand All @@ -21,7 +23,7 @@ Adminer installation with auto-update script

## Or create a link to run daily

sudo ln -s /path/to/adminer-web/bin/update.sh /etc/cron.daily/update-adminer
sudo ln -s /path/to/adminer-web/bin/update.sh /etc/cron.daily/adminer-update

## Design

Expand Down
31 changes: 1 addition & 30 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
<?php

extension_loaded('newrelic') && newrelic_set_appname('Adminer');

$cfg = 'config/config.ini';

if (!file_exists($cfg)) die('Missing configuration file!');

$config = parse_ini_file($cfg);

function adminer_object()
{
// Plugins auto-loader
foreach (glob("plugins/*.php") as $filename) {
include_once $filename;
}

global $config;

$plugins = [
new AdminerLoginSingleServer($config['mysql']),
new AdminerJsonColumn
];
if (isset($config['theme'])) {
$plugins[] = new AdminerTheme($config['theme']);
}
return new AdminerPlugin($plugins);
}

include 'adminer.php';
<?php header('Location: public/');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
53 changes: 53 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

if (!file_exists('../.verbose')) {
// Quiet
ini_set('display_errors', 0);
error_reporting(0);
} else {
// Quiet
ini_set('display_errors', 1);
error_reporting(-1);
}

extension_loaded('newrelic') && newrelic_set_appname('Adminer');

$cfg = '../config/config.ini';

if (!file_exists($cfg)) {
die('Missing configuration file!');
}

$config = parse_ini_file($cfg);

if (!file_exists('../adminer.php')) {
// Load inital
exec('bin/update.sh');
die(header('Location: '.$_SERVER['REQUEST_URI']));
}

/**
* Wrapper function
*/
function adminer_object()
{
global $config;

// Plugins auto-loader
foreach (glob('../plugins/*.php') as $filename) {
include_once $filename;
}

$plugins = array(
new AdminerLoginSingleServer($config['mysql']),
new AdminerJsonColumn
);

if (isset($config['theme'])) {
$plugins[] = new AdminerTheme($config['theme']);
}

return new AdminerPlugin($plugins);
}

include '../adminer.php';

0 comments on commit 24a234f

Please sign in to comment.