git-hacks

git-hacks Commit Details

Date:2014-10-02 20:34:54 (3 years 6 months ago)
Author:Nicola Fontana
Branch:master
Commit:ae2ce33daebc82e9bc7b25daecc5dca6d41c376a
Parents: 98e052469b2404e84d32ebc9ef37da407cee7c2b
Message:gitdeploy: improve performances

Avoid multiple queries on the same directory. Furthermore, do not hide
the error messages, if any.
Changes:
Mgitdeploy (1 diff)

File differences

gitdeploy
6666
6767
6868
69
70
71
72
73
74
75
76
69
70
71
72
73
74
75
76
77
7778
7879
7980
8081
8182
82
83
84
85
83
8684
8785
88
89
90
86
87
9188
9289
9390
refresh_silverstripe() {
local dir="$1"
local code cfg type server username password database
local php="
define('BASE_PATH', realpath('.'));
define('FRAMEWORK_DIR', file_exists(BASE_PATH . '/framework') ? 'framework' : 'sapphire');
//define('TEMP_FOLDER', '/tmp');
require_once(BASE_PATH . '/' . FRAMEWORK_DIR . '/core/Core.php');
foreach (\$databaseConfig as \$k => \$v) {
local php code type server username password database
# Check if this directory has at least one _config* file/directory
stat -c '' $dir/*/_config* >/dev/null 2>&1 || return 1
php="define('BASE_PATH', realpath('.'));
define('FRAMEWORK_DIR', file_exists(BASE_PATH . '/framework') ? 'framework' : 'sapphire');
require_once(BASE_PATH . '/' . FRAMEWORK_DIR . '/core/Core.php');
foreach (\$databaseConfig as \$k => \$v) {
\$v = addcslashes(\$v, '\\'');
echo \"\$k='\$v'\n\";
}"
cd "$dir"
for cfg in */_config.php; do
code=$(php -r "$php" 2>/dev/null)
[ "$?" = "0" ] && eval "$code" && [ -n "$database" ] && break
done
code=$(php -r "$php")
cd - >/dev/null
if [ -z "$server" -o -z "$username" -o -z "$password" -o -z "$database" ]; then
return 1
fi
eval "$code" || return 1
[ -n "$database" -a -n "$server" -a -n "$username" -a -n "$password" ] || return 1
mysqldump -h"$server" -u"$username" -p"$password" \
--skip-lock-tables --skip-dump-date --skip-add-locks \

Archive Download the corresponding diff file

Branches