Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing a page with the toggle visibility button doesn’t update the sitemap.xml #756

Closed
ausi opened this issue Apr 11, 2017 · 16 comments
Assignees
Labels
Milestone

Comments

@ausi
Copy link
Member

ausi commented Apr 11, 2017

If you publish a page with the publish/unpublish button the sitemap.xml does not get rewritten. I think this can be fixed by calling $this->updateSitemap() in the tl_page::toggleVisibility() method.

@leofeyer leofeyer added the bug label Apr 12, 2017
@leofeyer leofeyer added this to the 4.3.8 milestone Apr 12, 2017
@leofeyer
Copy link
Member

@leofeyer leofeyer removed this from the 4.3.8 milestone Apr 24, 2017
@Toflar
Copy link
Member

Toflar commented Apr 24, 2017

Can we try to remove the sleep() call anyway? That absolutely makes no sense :-D

@leofeyer
Copy link
Member

You can try, but

for some reason it does not work without sleep(1)

@ausi
Copy link
Member Author

ausi commented Apr 24, 2017

Your link goes to tl_news, but the problem I have is with tl_page, see tl_page.php:1780 a call to $this->updateSitemap() is missing there.

@leofeyer leofeyer added this to the 4.3.10 milestone May 2, 2017
@leofeyer
Copy link
Member

leofeyer commented May 16, 2017

You are right. The sitemap update is triggered in on of the onsubmit callbacks, however we are only executing the save callbacks of the field. @contao/developers Should we also execute the onsubmit callbacks or is it sufficient to simply add $this->updateSitemap()?

@leofeyer leofeyer modified the milestones: 4.3.11, 4.3.10 May 16, 2017
@ausi
Copy link
Member Author

ausi commented May 16, 2017

I agree that it might be a good idea to execute the onsubmit callbacks so that third party callbacks on tl_page get executed too. But maybe we should add a check for $dc not being null then, because the onsubmit callbacks depend on the $dc parameter AFAIK.

@DanielSchwiperich
Copy link
Contributor

running the onsubmit callback stack is out of context to me when changing one field via a different functionality.

I would vote (if I could 😃 ) to just add the updateSitemap method to save callback of the field.

@leofeyer
Copy link
Member

@DanielSchwiperich I get your point. But the onsubmit callbacks would also run if you edited the record and only changed the one field, wouldn't it?

@Toflar
Copy link
Member

Toflar commented May 17, 2017

To me, the onsubmit_callback should be triggered as well.

@DanielSchwiperich
Copy link
Contributor

yes leo, there's also no reasonable scenario coming to mind where this should not be ok.

@leofeyer leofeyer modified the milestones: 4.3.11, 4.3.12, 4.4.0 Jun 2, 2017
@leofeyer leofeyer self-assigned this Jun 5, 2017
@leofeyer
Copy link
Member

leofeyer commented Jun 5, 2017

Fixed in a46f8ac. The changes worked in my test setup, still I encourage you to review them thoroughly.

@ausi
Copy link
Member Author

ausi commented Jun 6, 2017

I’m not sure about the places with ($dc ?: $this) because $this is not a DataContainer. If my callback has a DataContainer type hint against the $dc parameter it would fail, shouldn’t we just skip the callbacks if $dc is null?

@leofeyer
Copy link
Member

leofeyer commented Jun 6, 2017

Do you remember why we have added ($dc ?: $this) in the first place? See contao/core#7314

@ausi
Copy link
Member Author

ausi commented Jun 7, 2017

OK, so if i understand it correctly, $dc is always set unless someone calls the method in his own project/extension and $this is then only passed for BC reasons, right?

@leofeyer
Copy link
Member

leofeyer commented Jun 7, 2017

Yes, I think so.

@fatcrobat
Copy link

fatcrobat commented Sep 12, 2017

@leofeyer I know this issue was already closed, but running tl_page::updateSitemap as onsubmit_callback which will trigger Automator::generateSitemap will also trigger each $GLOBALS['TL_HOOKS']['getSearchablePages'] hook. We have customers with a lots of news (5000+) that will result in hight memory consumption and increased page load. Is the sitemap generation not something that should done by with a cron job?

leofeyer added a commit that referenced this issue Nov 13, 2019
Description
-----------

Fixes #756

Commits
-------

e56434ae Adjust the help text of the start/stop fields (see #756)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants