This commit is contained in:
Greenweb Bangladesh 2025-12-10 01:00:23 +01:00 committed by GitHub
commit 5d8ace2ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 44 additions and 6 deletions

View File

@ -386,17 +386,18 @@ class FileManager:
RemoveOK = 1
command = 'touch %s/hello.txt' % (self.homePath)
command = 'touch %s/public_html/hello.txt' % (self.homePath)
result = ProcessUtilities.outputExecutioner(command)
result_lower = result.lower()
if result.find('No such file or directory') > -1:
if 'cannot touch' in result_lower or 'no such file or directory' in result_lower:
RemoveOK = 0
command = 'chattr -R -i %s' % (self.homePath)
ProcessUtilities.executioner(command)
else:
command = 'rm -f %s/hello.txt' % (self.homePath)
command = 'rm -f %s/public_html/hello.txt' % (self.homePath)
ProcessUtilities.executioner(command)
@ -424,6 +425,24 @@ class FileManager:
if RemoveOK == 0:
command = 'chattr -R +i %s' % (self.homePath)
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/logs/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/.trash/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/backup/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/incbackup/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/lscache/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/.cagefs/'
ProcessUtilities.executioner(command)
except:
try:
skipTrash = self.data['skipTrash']
@ -435,17 +454,18 @@ class FileManager:
RemoveOK = 1
command = 'touch %s/hello.txt' % (self.homePath)
command = 'touch %s/public_html/hello.txt' % (self.homePath)
result = ProcessUtilities.outputExecutioner(command)
result_lower = result.lower()
if result.find('No such file or directory') > -1:
if 'cannot touch' in result_lower or 'no such file or directory' in result_lower:
RemoveOK = 0
command = 'chattr -R -i %s' % (self.homePath)
ProcessUtilities.executioner(command)
else:
command = 'rm -f %s/hello.txt' % (self.homePath)
command = 'rm -f %s/public_html/hello.txt' % (self.homePath)
ProcessUtilities.executioner(command)
for item in self.data['fileAndFolders']:
@ -462,6 +482,24 @@ class FileManager:
if RemoveOK == 0:
command = 'chattr -R +i %s' % (self.homePath)
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/logs/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/.trash/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/backup/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/incbackup/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/lscache/'
ProcessUtilities.executioner(command)
command = 'chattr -R -i %s' % (self.homePath) + '/.cagefs/'
ProcessUtilities.executioner(command)
json_data = json.dumps(finalData)
return HttpResponse(json_data)