Jump to content
Graham Quince

Delete all Site Timeline assets

Recommended Posts

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>
<div class="btn btn-warning assetDELETE">DELETE Loads of Timeline Assets</div>
<div class="deleteStatus"></div>

<script>
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");
     });
    }
}

To get the Site UUID, I used Chris Smith's bookmarklet: 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...