Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pluginInstaller/pluginInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,17 @@ def removeFromSettings(pluginName):

@staticmethod
def removeFromURLs(pluginName):
data = open("/usr/local/CyberCP/CyberCP/urls.py", 'r').readlines()
writeToFile = open("/usr/local/CyberCP/CyberCP/urls.py", 'w')
path = "/usr/local/CyberCP/CyberCP/urls.py"
pattern = re.compile(rf"\bpath\([^)]*{re.escape(pluginName)}[^)]*\)")

for items in data:
if items.find(pluginName) > -1:
removed = False
for line in fileinput.input(path, inplace=True, backup=".bak", encoding="utf-8"):
if (not removed) and pattern.search(line):
removed = True
continue
else:
writeToFile.writelines(items)
print(line, end="")

writeToFile.close()
return removed

@staticmethod
def informCyberPanelRemoval(pluginName):
Expand Down