mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
bug fix: CP-26
This commit is contained in:
@@ -191,6 +191,6 @@ LANGUAGES = (
|
|||||||
('bn', _('Bangla')),
|
('bn', _('Bangla')),
|
||||||
)
|
)
|
||||||
|
|
||||||
MEDIA_URL = '/home/cyberpanel/media/'
|
MEDIA_URL = '/usr/local/CyberCP/tmp'
|
||||||
MEDIA_ROOT = MEDIA_URL
|
MEDIA_ROOT = MEDIA_URL
|
||||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
|
||||||
@@ -595,11 +595,29 @@ class FileManager:
|
|||||||
finalData['uploadStatus'] = 1
|
finalData['uploadStatus'] = 1
|
||||||
finalData['answer'] = 'File transfer completed.'
|
finalData['answer'] = 'File transfer completed.'
|
||||||
|
|
||||||
|
### Check if upload path tmp dir is not available
|
||||||
|
|
||||||
|
UploadPath = '/usr/local/CyberCP/tmp/'
|
||||||
|
|
||||||
|
if not os.path.exists(UploadPath):
|
||||||
|
command = 'mkdir %s' % (UploadPath)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
command = 'chown cyberpanel:cyberpanel %s' % (UploadPath)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
command = 'chmod 711 %s' % (UploadPath)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
## Random file name
|
||||||
|
|
||||||
|
RanddomFileName = str(randint(1000, 9999))
|
||||||
|
|
||||||
myfile = self.request.FILES['file']
|
myfile = self.request.FILES['file']
|
||||||
fs = FileSystemStorage()
|
fs = FileSystemStorage()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = fs.save(myfile.name, myfile)
|
filename = fs.save(RanddomFileName, myfile)
|
||||||
finalData['fileName'] = fs.url(filename)
|
finalData['fileName'] = fs.url(filename)
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile('%s. [375:upload]' % (str(msg)))
|
logging.writeToFile('%s. [375:upload]' % (str(msg)))
|
||||||
@@ -623,14 +641,14 @@ class FileManager:
|
|||||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||||
|
|
||||||
command = 'cp ' + self.returnPathEnclosed(
|
command = 'cp ' + self.returnPathEnclosed(
|
||||||
'/home/cyberpanel/media/' + myfile.name) + ' ' + self.returnPathEnclosed(
|
'/home/cyberpanel/media/' + RanddomFileName) + ' ' + self.returnPathEnclosed(
|
||||||
self.data['completePath'] + '/' + myfile.name)
|
self.data['completePath'] + '/' + myfile.name)
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
self.changeOwner(self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name))
|
self.changeOwner(self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove(self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name))
|
os.remove(self.returnPathEnclosed(UploadPath + RanddomFileName))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -639,7 +657,7 @@ class FileManager:
|
|||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
try:
|
try:
|
||||||
os.remove(self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name))
|
os.remove(self.returnPathEnclosed(UploadPath + RanddomFileName))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return self.ajaxPre(0, str(msg))
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|||||||
@@ -674,6 +674,9 @@ class preFlightsChecks:
|
|||||||
command = 'sysctl --system'
|
command = 'sysctl --system'
|
||||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||||
|
|
||||||
|
command = 'chmod 700 %s' % ('/home/cyberpanel')
|
||||||
|
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
def install_unzip(self):
|
def install_unzip(self):
|
||||||
|
|||||||
@@ -2107,6 +2107,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
|
|||||||
command = 'sysctl --system'
|
command = 'sysctl --system'
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
|
command = 'chmod 700 %s' % ('/home/cyberpanel')
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
Upgrade.stdOut("Permissions updated.")
|
Upgrade.stdOut("Permissions updated.")
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
|
|||||||
Reference in New Issue
Block a user