RavanH / xml-sitemap-feed

XML Sitemap & Google News feeds
GNU General Public License v2.0
16 stars 21 forks source link

sitemaps (as part of a filter chain) are not rebuild sometimes #20

Open kochtopf opened 6 years ago

kochtopf commented 6 years ago

Hi, This bug is somewhat related to issue#19 (plugin nginx-helper apply_filters get the urls of changed sitemaps). This is working great adding, deleting restoring new posts. It doesn't work if the post is scheduled to publish or a post is edited. Then no sitemaps urls are passed through the filter chain. THis problem is new in v505. No such issue in v494.

kochtopf commented 6 years ago

found an issue in nginx-purger.

RavanH commented 6 years ago

Hi @kochtopf thanks for reporting :)

So you identified the cause?

kochtopf commented 6 years ago

Hi RavanH, I looked a little bit further into this and can now say for sure that there is a problem with scheduled posts. Editing posts works fine (had a problem with that cron running with root instead of www-data). What I have so far: nginx-helper (purger.php) runs // Allow plugins/themes to modify/extend urls. Pass urls array in first parameter, second says if wildcards are allowed $purge_urls = apply_filters('rt_nginx_helper_purge_urls', $purge_urls, false); //somewhere at line 850 to get back an array of urls - in the case of xml-sitemap-feed they are like /sitemap.xml, /sitemap-home.xml, /sitemap-posttype-post.yyyy.xml ... This works except for scheduled post run through through you own cron job like: /* Disable wp-cron ind wp-config.php / define('DISABLE_WP_CRON', true); 0,20,40 6-23 * www-data /usr/bin/php /srv/site/wordpress/wp-cron.php In this situation the passed array of urls from xml-sitemap-feed is empty.

I still need to check a configuration without cron and will let you know...

kochtopf commented 6 years ago

ARGH I remember. I never could get wp-cron.php to work correctly with cloudflare and nginx fastcgi cache. Those schedules always ended up as "missed schedules". The other option - define( 'ALTERNATE_WP_CRON', true ); worked but did bypass nginx-helper. Thank you for reading.

RavanH commented 6 years ago

/** Disable wp-cron ind wp-config.php */ define('DISABLE_WP_CRON', true); 0,20,40 6-23 * * * www-data /usr/bin/php /srv/site/wordpress/wp-cron.php In this situation the passed array of urls from xml-sitemap-feed is empty.

That is strange... Appart from the Nginx Helper purge filter, I wonder if pings are skipped then too. Will have to test.

RavanH commented 5 years ago

I've done some tests and as far as I can figure out, the rt_nginx_helper_purge_urls filter hook does not get called at all both on WP Cron or when calling wp-cron.php manually or by cron job. It does get called at the time when scheduling a new post, and not actually publishing it.

Feels like a bug in Nginx Helper...