@@ -6,7 +6,7 @@ This plugin for the Web application [Adminer](https://www.adminer.org/en/) allow
66
77:medal_sports : This plugin is now in the official list of [ User Contributed Plugins for Adminer] ( https://www.adminer.org/en/plugins/#user ) .
88
9- ## :construction_worker : Install or :gear : Build or :new : : robot : Use : new :
9+ ## :construction_worker : Install or :new : : gear : Compile or :robot : Use
1010### :construction_worker : Install the plugin
1111The plugin is used like any other [ Adminer plugins] ( https://www.adminer.org/en/plugins/ ) , that is to say that it requires the following files:
1212
@@ -38,36 +38,94 @@ function adminer_object() {
3838require "./adminer-current.php";
3939```
4040
41- ### :gear : Build single file version of adminer-4-sqlite3
41+ ### :new : : gear : Compile a single file version
4242This script is used to build a SQLite3 "dedicated" Adminer file:
4343* easy installation (a file to copy)
44+ * light size (< 190Ko)
45+ * can embedded your favorite design
4446* respect the philosophy of Adminer
4547> Adminer consist of a single file ready to deploy to the target server.
4648``` bash
47- #! /usr/bin/env bash
48-
49- # define the URLs
50- ADMINER=https://www.adminer.org/latest.php
51- PLUGIN=https://raw.github.com/vrana/adminer/master/plugins/plugin.php
52- MYPLUGIN=https://github.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer/raw/master/fc-sqlite-connection-without-credentials.php
53- # load and concatenate into one file
54- wget -O adminer-4-sqlite3.php $ADMINER $PLUGIN $MYPLUGIN
55-
56- # add myplugin to Adminer
57- # http://tldp.org/LDP/abs/html/here-docs.html#EX71C
58- cat << "EOPHP " >> adminer-4-sqlite3.php
59-
49+ if [ $# -lt 1 ]
50+ then
51+ echo ' usage: ./compile.sh languagecode [design]'
52+ exit 1
53+ fi
54+
55+ LANGUAGES_DIR=" adminer/adminer/lang"
56+ TRANSLATIONS_FILE=" warning-translations.csv"
57+ CSS_FILE=" adminer/adminer/static/default.css"
58+ DESIGNS_DIR=" adminer/designs"
59+ COMPILE_CMD=" php adminer/compile.php sqlite "
60+
61+ step=1
62+ if [ ! -d " adminer" ]
63+ then
64+ echo -e " \n$step . Load adminer's sources:\n"
65+ (( step+= 1 ))
66+
67+ git clone --recurse-submodules https://github.com/vrana/adminer.git
68+ echo -e " \n$step . Load plugin's sources:\n"
69+ (( step+= 1 ))
70+ wget -P adminer/plugins/ https://raw.githubusercontent.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer/master/fc-sqlite-connection-without-credentials.php
71+ echo -e " \n$step . Adding the plugin to the sources\n"
72+ (( step+= 1 ))
73+ cat << "EOPHP " >> adminer/adminer/include/bootstrap.inc.php
74+ include "../plugins/plugin.php";
75+ include "../plugins/fc-sqlite-connection-without-credentials.php";
6076function adminer_object() {
61- $plugins = array(new FCSqliteConnectionWithoutCredentials());
62- return new AdminerPlugin($plugins);
63- }
77+ $plugins = array(new FCSqliteConnectionWithoutCredentials());
78+ return new AdminerPlugin($plugins);
79+ }
6480EOPHP
65- # remove all the <?php except the first
66- # http://www.theunixschool.com/2011/02/sed-replace-or-substitute-file-contents.html
67- sed -i ' 2,$s/<?php$//' adminer-4-sqlite3.php
81+ fi
82+
83+ echo -e " \n$step . Search warning translation\n"
84+ (( step+= 1 ))
85+
86+ language=$1
87+ translation=$( grep ^$language , $TRANSLATIONS_FILE | cut -d' ,' -f2 | tr -d ' \n' )
88+ if [ " $translation " != " " ]
89+ then
90+ echo $translation
91+ cp $LANGUAGES_DIR /$language .inc.php $LANGUAGES_DIR /$language .inc.php.backup
92+ sed -i ' s/);//' $LANGUAGES_DIR /$language .inc.php
93+ cat << EOPHP >> $LANGUAGES_DIR /$language .inc.php
94+ 'Warning: don\'t use it in a production environment!' => '$translation ',
95+ );
96+ EOPHP
97+ fi
98+
99+ if [ $# -eq 2 ]
100+ then
101+ design=$2
102+ echo -e " \n$step . Set the design: $design \n"
103+ (( step+= 1 ))
104+ cp $CSS_FILE $CSS_FILE .backup
105+ cat $CSS_FILE .backup $DESIGNS_DIR /$design /adminer.css > $CSS_FILE
106+ fi
107+
108+ echo -e " \n$step . Compile in language: $language \n"
109+ (( step+= 1 ))
110+
111+ $COMPILE_CMD $language 2> /dev/null
112+
113+ echo -e " \n$step . Clean the sources\n"
114+ (( step+= 1 ))
115+ if [ " $translation " != " " ]
116+ then
117+ cp $LANGUAGES_DIR /$language .inc.php.backup $LANGUAGES_DIR /$language .inc.php
118+ fi
119+
120+ if [ $# -eq 2 ]
121+ then
122+ cp $CSS_FILE .backup $CSS_FILE
123+ fi
124+
125+ echo -e " \n$step . Voilà!\n"
68126```
69127
70- ### :new : : robot : Use the [ latest prebuilded release] ( https://github.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer/releases/latest ) : new :
128+ ### :robot : Use the [ latest prebuilded release] ( https://github.com/FrancoisCapon/LoginToASqlite3DatabaseWithoutCredentialsWithAdminer/releases/latest )
71129
72130## :desktop_computer : Using Adminer with SQLite3 databases
73131Simply "authenticate" by clicking on the Authentication button by indicating (or not) the path of an existing database.
0 commit comments