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

Multisite incompatibilities #9

Closed
swissspidy opened this issue Jun 16, 2015 · 27 comments
Closed

Multisite incompatibilities #9

swissspidy opened this issue Jun 16, 2015 · 27 comments
Milestone

Comments

@swissspidy
Copy link
Contributor

I just tried activating the plugin network-wide. Even after I had visited each site's dashboard, no database tables were created.

Not sure if it's my fault or there's something wrong in the plugin, but it may be worth exploring. Other users reported multisite incompatibilities as well:

https://wordpress.org/support/topic/links-missing-subfolder-on-multisite?replies=9#post-7074398

@Zodiac1978
Copy link
Member

I can confirm the problem. "Na data available" showing for days after being network-activated. After activating per site it shows data.

@glueckpress
Copy link
Contributor

Confirmed from memory. We should add this piece of info to the readme, preferably in FAQ.

@swissspidy
Copy link
Contributor Author

Even better: We fix it :)

@te-online
Copy link

I know it is not long ago, but: Did you fix it already? ;-)

https://github.com/pluginkollektiv/statify/blob/master/inc/statify_install.class.php#L27
That looks like it should work, doesn't it? But in my multisite-environment there are no statify tables created either.

@te-online
Copy link

Okay, I tried a fix, but don't ask me what it's about 😆

I changed the install method https://github.com/pluginkollektiv/statify/blob/master/inc/statify_install.class.php#L32

/* Neuer MU-Blog */
        if ( ! empty($id) ) {
            /* Im Netzwerk? */
            if ( is_plugin_active_for_network(STATIFY_BASE) ) {
                 /* Wechsel */
                 switch_to_blog( (int)$id );
                 /* Installieren */
                 self::_apply();
                 /* Wechsel zurück */
                 restore_current_blog();
                 /* Raus */
                 return;
            }
        }

I removed the return when the plugin is not active for network and instead wrapped it with the if statement.
Maybe the install function is called multiple times when activating network-wide, I don't know. This way the code after this snippet was executed on activation and all the tables were created.

The fix might have the side effect that the original purpose of activating the plugin for new blogs might not work now...

@sergejmueller Maybe this helps you a tiny bit with fixing it 😉

@swissspidy
Copy link
Contributor Author

@te-online Multisite plugin activation is quite difficult from normal plugin activation, with lots of edge-cases. I hope this is the solution and will check out your proposed fix.

@te-online
Copy link

@swissspidy To be honest, I think there is a high chance that this is not the correct solution. I didn't fully understand what the first part is used for and when it gets called. I didn't do debugging, just some quick guessing. I only treated the symptom, but not the source of the problem, so to say.

Chances are, that maybe $id is not empty at all but is supposed to be. Or maybe the order of the code is just wrong. Maybe this if(empty($id)) {} statement should be placed after the activation code for network-wide, so the return won't cancel the function too early.

@glueckpress glueckpress modified the milestone: v.1.4.3 Aug 6, 2015
@Berlinicker
Copy link

I had the same problem. Having installed Multisite and Statify, Statify did show "No data available". The problem existed independantly from the widget configuration. Apparently there are incompatibilities between both plugins.

I fixed it with the help of a wordpress expert. He found out that Statify did not create a data base table in phpMyAdmin because of Multisite. So we created the data base table wp_statify manually, he sent it to me via email and I imported it into phpMyAdmin. Finally, Statify started showing results.

Unfortunately, the solution did not work for my second domain which I manage with Multisite, although I added the data base table wp_statify to my second data base on my web server. Does anybody have an explanation for what reason Statify does not work for my second domain? May it be related to Domain Mapping?

Thanks in advance for some clues!

@swissspidy swissspidy self-assigned this Jan 8, 2016
@swissspidy
Copy link
Contributor Author

@Berlinicker Thanks for chiming in. This ticket is all about multisite incompatibilities and the missing database tables. I hope to find some time this spring to work on it.

Out of the blue I can't say anything about your second website. Have you added only 1 table or 1 for every blog? (Not sure what Statify requires at the moment). Domain mapping could be a culprit here, but I'd need to test it.

@te-online
Copy link

@Berlinicker Are you sure, you've got the prefixes right? Maybe you have set up a different prefix for this installation than wp_?

