Wordpress: difference between site_id and blog_id? - database

I'm trying to get some understanding of how Wordpress works and while inspecting the database I found that, in a multisite installation, there is a table called wp_site that seems always holding a single record with a corresponding site_id.
I cannot understand (nor find on internet) what is the use of site_id when actually multisites seem to use wp_blogs and corresponding blog_id for identifying different sites.(http://codex.wordpress.org/Database_Description)
Can someone shed some light on what should be my understanding of site_id?
Thanks
Giuseppe

site is a reference to a network of blogs. There are efforts under way to allow WordPress to support multiple networks in addition to multiple blogs, but right now that's not a stock feature (which is why the wp_site table only contains one value.
The wp_blogs table contains all of the blogs for your entire installation, with each identified by the site it's associated with.
This gives you a clean separation between networks, and (eventually) you'll be able to have different "groups" of blogs on one WordPress installation behave like distinct multisite installations.

Related

Quick Search do not retrieve "can not find" recently added records

I am working on CRM dynamics 2015, recently we became unable to find contacts that are created recently on CRM via "Quick Search", but we manage to find them with "Advanced search".
in the other hand the contacts that existed already existed are still searchable via Quick Find view
The Quick Search view is well configured.
What may be the problem?
Thank you in advance.
This issue is likely a metadata problem with the underlying tables/fields which store the name of the record. A workflow variant of this issue is described by the following article:
http://teameasi.com/blog/crm-quick-search-not-returning-records-that-exist
I have experienced this issue (specifically on the workflow table) and the fix suggested by the author if this article (renaming the workflow) does work for me. I have also experienced similar issues in the past with contact records modified directly via SQL where the fullname field was not set correctly to reflect the underlying name fields.
Obviously this renaming approach is not particularly friendly for fixing a large number of records, I have some ideas for how to fix records in bulk which I will need to prove out.
Can you provide the following feedback:
- Try re-naming one of the affected contacts to see if this approach also works for the contact case?
- What version of CRM are you on, is it on-premise or online?
- Please test out whether you receive different results within the advanced find if you search based on the fullname field vs the firstname and lastname fields

How is ElasticSearch supposed to work in CakePHP 3?

I've been trying my very best not to ask any nosy question here in stackoverflow, but it has been almost one week since I got stuck in this problem and I couldn't find any solution.
I already have my working website built with CakePHP 3.2. What the website basically does is scrape Twitter for tweets containing a given search term, check if it's already in my database, and store it if it doesn't yet exist. Twitter's JSON response has this "tweet_id" property, and I've been using that value to check for whether I should ignore or append a specific tweet to my DB. While this might be okay while my database is small, I suspect it's going to slow things down considerably when my tables grow bigger. Thus my need for ElasticSearch.
My ElasticSearch server is running on my Arch Linux install, and I've configured my app to point to the said server. Also, I have my "Type" object named the same way as my "Tweets" table (I followed the documentation until the overview part http://book.cakephp.org/3.0/en/elasticsearch.html). This craps out an "Unknown method "alias" error, and following Google searches led me to creating an alternate pagination class since that was what some found to be the cause of the error (https://github.com/lorenzo/audit-stash/issues/4), which still doesn't fix things.
I'm not sure if I got this right. I installed the ElasticSearch plugin with the assumption that all I have to do is name the Types the same name as my tables, since to me the documentation "implies" that this should be done on top of the Blog Tutorial they did to "improve query performance".
TLDR, how is this supposed to work? Is my above assumption right? Do I name the Types differently and index everything myself? I'm not sure if there's just too much automagic, or I'm just poor at these sort of things. And yes, I'm new to frameworks (but not PHP, among other languages)
Thanks in advance!

Two wordpress installs on same domain how to share database?

I have 2 wordpress installs on one domain what I want to do is have both installs update posts as I add a post to the main install, how can I do this?
I believe it may be possible to have 2 front facing domains use the same database (share posts) but you will need to make the options parts different tables since they will use different themes/plugins I presume. Take a look at this page they seem to be on the right path. https://wordpress.org/support/topic/2-sites-1-db-possible?replies=15
You are facing a few problems.
First of all, wordpress saves domain names in the database. Also, in posts itself, when you add an image for example, the domain where you are on will be used in that post.
And as what you are doing is highly unusual, third party plugin builders don't take this situation into account, so any new plugin could break your setup in unexpected ways.
Another possible problem, but maybe not really one that concerns you is duplicate content. You'll get two exactly the same articles on two domains, without a canonical url.
Basically I would advise against this. There just are too many unknowns. Maybe a better approach is to investigate how to use WP multisite in this situation, and share content between the sites (this could do the trick), or use an alternative like ManageWP

Does hbm2ddl.auto=update not honor different DB users, maybe?

We are encountering strange hibernate behavior with hbm2ddl.auto set to update.
In our test setup, we have two database users, one containing the tables for our beta application, the other one is mainly used for development. I.e. same table names with different users.
When new tables are to be created, we do so by using hbm2ddl.auto=update.
Now suddenly the strange behavior is: the update process looks for existing tables with the wrong user and creates those not found with the right user.
E.g. if the following tables exists
USER_A.TABLE_1
USER_B.TABLE_2
and we update with three tables configured: TABLE_1, TABLE_2, TABLE_3 using USER_B, we end up with
USER_A.TABLE_1
USER_B.TABLE_2
USER_B.TABLE_3
TABLE_1 is not created for USER_B. After renaming USER_A.TABLE_1 to USER_A.TABLE_0 and updating again we end up with the expected result:
USER_A.TABLE_0
USER_B.TABLE_1
USER_B.TABLE_2
USER_B.TABLE_3
Does this make any sense to anyone? Is there something like an internal hibernate cache remembering like "Hey I have already created this table on this server (and I do not care about the user)".
We have spent quite some testing to reassure this is not a configuration problem, reproduced this on different machines, different configurations, from ant or using the IDE, making sure USER_A's password cannot be found anywhere in the build directory etc. So we are 100% sure, the behavior is as described - but we are completely out of ideas what happens.
I'd be very happy to hear your ideas about this, since this problem is nagging for some time now.
Thanks a lot,
Peter
Is there something like an internal hibernate cache remembering like "Hey I have already created this table on this server (and I do not care about the user)".
No. What is probably happening is that USER_A can see the tables created under USER_B account, and vice-versa. It's not clear which database you are using, but I would try to configure Hibernate to use two different schemas, in addition to use just different users. You may also want to try to set the property "hibernate.default_schema", but I'm not sure that this only will solve your problem.

postgresql duplicate table names best practice

My company has a handful of apps that we deploy in the websites we build. Recently a very old app needed to be included along side a newer app and there was a conflict w/ a duplicate table name needed to be used by both apps.
We are now in the process of updating an old app and there will be some DB updates. I'm curious what people consider best practice (or how do you do it) to help ensure these name collisions don't happen.
I've looked at schema's but not sure if thats the right path we want to take. As the documentation prescribes, I don't want to "wire" a particular schema name into an application and if I add schema's to the user search path how would it know which table I was referring to if two schema's have the same table name. although, maybe I'm reading to much into this.
Any insights or words of wisdom would be greatly appreciated!
Postgres has namespaces which is definately the most efficient way of handling that sort of thing :)
Just create a new namespace for the old database and you're done. The way most PHP/MySQL solutions solve it (specific prefix per app) is also an option, but not one I'd recommend.
[edit]Specifically, you can call your tables like this the_namespace.tablename besides changing the search_path. For the rest, the search_path will decide your namespace if you don't add the namespace.

Resources