Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • awm 187 posts 376 karma points
    Mar 12, 2015 @ 13:15
    awm
    0

    Is it possible to hook into the 'Republish entire site' event?

    At the moment I'm hooking into various events using the method described here. However I've noticed there doesn't seem to be an event for the republishing of the entire site. Is there any way I can hook into this event?

    Thanks

  • Charles Afford 1163 posts 1709 karma points
    Mar 15, 2015 @ 18:13
    Charles Afford
    0

    Hi, Alimac why do you need to hook into this event? All that is happening is the xml is getting removed and regenerated? Perhaps there is another way of doing what you want to do :).

    Charlie

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 16, 2015 @ 11:00
    Hendy Racher
    1

    Hi, does anyone know if this is possible ? (our use-case would be to flush an object cache when a user clicks "Republish entire site")

    There was an event umbraco.content.AfterUpdateDocumentCache, but this doesn't seem to be fired anymore.

  • awm 187 posts 376 karma points
    Mar 16, 2015 @ 11:03
    awm
    0

    I'm actually in the same position as Hendy: We want to update our object cache on the site republish...

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 16, 2015 @ 12:11
    Jeroen Breuer
    1

    Hello,

    Sorry I don't think there is an event for the 'Republish entire site'. Only after a single document cache has been updated. Like Hendy said that's the umbraco.content.AfterUpdateDocumentCache event, but it's still being fired and can be used. There isn't an alternative for that yet even though you might get some deprecated messages from the old Document api.

    Jeroen

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 16, 2015 @ 12:27
    Hendy Racher
    0

    Thanks Jeroen, unfotunately AfterUpdateDocumetCache doesn't seem to be being fired in Umbraco v7.2.1

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 16, 2015 @ 12:33
    Jeroen Breuer
    0

    I've got a website running on 7.2.1 where it does get fired. After a node has been saved and published. It's one of the last event's that get's fired.

    Jeroen

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 16, 2015 @ 12:39
    Hendy Racher
    0

    Arrh, I was trying with "Republish entire site", (for individual publishes I'm using the ContentService.Publishing event)

    Guess as hacky fix to get the "Republish entire site" to fire an event, we could use a FileSystemWatcher on the umbraco.config file ?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 16, 2015 @ 12:52
    Jeroen Breuer
    0

    For individual publishes I normally also use the ContentService.Publishing event, but in this situation I needed to make sure the xml cache was updated which was in the AfterUpdateDocumentCache event. 

    Jeroen

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 16, 2015 @ 19:48
    Hendy Racher
    1

    Hi,

    We found an event to hook into that will fire whenever the content cache is updated (which includes "Republish entire site")

    using Umbraco.Core;
    using Umbraco.Core.Cache;
    using Umbraco.Web.Cache;

    public class CleanCmsModelCache : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { CacheRefresherBase<PageCacheRefresher>.CacheUpdated += CleanCmsModelCache_CacheUpdated; } private void CleanCmsModelCache_CacheUpdated(PageCacheRefresher sender, CacheRefresherEventArgs e) {
    // Do Stuff
    } }

    HTH,

    Hendy

  • Nigel Wilson 945 posts 2077 karma points
    Jun 23, 2015 @ 20:45
    Nigel Wilson
    0

    Hey

    Sorry to reactivate this discussion but is there a way to refresh the cache and/or republish the entire site without logging in to the admin area.

    The reason for asking is dealing with site deployments and potentially needing to flush the cache once a deployment has been made and ideally wanting to automate the process.

    Cheers, Nigel

  • Kevin Jump 2341 posts 14868 karma points MVP 8x c-trib
    Jun 23, 2015 @ 21:49
    Kevin Jump
    0

    Hi

    It looks like the republish is within the content service so I think you would need to write some code to call RepublishAll, from the content Service

    so probibly

    ApplicationContext.Current.Services.ContentService.RepublishAll(); 
    

    you could pub this inside an Umbrao WebApi controller , then call it remotely on the site to kick off a republish (security concerns aside).

    you could look at using something like Chauffeur - and write a deliverable for it, that would do a republish all, then you could call something from the command line (i would guess that this would be quite slow however)

Please Sign in or register to post replies

Write your reply to:

Draft