@Berlinicker
Copy link

@swissspidy and @te-online Thanks for the quick responses. It is great that you are going to fix the problem.

In fact, I have added only one table to the main data base which corresponds to my wp-config.php. My second data base seems to be for something else than my second domain, so adding the table to the second data base did not change anything. Should I add another table to the main data base which corresponds to my wp-config.php? Which prefix do I have to use in that case?
(@te-online: The prefix is always "wp_".)

Thanks in advance!

@te-online
Copy link

@Berlinicker As far as I know, with multisite, you should have a db structure like this:

prefix _ empty for first or blognumber _ table name
e.g.
wp_postmeta
wp_posts
wp_2_postmeta
wp_2_posts
...

To be clear, all the tables are in one database with multisite per default. WordPress can only access databases, that are specified in wp-config.php.

Considering this, you would need a statify table for each of your multisite sites.

  • wp_statify
  • wp_2_statify

@Berlinicker
Copy link

@te-online That's it! Now it works. Thanks a lot for your help! Thanks to WordPress expert Finn Dohrn from bit01, too! http://www.bit01.de/. That was a remarkable service!

@herpaderpaldent
Copy link

Is there an ETA on a Plugin Version that handels this issue?

Or a HowTo Article how to achive statify working on Multisite?

@swissspidy
Copy link
Contributor Author

@huberfe Thanks for asking.

As I said in January, I was hoping to have some time this spring to fix this issue. Spring is now, so give me a few weeks to look into this, i.e. until end of May. If anyone's able to help earlier, feel free to jump in and submit a PR.

@herpaderpaldent
Copy link

merci dir

@Zodiac1978
Copy link
Member

@swissspidy Any news on this?

@swissspidy
Copy link
Contributor Author

@Zodiac1978 Sorry, no update means no progress. But since you asked, I finally took an hour to look at it. #23 should fix this.

Perhaps need to adjust version numbers in the inline docs though :)

As I'm normally not using Statify, someone else needs to test and merge this.

Thanks.

@swissspidy swissspidy removed their assignment Jul 11, 2016
@te-online
Copy link

Just tested on a multisite installation and it worked! Thank you for fixing it.

@swissspidy
Copy link
Contributor Author

I think #23 only fixes parts of the multisite issues. The one with the permalinks mentioned in the issue description is still unfixed IIRC.

@te-online
Copy link

te-online commented Jul 13, 2016

That should be a quick fix, since it's only the output rendering, right? Maybe I can look into that later.

Edit: Actually, that seems to be fixed. On my test installation it works as expected. (You're talking about that one, are you? https://wordpress.org/support/topic/links-missing-subfolder-on-multisite?replies=9#post-7074398)

@swissspidy
Copy link
Contributor Author

Yes, I'm talking about that one.

Apparently I already fixed it last year, see c720623 😄

Therefore closing this issue.

@Zodiac1978
Copy link
Member

Just for completeness:
This c720623 also fixes the same issue with subfolder installs.

And you can workaround the activation issue if you activate the plugin on each site separately.

@swissspidy
Copy link
Contributor Author

swissspidy commented Jul 15, 2016

@Zodiac1978 No need for that workaround anymore as this bug should be fixed after merging #23.

Edit: Or am I missing something?

@Zodiac1978
Copy link
Member

@Zodiac1978 No need for that workaround anymore as this bug should be fixed after merging #23.

That's why I wrote "just for completeness" - I just wanted to mention this workaround here. In case someone is stuck on an old version and might want to know it. ;)

@ouun
Copy link

ouun commented Dec 4, 2018

As I'm activating the plugin on a MultiSite with > 1500 sites the tables are not created. Until now I was not able to figure out why not and as soon as I activate it for a single site in the network, the wp_X_statify table is perfectly added to the DB.

@te-online
Copy link

@ouun Did you check you server logs, whether you might be running into a timeout with switching to 1500 blogs and running a single CREATE TABLE query? If you output $sites in https://github.com/pluginkollektiv/statify/blob/master/inc/class-statify-install.php#L32, does it give you an array of all your 1500 sites? Also, try logging here https://github.com/pluginkollektiv/statify/blob/master/inc/class-statify-install.php#L39, does it log 1500 entries – for each site one?

Looking forward to your report 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants