Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Listing entry Structure URIs wiped after installing Publisher and saving an entry

Status Resolved
Add-on / Version Publisher
Severity Critical
EE Version

Timothy Kelty

May 13, 2013

It appears that after installing Publisher and saving an entry, all of my entries that were listing entries in Structure, no longer have URIs.

I’ll deploy to my staging site so you can get into the CP if you want.

#1

Brian Litzinger

Very odd. First I’ve heard of such a thing. What happens if you just drag and drop re-order any page in Structure (this triggers a rebuild of the whole pages array).

#2

Timothy Kelty

Re-ordering in Structure doesn’t seem to break it. Note that these are Structure listing entries that are effected, so not entries that show up explicitly in the Structure tree UI.

I updated the ticket with login info.

Steps to reproduce:

  • Note a Structure listing entry: (e.g. http://staging.telx.fusionarydev.com/data-center/new-york/) URL works, and you can go into the entry and see the uri slug populated.

  • Edit or publish any entry (as draft or published doesn’t seem to matter)

  • Listing entries now have no URIs, and will load 404s. Editing the entries shows an empty URI slug in the Structure tab.

#3

Brian Litzinger

Ok. I’m pretty slammed right now and might not get time to dig into this until tomorrow night :/

#4

Timothy Kelty

Ok, thanks.

I might poke around if I get time. Any hunches or suspicious of where to start looking?

I could try and upgrade from 2.5.5 to 261 and/or upgrade Structure from 338 to 339.

#5

Timothy Kelty

What’s even stranger, is it doesn’t seem to be every listing entry, just most.

#6

BoldMinded (Brian)

Did you have Sync Drafts turned off at one time, then turn it on? I published several entries in the Blog channel and it created the page uris properly. I can see though what you are referring to though, and the entries that were messing up were ones that did not have a draft entry in the publisher_titles table, which leads me to believe that Sync Drafts was turned off at one time?

For now, you can just save everything as Open/Published and it should clear the issue up. I do have a local copy of the site you sent (thanks, huge help) and will continue to look into this.

#7

Timothy Kelty

I’m pretty sure I never touched the sync drafts setting.

I know that when you publish a new entry (e.g. blog), the uri is ok for THAT entry, but for me, it still screws up other entries URIs.

As soon as I publish a new entry in the blog channel (or edit/publish elsewhere), all the entries in “Data Center » Metro Area” (except Chicago and Atlanta?!) lose their URIs (see the “Data Centers” dropdown in the main nav).

#8

BoldMinded (Brian)

The root of the issue appears to be that the publisher_titles table does not have a draft row for each entry. The Sync Drafts setting makes sure that one should always exist. I can also drag and drop/reorder any page in the Structure menu and it rebuilds everything correctly.

If you look at the bottom of sessions_end method you’ll see $this->debug(); uncomment that and load the front-end. It’ll show you all the site_pages arrays (1 for each language and status). So you can use that to see what happens after saving an entry or reordering Structure.

#9

Timothy Kelty

I also just noticed - The draft/published toggling in the bar seems to be broken as well.

That is, I’m able to save a draft, but I’m unable to toggle the “View” state beyond what the default is.

If I save as draft, the live version of the entry isn’t updated, but adding ?status=draft doesn’t show the draft version. In addition, once saved, the draft preview isn’t shown on the preview screen (you’ll have to disable the SC Publish Redirect ext on your local copy).

Un-related or not, once I installed Publisher, the entries loop that displays the content under the “Data Centers” dropdown reversed order. It was orderby=”title”, sort=”asc”, and as soon as I installed Publisher, it reversed (possibly just sorting by date now).

It seems strange that I’m having so many strange problems, so I thought I’d try a full uninstall and reinstall, but I still had the same problems.

#10

BoldMinded (Brian)

0.98.8 changed from ?status=draft to ?publisher_status=draft - which does it show in the url when you try to change the view status? Did you clear your browser cache? The JS does some redirecting and it might be using an old file.

The sorting problem might be a bug. The other problems though… yeah it seems odd that you’re having so many.

#11

Timothy Kelty

Ok ?publisher_status=draft works, and clearing browser cache seems to have fixed the issue with not being able to switch. Sorry, should have tried that first.

Sorting problem is still there, and the draft preview isn’t showing on the preview page.

#12

BoldMinded (Brian)

On the draft preview page, can you inspect it and look at the source URL of the iframe?

#13

Timothy Kelty

No iframe in the source at all, suspiciously. Nothing at all beneath the #view_content_entry_links div.

#14

BoldMinded (Brian)

Strange. Well, I have the build you sent, so I can dig into this too locally. May be day or two before I get these figured out.

#15

Timothy Kelty

I appreciate it. Sorry for all the problems!

I have 0.98.8 on an EE 2.6 and the preview is working. Do you think its worth upgrading from 255?

#16

BoldMinded (Brian)

It should be me apologizing to you 😊

Now that is odd. I have a 2.6 environment too that I can test on. I did a lot of variable renaming in this release, mostly for the status, so its possible the find and replace missed something. Is it 2.6.1 or 2.6.0? I wouldn’t got to just 2.6.0, but its worth a shot.

#17

BoldMinded (Brian)

Note, if you’re going to upgrade I’d do it with a separate db instance and code branch or something 😊

#18

Timothy Kelty

The one I have working is 2.6, but I’ll go to 2.6.1 with both on a separate instance and see if I have any luck.

#19

BoldMinded (Brian)

Ok, couple of findings. First, this first hook was not applied: http://boldminded.com/add-ons/publisher/third-party-add-ons/structure - its in the latest version of Structure though by default.

Second, many Blog entries don’t have a Structure URL Title value: https://www.evernote.com/shard/s9/sh/31706890-16f5-41fe-baa3-64a90addbe84/57449e4dabbf1b837e7bc76a63d4cb29

Did all or most of the blog entries exist prior to installing Publisher? That might explain why the draft versions of the entries don’t exist. Basically it seems Publisher is functioning as expected if there is no draft row… it doesn’t add it to the site_pages array b/c its a draft.

#20

Timothy Kelty

I’ll try the latest Structure.

I know the blog entries don’t have Structure URL titles, that’s the problem (they did prior to Publisher). If you roll back to the “before wipe” db I sent you, you’ll notice they all have Stucture URIs. Once you save ANY entry with Publisher installed, they lose their Structure URL titles/URIs.

The same thing is happening with “Data Center » Location”, and seemingly any entries that are specified as a Structure listing channel.

#21

BoldMinded (Brian)

Ok, I’ll take a look at the migration script again.

#22

Timothy Kelty

Structure 3.3.10 didn’t seem to have an effect.

#23

Timothy Kelty

Upgraded to EE 2.6.1, no effect

#24

BoldMinded (Brian)

Yeah, its clearly a Publisher issue. I have the site setup at home and will take a look at the migration script again to see why those urls aren’t getting migrated. Looking at the migrations script it also doesn’t appear to be creating the draft rows, so thats another part of the problem. Once both of those are fixed then I feel like the issue should be resolved, right?

#25

Timothy Kelty

Yep, I think so.

There’s the less critical issue of the entries loop ordering flipping, which if not related, I can make a separate ticket if you prefer.

#26

BoldMinded (Brian)

Do you have a copy of the DB prior to installing Publisher the first time? I’m specifically curious to see what the site_pages array looked like.

Commenting out the session_start() call doesn’t let Publisher install correctly, it doesn’t get to the migration process. I’m able to replicate the slowness with the site setup in MAMP, but I don’t get that same slowness in my two other dev environments with the same server configuration, so there is something in your site that is causing the session file to get locked and not writable, thus session_start() is slow. Other popular add-ons use session_start too, so it isn’t a unique thing I’m doing :/

#27

BoldMinded (Brian)

As for the sorting, without orderby or sort params set, entries seem to be sorting correctly for me, which is desc: https://www.evernote.com/shard/s9/sh/273efcfd-9d50-4697-af65-b0917fc9bbc0/e901f2e66cfa7ab3f213f5ca66257c9b

#28

Timothy Kelty

I’ll look for a DB prior to Publisher at all, I think I have one.

If you think the session_start is part of the problem, that may make sense why I’m not seeing these problems on my other site with publisher, where for whatever reason, I didn’t have to comment it out. It is a different iteration of the bootstrap we use, so maybe that’s it.

If you think that’s the culprit, I can look closer at the differences in my config/bootstrap between the 2 installs.

#29

Timothy Kelty

For the sorting issue, can you check out “/templates/site_templates/website/site.group/_page.html”, around like 139: {code} {exp:channel:entries channel=”map” dynamic=”no” disable=”categories|category_fields|member_data|pagination|trackbacks” orderby=”title” sort=”asc” } <li>{title}</li> {/exp:channel:entries} {/code}

So it should be A to Z, by title. But if you look on the front end, it’s Z-A. Prior to installing Publisher it was A-Z. https://www.evernote.com/shard/s2/sh/eb4db680-b465-4d2e-9e11-98f844b855bf/5203b6c185af21518da00b67cd953dc0

#30

Timothy Kelty

Here’s the DB prior to publisher: https://dl.dropboxusercontent.com/u/162604/telx-before-publisher-install.gz

#31

BoldMinded (Brian)

Thanks for sending that DB, will take a look at it tonight. I noticed your bootstrap was a little unique. It could also be another add-on causing a conflict? I actually uninstalled almost everything locally and it was still slow though. This is the best explanation I’ve seen for it, but doesn’t really provide much in terms of helping to debug it. http://stackoverflow.com/questions/1914242/problem-with-function-session-start-works-slowly/1914266#1914266

#32

Timothy Kelty

Yeah, I went through and uninstalled every ext/mod and it was still slow.

We have a new/fancier bootstrap as a Composer package (https://packagist.org/packages/fusionary/ee2-bootstrap), and in my install using that, I’m not seeing the slowness.

I’ll try migrating to that bootstrap and see if it helps.

#33

Timothy Kelty

Ok well I solved the session_start craziness: http://boldminded.com/support/ticket/437

So I was able to uncomment the session_start code and install Publisher, but the URLs are still getting wiped.

At least one mystery is solved!

#34

BoldMinded (Brian)

Ah, good to hear it was an easy fix. I’ll take that clean DB you sent earlier and try the install process tonight to see what is happening to the URLs. Basically during the install it looks at the site_pages array and pops off the last segment, which is the listing url_title, so as long as the site_pages array has keys for each listing then it should be a fairly easy fix.

#35

BoldMinded (Brian)

New file sent, should fix sorting and the installation/structure urls

#36

Timothy Kelty

Ordering is fixed, URIs are not, but getting closer…step to reproduce:

✓ start with “before publisher” DB I sent you ✓ uncomment session_start ✓ replace publisher_entry.php ✓ uninstall nsm addon updater ✓ install structure 3.3.10 ✓ install publisher ✓ update p+t add ons ✓ verify data centers order in main nav drop down - OK ✓ verify data centers uris - OK ✓ save an entry (as published) - #1194, Markets Media – Global Markets Summit ✓ re-verify data center drop down order - OK ✗ re-verify data center uris - FAIL, URIs are not output in rendered template ({page_uri} is parsed to an empty string)

What’s different since the last update you sent me is: If I go and edit one of those entries, the URIs are in fact there, in-tact, and if I re-save the entry, the {page_uri} gets parsed properly. So it looks like the only problem now is that before you re-save an entry, {page_uri} isn’t getting parsed for these listing entries.

#37

Brian Litzinger

That means its not in the site_pages array. Will examine it again this weekend.

#38

Timothy Kelty

Tried the file you sent, still no luck. Still seeing the URIs wiped when I save any entry.

I’m going to refer to “before save” the point right before an arbitrary entry was saved with Publisher installed. “After save” will be immediately after that.

Here’s some more info:

First off, the very first time I installed the latest version you email me, I got an undefined offset: 1 from publisher_site_pages.php:697. I figured maybe that was an error from cached json or something, so I cleared browser cache and reinstalled and never saw it again.

If I examine the $site_pages array (“before save” and after) that Publisher_site_pages->get is returing, the /data-center/foo uris are there. I also examined $site_pages from Structure->nav, and “before save”, the arrays are identical (918 items), and all the URIs are there. “After save”, the one from Publisher_site_pages has all the items, but the Structure one now only has 85 items. From the looks of it, it seems anything that was a listing entry has been removed.

Also strange, but I’m not sure related: If I look at the /data-center/ entry, and it’s listing children “before save”, things look as they should in the Structure tab. On the parent, the URI says “data-center”, and on the children, it says “url prefix: /data-center/”, and then the uri slug. “After save”, the parent looks the same, but now the children say “url prefix: /data-centers/”, which at one point a while ago was the URI (with the s). Not sure where that would even be coming from (cache?, or if it’s just re-populating from the “Data Centers” title?).

We’ve got a client expecting to play around with this this week, so if you could continue to keep me updated with when you’ll be able to look at it, that would be great.

I guess if we needed to, now that the URIs at least still show in the edit screen, I think maybe we can just go in a re-save every listing entry to get the Sturcture URIs back. I’m just not sure if they might get wiped again after that.

#39

BoldMinded (Brian)

Oh geez. Ok, this is a bit of an oversight on my part 😊 In Publisher_session.php, line 356 you’ll see this:

// If prefixing is disable, nothing else to do
        if ( ! ee()->publisher_setting->get('url_prefix'))
        {
            return;
        }

Change it to this:

// If prefixing is disable, nothing else to do
        if ( ! ee()->publisher_setting->get('url_prefix'))
        {
            $this->set_site_pages();
            return;
        }
#40

BoldMinded (Brian)

Crap, that isn’t the final fix, but one that needs to be made.

#41

BoldMinded (Brian)

Nevermind, I take that back. If you do that change and re-install it then you should be set. If you uninstall and re-install again things will go wonky unless you make this change:

publisher_site_pages.php ln 176

if ($status == PUBLISHER_STATUS_OPEN && $lang_id == ee()->publisher_lib->default_lang_id)
#42

Timothy Kelty

Those changes seem to do it!

Preview iframe is working now as well.

Thanks for the help, I’ll kick the tires today and see if it holds up.

Login to reply