-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·96 lines (77 loc) · 2.68 KB
/
Copy pathcompile.sh
File metadata and controls
executable file
·96 lines (77 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
if [ $# -lt 1 ]
then
echo 'usage: ./compile.sh languagecode [design]'
exit 1
fi
DESIGNS_DIR="adminer/designs"
INCLUDES_DIR="adminer/adminer/include/"
LANGUAGES_DIR="adminer/adminer/lang"
PLUGINS_DIR="adminer/plugins"
TRANSLATIONS_FILE="warning-translations.csv"
CSS_FILE="adminer/adminer/static/default.css"
COMPILE_CMD="php adminer/compile.php sqlite"
# COMMIT_VERSION="v4.17.1"
# COMMIT_VERSION="v5.3.0"
# COMMIT_VERSION="v5.4.1"
COMMIT_VERSION="v5.4.2"
step=1
if [ ! -d "adminer" ]
then
echo -e "\n$step. Load adminer's sources:\n"
((step+=1))
git clone --depth 1 --branch $COMMIT_VERSION --recurse-submodules -c advice.detachedHead=false https://github.com/vrana/adminer.git
echo -e "\n$step. Add plugin to source and \"bootstrap\" it\n"
((step+=1))
cp fc-sqlite-connection-without-credentials.php $PLUGINS_DIR/fc-sqlite-connection-without-credentials.php
cat << "EOPHP" >> $PLUGINS_DIR/fc-sqlite-connection-without-credentials.php
function adminer_object() {
$plugins = array(new AdminerFCSqliteConnectionWithoutCredentials());
return new Plugins($plugins);
}
EOPHP
cp $INCLUDES_DIR/bootstrap.inc.php $INCLUDES_DIR/vrana-bootstrap.inc.php
cat << "EOPHP" >> $INCLUDES_DIR/fc-bootstrap.inc.php
<?php
require "../plugins/fc-sqlite-connection-without-credentials.php";
EOPHP
cat $INCLUDES_DIR/fc-bootstrap.inc.php $INCLUDES_DIR/vrana-bootstrap.inc.php > $INCLUDES_DIR/bootstrap.inc.php
sed -i '2,$s/<?php$//' adminer/adminer/include/bootstrap.inc.php
# fix: function_exists('adminer_object') to function_exists('Adminer\adminer_object')
sed -i "s/(function_exists('adminer_object') ? adminer_object()/(function_exists('Adminer\\\adminer_object') ? adminer_object()/" $INCLUDES_DIR/bootstrap.inc.php
fi
echo -e "\n$step. Search warning translation\n"
((step+=1))
language=$1
translation=$(grep ^$language, $TRANSLATIONS_FILE | cut -d',' -f2 | tr -d '\n')
if [ "$translation" != "" ]
then
echo $translation
cp $LANGUAGES_DIR/$language.inc.php $LANGUAGES_DIR/$language.inc.php.backup
sed -i 's/);//' $LANGUAGES_DIR/$language.inc.php
cat << EOPHP >> $LANGUAGES_DIR/$language.inc.php
'Warning: don\'t use it in a production environment!' => '$translation',
);
EOPHP
fi
if [ $# -eq 2 ]
then
design=$2
echo -e "\n$step. Set the design: $design\n"
((step+=1))
cp $CSS_FILE $CSS_FILE.backup
cat $CSS_FILE.backup $DESIGNS_DIR/$design/adminer.css > $CSS_FILE
fi
echo -e "\n$step. Compile in language: $language\n"
((step+=1))
$COMPILE_CMD $language 2> /dev/null
echo -e "\n$step. Clean the sources\n"
((step+=1))
if [ "$translation" != "" ]
then
cp $LANGUAGES_DIR/$language.inc.php.backup $LANGUAGES_DIR/$language.inc.php
fi
if [ $# -eq 2 ]
then
cp $CSS_FILE.backup $CSS_FILE
fi
echo -e "\n$step. Voilà!\n"