Improve broken symlink removal

This commit is contained in:
VirtuBox
2024-04-21 17:37:30 +02:00
parent e7eb865648
commit 8ddaa7e98f
4 changed files with 13 additions and 10 deletions

View File

@@ -253,8 +253,7 @@ class WOAcme:
for dir in acmedir:
if os.path.exists('{0}'.format(dir)):
WOFileUtils.rm(self, '{0}'.format(dir))
# find all broken symlinks
WOFileUtils.findBrokenSymlink(self, "/var/www")
else:
if os.path.islink("{0}".format(sslconf)):
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))

View File

@@ -318,10 +318,9 @@ class WOFileUtils():
"""
links = []
broken = []
ignored_dirs = ['./.git', './htdocs']
for root, dirs, files in os.walk(sympath):
if any(root.startswith(ignore_dir) for ignore_dir in ignored_dirs):
if root.startswith('./.git'):
# Ignore the .git directory.
continue
for filename in files: