Graham Quince Posted September 1, 2021 Share Posted September 1, 2021 We've got a school keen to reuse their class sites, but they've made extensive use the Site Timeline for galleries. (Biggest one had 7.5Gb of files in the timeline) There's various support / dev options possible, but seeing as all they wanted was the exact same site without any pictures attached, I've prepared this code for an HTML widget. It's not 100% perfect (i.e. it could do with tidying up) but it clears out a site's timeline in the background: Site UUID: <input type="text" id="uuid" class="siteuuid" name="siteuuid"><br> <btn class="btn btn-warning asset_delete">DELETE Loads of Timeline Assets</btn> <div class="deleteStatus"></div> <script> var assetDELETE = arguments[0].find('.asset_delete'); assetDELETE.click(function(){ deleteOldAssets(); }); function deleteOldAssets() { var siteUUID = $('.siteuuid').val(); if (siteUUID) { console.log(siteUUID); Frog.Model.api('timeline.search', { context: siteUUID, limit: "2500", refresh: "true", requiredKeywords: ["timeline asset"], since: "0", target: "62D1A1EE20025294051F3FC408A84B01A904A4FC50D3E7CE" }).done(function(response) { var events = response.data.events; $('.deleteStatus').text("Found: "+events.length+" images"); for (var i = 0; i< events.length; i++) { Frog.Model.api('timeline.deleteevent', { uuid: events[i].uuid },{ type: 'POST' }).done(function(response) { console.log("DELETED"); }).fail(function(e) { console.log("FAILED"); }); } }).fail(function(e) { console.log("FAILED"); }); } } </script> To get the Site UUID, I used Chris Smith's bookmarklet: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now