mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add 'set provides from name' admin action
This commit is contained in:
parent
d0969263ba
commit
a2b873bf38
@ -18,8 +18,9 @@
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<select name="action">
|
||||
<option value="importusers">Create users from mod list</option>
|
||||
<option value="importscreenshots">Import screenshots from VCS</option>
|
||||
<option value="importdepends" selected>Import dependencies from downloads</option>
|
||||
<option value="importscreenshots" selected>Import screenshots from VCS</option>
|
||||
<option value="importdepends">Import dependencies from downloads</option>
|
||||
<option value="modprovides">Set provides to mod name</option>
|
||||
</select>
|
||||
<input type="submit" value="Perform" />
|
||||
</form>
|
||||
|
@ -55,6 +55,16 @@ def admin_page():
|
||||
elif action == "importdepends":
|
||||
task = importAllDependencies.delay()
|
||||
return redirect(url_for("check_task", id=task.id, r=url_for("admin_page")))
|
||||
elif action == "modprovides":
|
||||
packages = Package.query.filter_by(type=PackageType.MOD).all()
|
||||
mpackage_cache = {}
|
||||
for p in packages:
|
||||
if len(p.provides) == 0:
|
||||
p.provides.append(MetaPackage.GetOrCreate(p.name, mpackage_cache))
|
||||
|
||||
db.session.commit()
|
||||
return redirect(url_for("admin_page"))
|
||||
|
||||
else:
|
||||
flash("Unknown action: " + action, "error")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user