-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfix-bugs.sh
More file actions
executable file
·123 lines (111 loc) · 4.29 KB
/
fix-bugs.sh
File metadata and controls
executable file
·123 lines (111 loc) · 4.29 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
set -e
echo "=========================================="
echo "SuiteCRM 8.4.0 Bug Fix Script"
echo "=========================================="
echo ""
# Check if running inside container or outside
if [ -f "/var/www/html/LICENSE.txt" ]; then
# Inside container
WORKDIR="/var/www/html"
else
# Outside container - use docker exec
WORKDIR="."
PREFIX="docker compose exec php"
fi
fix_bug_1() {
echo "Checking Bug #1: Duplicate static variable in AOW_WorkFlow..."
if [ -z "$PREFIX" ]; then
count=$(grep -c "static \$sfh" public/legacy/modules/AOW_WorkFlow/aow_utils.php 2>/dev/null || echo "0")
else
count=$($PREFIX grep -c "static \\\$sfh" public/legacy/modules/AOW_WorkFlow/aow_utils.php 2>/dev/null || echo "0")
fi
echo " Found $count static \$sfh declarations"
if [ "$count" -ge 2 ]; then
if [ -z "$PREFIX" ]; then
sed -i '644d' public/legacy/modules/AOW_WorkFlow/aow_utils.php
else
$PREFIX sed -i '644d' public/legacy/modules/AOW_WorkFlow/aow_utils.php
fi
echo " ✓ Fixed: Removed duplicate declaration"
else
echo " ✓ Already fixed or not present"
fi
}
fix_bug_2() {
echo ""
echo "Checking Bug #2: Duplicate static variable in InlineEditing..."
if [ -z "$PREFIX" ]; then
count=$(grep -c "static \$sfh" public/legacy/include/InlineEditing/InlineEditing.php 2>/dev/null || echo "0")
else
count=$($PREFIX grep -c "static \\\$sfh" public/legacy/include/InlineEditing/InlineEditing.php 2>/dev/null || echo "0")
fi
echo " Found $count static \$sfh declarations"
if [ "$count" -ge 2 ]; then
if [ -z "$PREFIX" ]; then
sed -i '294d' public/legacy/include/InlineEditing/InlineEditing.php
else
$PREFIX sed -i '294d' public/legacy/include/InlineEditing/InlineEditing.php
fi
echo " ✓ Fixed: Removed duplicate declaration"
else
echo " ✓ Already fixed or not present"
fi
}
fix_bug_3() {
echo ""
echo "Checking Bug #3: Incorrect RewriteBase in .htaccess..."
if [ -z "$PREFIX" ]; then
if grep -q "RewriteBase localhostlegacy/" public/legacy/.htaccess 2>/dev/null; then
sed -i 's|RewriteBase localhostlegacy/|RewriteBase /legacy/|' public/legacy/.htaccess
echo " ✓ Fixed: Corrected RewriteBase path"
else
echo " ✓ Already fixed or not present"
fi
else
if $PREFIX grep -q "RewriteBase localhostlegacy/" public/legacy/.htaccess 2>/dev/null; then
$PREFIX sed -i 's|RewriteBase localhostlegacy/|RewriteBase /legacy/|' public/legacy/.htaccess
echo " ✓ Fixed: Corrected RewriteBase path"
else
echo " ✓ Already fixed or not present"
fi
fi
}
unlock_installer() {
echo ""
echo "Checking installer lock status..."
if [ -z "$PREFIX" ]; then
if [ -f "public/legacy/config.php" ]; then
if grep -q "'installer_locked' => true" public/legacy/config.php 2>/dev/null; then
sed -i "s/'installer_locked' => true/'installer_locked' => false/" public/legacy/config.php
echo " ✓ Unlocked installer"
else
echo " ✓ Installer already unlocked"
fi
fi
else
if $PREFIX test -f public/legacy/config.php 2>/dev/null; then
if $PREFIX grep -q "'installer_locked' => true" public/legacy/config.php 2>/dev/null; then
$PREFIX sed -i "s/'installer_locked' => true/'installer_locked' => false/" public/legacy/config.php
echo " ✓ Unlocked installer"
else
echo " ✓ Installer already unlocked"
fi
fi
fi
}
# Apply all fixes
fix_bug_1
fix_bug_2
fix_bug_3
unlock_installer
echo ""
echo "=========================================="
echo "Bug fixes complete!"
echo "=========================================="
echo ""
echo "Next steps:"
echo "1. Clear cache: docker compose exec php bash -c \"rm -rf cache/prod/* public/legacy/cache/*\""
echo "2. Restart PHP: docker compose restart php"
echo "3. Run installation: docker compose exec php bin/console suitecrm:app:install -U root -P root -H mysql -Z 3306 -N root -u admin -p admin -S localhost -d no -W true"
echo ""