Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
* release/1.0.0:
  Adjust directory structure
  Switch PHP comment syntax for INI files
  Add adminer.php to .gitignore
  • Loading branch information
K-Ko committed Sep 19, 2017
2 parents 8c713cf + 24a234f commit 2f30489
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 881 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +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
827 changes: 0 additions & 827 deletions adminer.php

This file was deleted.

4 changes: 2 additions & 2 deletions bin/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ cfg=$path/config/config.ini

[ ! -s $cfg ] && echo 'Missing configuration file!' && exit 1

### Get config
. $cfg
### Get config, transform from PHP ini to shell
eval $(grep -v '^;' $cfg | sed 's/ *\(=\) */\1/g')

### Temp file for download
new=$(mktemp)
Expand Down
42 changes: 21 additions & 21 deletions config/config.ini.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
###
### MySQL socket
###
;
; MySQL socket
;
mysql = localhost:/var/run/mysqld/mysqld.sock

###
### Adminer Version
### latest stable version: http://www.adminer.org/latest[-mysql][-de].php
###
;
; Adminer Version
; latest stable version: http://www.adminer.org/latest[-mysql][-de].php
;

### All, multi-language
# version=latest.php
; All, multi-language
; version = latest.php

### MySQL only, multi-language
; MySQL only, multi-language
version = latest-mysql.php

### MySQL only, german
# version=latest-mysql-de.php
; MySQL only, german
; version = latest-mysql-de.php

###
### Adminer Theme
### https://github.com/pematon/adminer-theme
###
### If not set, use default theme
###
#theme = default-orange
#theme = default-blue
#theme = default-green
;
; Adminer Theme
; https://github.com/pematon/adminer-theme
;
; If not set, use default theme
;
; theme = default-orange
; theme = default-blue
; theme = default-green
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 2f30489

Please sign in to comment.