-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_lines.sh
31 lines (25 loc) · 1.51 KB
/
comment_lines.sh
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
#!/bin/bash
# Specify the target file
target_file="/var/www/html/apps/settings/appinfo/routes.php"
# Comment out the specified lines
sed -i '/AppSettings#listCategories/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#viewApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#listApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#enableApp/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#enableApp/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#enableApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#disableApp/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#disableApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#updateApp/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#uninstallApp/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#viewApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#viewApps/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/AppSettings#force/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/Help#help/ { s/^/\/\/ /; t; }' "$target_file"
sed -i '/Reasons#getPdf/ { s/^/\/\/ /; t; }' "$target_file"
echo "Lines of routes.php commented out successfully!"
target_file_2="/var/www/html/lib/private/NavigationManager.php"
# Comment out the entire if condition
sed -i "/if (\$this->config->getSystemValueBool('\''knowledgebaseenabled'\'', true)) {/,/^ *\} *$/ {s/^/\/\//}" "$target_file_2"
# sed -i "/\/\/ App management/,/} *);}/ s/^/\/\//" "$target_file_2"
echo "Lines of NavigationManager.php commented out successfully!"