mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 14:37:36 +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() }}" />
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||||
<select name="action">
|
<select name="action">
|
||||||
<option value="importusers">Create users from mod list</option>
|
<option value="importusers">Create users from mod list</option>
|
||||||
<option value="importscreenshots">Import screenshots from VCS</option>
|
<option value="importscreenshots" selected>Import screenshots from VCS</option>
|
||||||
<option value="importdepends" selected>Import dependencies from downloads</option>
|
<option value="importdepends">Import dependencies from downloads</option>
|
||||||
|
<option value="modprovides">Set provides to mod name</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="Perform" />
|
<input type="submit" value="Perform" />
|
||||||
</form>
|
</form>
|
||||||
|
@ -55,6 +55,16 @@ def admin_page():
|
|||||||
elif action == "importdepends":
|
elif action == "importdepends":
|
||||||
task = importAllDependencies.delay()
|
task = importAllDependencies.delay()
|
||||||
return redirect(url_for("check_task", id=task.id, r=url_for("admin_page")))
|
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:
|
else:
|
||||||
flash("Unknown action: " + action, "error")
|
flash("Unknown action: " + action, "error")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user