Skip to content

Commit d591aaf

Browse files
committed
Bux fixes
Grepping for php.ini and .htaccess files work as expected now, however the for-loop is still not accepting the echo/read to decide if you want to delete the line, so I've commented that out.
1 parent 5206200 commit d591aaf

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

phpini.sh

+11-21
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ function prompts() {
6565
exit 1 #Clean exit on failed input
6666
fi
6767

68-
echo "Beginning OS check now."
69-
70-
if grep -s "CloudLinux" /etc/redhat-release; then
68+
if grep -qs "CloudLinux" /etc/redhat-release; then
7169
server="shared"
7270
else
7371
server="dedicated"
@@ -95,8 +93,7 @@ function prompts() {
9593
exit 1 #Clean exit on failed input
9694
fi
9795
fi
98-
fi
99-
echo "Ending OS check now."
96+
fi
10097
fi
10198
}
10299

@@ -222,30 +219,23 @@ function flagwork() {
222219

223220
function shareddebug() {
224221
#Final check to see if there is an .htaccess that would affect PHP
225-
for files in find /home/"$user"/ -name "php.ini"
226-
do
227-
echo "Notice: php.ini file found at $files"
228-
#This is the future home of the diff between new php.ini and the found php.ini
222+
find /home/"$user"/ -name "php.ini" | while read phpname; do
223+
echo "Notice: php.ini file found at $phpname"
229224
done
230225

231226
#Final check to see if there is an .htaccess file that would affect PHP
232-
for htaccesses in find /home/"$user"/ -name ".htaccess" #New for loop that will check all directories, recusively
233-
do
234-
if grep -q "x-httpd-php" "$htaccesses"; then
227+
find /home/"$user"/ -name ".htaccess" | while read htname; do
228+
if grep -q "x-httpd-php" "$htname"; then
235229
echo -ne "\033[31m" #Red color
236-
echo "There is an .htaccess in $htaccesses with PHP version directives."
237-
grep "x-httpd-php" "$htaccesses"
238-
echo -n " would you like to remove it? (y/n) "
239-
read delme
230+
echo "There is an .htaccess in $htname with PHP version directives."
231+
grep "x-httpd-php" "$htname"
232+
#read -p "Would you like to remove it? (y/n) " delme
233+
echo -ne "\033[0;39m" #Reset color
240234
if [ "$delme" == "y" ]; then
241-
sed -i '/x-httpd-php/d' "$htaccesses"
235+
sed -i '/x-httpd-php/d' "$htname"
242236
fi
243237
fi
244238
done
245-
246-
echo -ne "\033[32m" #Green color
247-
echo "Debugging complete."
248-
echo -ne "\033[0;39m" #Reset color
249239
}
250240

251241
prompts

0 commit comments

Comments
 (0)