Add admin action to check for broken links

Fixes #546
This commit is contained in:
rubenwardy
2024-07-04 21:52:24 +01:00
parent d738e19ce9
commit 1006971271
2 changed files with 38 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ from app.tasks.forumtasks import import_topic_list, check_all_forum_accounts
from app.tasks.importtasks import import_repo_screenshot, check_zip_release, check_for_updates, update_all_game_support, \
import_languages
from app.tasks.usertasks import import_github_user_ids
from app.tasks.pkgtasks import notify_about_git_forum_links, clear_removed_packages
from app.tasks.pkgtasks import notify_about_git_forum_links, clear_removed_packages, check_package_for_broken_links
from app.utils import add_notification, get_system_user
actions = {}
@@ -404,3 +404,9 @@ def delete_empty_threads():
flash(f"Deleted {count} threads", "success")
return redirect(url_for("admin.admin_page"))
@action("DANGER: Check for broken links in all packages")
def check_for_broken_links():
for package in Package.query.filter_by(state=PackageState.APPROVED).order_by(db.desc(Package.score)).limit(100).all():
check_package_for_broken_links.delay(package.id)