MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / PackagePanel

Function PackagePanel

tools_en.py:211–324  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209
210# Package panel
211def PackagePanel():
212 print('========================================================')
213 print('|-Cleaning log information...'),
214 public.M('logs').where('id!=?', (0,)).delete()
215 print('\t\t\033[1;32m[done]\033[0m')
216 print('|-Cleaning task history...'),
217 public.M('tasks').where('id!=?', (0,)).delete()
218 print('\t\t\033[1;32m[done]\033[0m')
219 print('|-Cleaning network monitoring records...'),
220 public.M('network').dbfile('system').where('id!=?', (0,)).delete()
221 print('\t\033[1;32m[done]\033[0m')
222 print('|-Cleaning CPU monitoring records...'),
223 public.M('cpuio').dbfile('system').where('id!=?', (0,)).delete()
224 print('\t\033[1;32m[done]\033[0m')
225 print('|-Cleaning disk monitoring records...'),
226 public.M('diskio').dbfile('system').where('id!=?', (0,)).delete()
227 print('\t\033[1;32m[done]\033[0m')
228 print('|-Cleaning IP information...'),
229 os.system('rm -f /www/server/panel/data/iplist.txt')
230 os.system('rm -f /www/server/panel/data/address.pl')
231 os.system('rm -f /www/server/panel/data/*.login')
232 os.system('rm -f /www/server/panel/data/domain.conf')
233 os.system('rm -f /www/server/panel/data/user*')
234 os.system('rm -f /www/server/panel/data/admin_path.pl')
235 os.system('rm -rf /www/backup/panel/*')
236 os.system('rm -f /root/.ssh/*')
237
238 print('\t\033[1;32m[done]\033[0m')
239 print('|-Cleaning system usage traces...'),
240 command = '''cat /dev/null > /var/log/boot.log
241cat /dev/null > /var/log/btmp
242cat /dev/null > /var/log/cron
243cat /dev/null > /var/log/dmesg
244cat /dev/null > /var/log/firewalld
245cat /dev/null > /var/log/grubby
246cat /dev/null > /var/log/lastlog
247cat /dev/null > /var/log/mail.info
248cat /dev/null > /var/log/maillog
249cat /dev/null > /var/log/messages
250cat /dev/null > /var/log/secure
251cat /dev/null > /var/log/spooler
252cat /dev/null > /var/log/syslog
253cat /dev/null > /var/log/tallylog
254cat /dev/null > /var/log/wpa_supplicant.log
255cat /dev/null > /var/log/wtmp
256cat /dev/null > /var/log/yum.log
257history -c
258'''
259 os.system(command)
260 print('\t\033[1;32m[done]\033[0m')
261 if sys.version_info[0] == 3:
262 a_input = input('|-Automatically optimize PHP/MySQL configuration on first boot?(y/n default: y): ')
263 else:
264 a_input = raw_input('|-Automatically optimize PHP/MySQL configuration on first boot?(y/n default: y): ')
265 if not a_input: a_input = 'y'
266 print(a_input)
267 if not a_input in ['Y', 'y', 'yes', 'YES']:
268 public.ExecShell("rm -f /www/server/panel/php_mysql_auto.pl")

Callers 1

tools_en.pyFile · 0.70

Calls 12

ExecShellMethod · 0.80
writeFileMethod · 0.80
readFileMethod · 0.80
deleteMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
dbfileMethod · 0.45
loadsMethod · 0.45
dumpsMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected