Hi all. I have created a multisite from a single site. This is from my settings.php:
$db_prefix = array( 'default' => '', 'comments' => 'myprefix_shared.', 'content_field_email' => 'myprefix_shared.', 'content_field_fax' => 'myprefix_shared.', 'content_field_phone' => 'myprefix_shared.', 'content_group' => 'myprefix_shared.', 'content_group_fields' => 'myprefix_shared.', 'content_node_field' => 'myprefix_shared.', 'content_node_field_instance' => 'myprefix_shared.', 'content_type_pastaio' => 'myprefix_shared.', 'files' => 'myprefix_shared.', 'i18n_blocks' => 'myprefix_shared.', 'i18n_strings' => 'myprefix_shared.', 'i18n_variable' => 'myprefix_shared.', 'languages' => 'myprefix_shared.', 'locales_source' => 'myprefix_shared.', 'locales_target' => 'myprefix_shared.', 'node' => 'myprefix_shared.', 'node_access' => 'myprefix_shared.', 'node_comment_statistics' => 'myprefix_shared.', 'node_counter' => 'myprefix_shared.', 'node_revisions' => 'myprefix_shared.', 'node_type' => 'myprefix_shared.', 'myprefix_agents' => 'myprefix_shared.', 'myprefix_competitors' => 'myprefix_shared.', 'myprefix_machines' => 'myprefix_shared.', 'myprefix_machines_taxonomy' => 'myprefix_shared.', 'myprefix_node' => 'myprefix_shared.', 'myprefix_pasta' => 'myprefix_shared.', 'myprefix_pasta_taxonomy' => 'myprefix_shared.', 'myprefix_support' => 'myprefix_shared.', 'term_data' => 'myprefix_shared.', 'term_hierarchy' => 'myprefix_shared.', 'term_node' => 'myprefix_shared.', 'term_relation' => 'myprefix_shared.', 'term_synonym' => 'myprefix_shared.', 'url_alias' => 'myprefix_shared.', 'views_display' => 'myprefix_shared.', 'views_object_cache' => 'myprefix_shared.', 'views_view' => 'myprefix_shared.', 'vocabulary' => 'myprefix_shared.', 'vocabulary_node_types' => 'myprefix_shared.' );
In my content type I have a content type builded using CCK. And my problem is that I can not see anything of these type of nodes. Nothing in view and nothing in edit mode. But I have a view based on this content type and it works: i can see the cck fields.
Any help is welcome.
M.
On Fri, 26 Jun 2009 16:53:59 +0200 Michel Morelli michel@ziobuddalabs.it wrote:
Hi all. I have created a multisite from a single site. This is from my settings.php:
$db_prefix = array( 'default' => '', 'comments' => 'myprefix_shared.', 'content_field_email' => 'myprefix_shared.', 'content_field_fax' => 'myprefix_shared.', 'content_field_phone' => 'myprefix_shared.', 'content_group' => 'myprefix_shared.', 'content_group_fields' => 'myprefix_shared.', 'content_node_field' => 'myprefix_shared.', 'content_node_field_instance' => 'myprefix_shared.',
'content_type_pastaio' => 'myprefix_shared.',
^^ Could it be a typo? yep I noticed that there is a _pasta table as well ;)
As a general idea... get the list of all the tables from your db and then work with a bit of sed (or use regep support from yur db) to create the db_prefix array. If you're converting from a single side setup do the same to rename tables. I'm a bit out of exercise with mysql... so I couldn't think of anything else that should be renamed other than tables.
Can you get the list of available content types? I really didn't get the exact problem you're experiencing.
Ivan Sergio Borgonovo ha scritto:
On Fri, 26 Jun 2009 16:53:59 +0200 Michel Morelli michel@ziobuddalabs.it wrote:
Hi all. I have created a multisite from a single site. This is from my settings.php:
$db_prefix = array( 'default' => '', 'comments' => 'myprefix_shared.', 'content_field_email' => 'myprefix_shared.', 'content_field_fax' => 'myprefix_shared.', 'content_field_phone' => 'myprefix_shared.', 'content_group' => 'myprefix_shared.', 'content_group_fields' => 'myprefix_shared.', 'content_node_field' => 'myprefix_shared.', 'content_node_field_instance' => 'myprefix_shared.',
'content_type_pastaio' => 'myprefix_shared.',
^^Could it be a typo? yep I noticed that there is a _pasta table as well ;)
Yes, There is pasta and pastaio. Pastaio is a content type and pasta is one of my table. Where is the problem ?
As a general idea... get the list of all the tables from your db and then work with a bit of sed (or use regep support from yur db) to create the db_prefix array.
I have selected it with phpmyadmin, exported via phpmyadmin, create the new db, imported into new db. All works. Multilanguage works. Other type of content type works, but they haven't cck items. The only problem is with the content type that have cck items.
Can you get the list of available content types?
Only 3: page, story and pastaio.
I really didn't get the exact problem you're experience.
Simple: I can not understad why all pages of my "pastaio" content type (fields created via cck) are empty. If I try to edit the node I see a blank form but the data are present in the DB. I have create a "view" that display me the data of every "pastaio" node and it works.
M.
On Fri, 26 Jun 2009 17:29:10 +0200 Michel Morelli michel@ziobuddalabs.it wrote:
Simple: I can not understad why all pages of my "pastaio" content type (fields created via cck) are empty. If I try to edit the node I see a blank form but the data are present in the DB. I have create a "view" that display me the data of every "pastaio" node and it works.
Could it be that cck saves the names of the tables for a content type inside a field in a table?
You'll have to do something like
update [someccktable|somecontentypetable] set field=replace(...field
Ivan Sergio Borgonovo ha scritto:
Could it be that cck saves the names of the tables for a content type inside a field in a table?
You'll have to do something like
update [someccktable|somecontentypetable] set field=replace(...field
No no no no ... the solution (or the problem) is that cck module create table's schema from table stored in the database and DRUPAL use this function to check if a table exists:
SHOW TABLES LIKE 'XXXX'
but this function works only for tables that are defined into the database in use. In my case I have a shared database, so if you want to share cck-content type via a shared db you can't. You can share node, but not cck-node. grrrrrr... 4 hours lost...
M.
On Mon, 29 Jun 2009 15:38:01 +0200 Michel Morelli michel@ziobuddalabs.it wrote:
Ivan Sergio Borgonovo ha scritto:
Could it be that cck saves the names of the tables for a content type inside a field in a table?
You'll have to do something like
update [someccktable|somecontentypetable] set field=replace(...field
No no no no ... the solution (or the problem) is that cck module create table's schema from table stored in the database and DRUPAL use this function to check if a table exists:
SHOW TABLES LIKE 'XXXX'
but this function works only for tables that are defined into the database in use. In my case I have a shared database, so if you want to share cck-content type via a shared db you can't. You can share node, but not cck-node. grrrrrr... 4 hours lost...
mmm well there are several problems about db_table_exists.
1) db_escape_table don't accept '.' in table names (at least in D5) 2) SHOW TABLES should be changed with something more DB agnostic using information_schema that should be supported by MySQL 5.X as well (I think this has been fixed)
I'm really not aware how MySQL mix and match schema and db connections. So it may not be too easy to patch core for your needs. If I were in pg land a quick hack could be
function db_table_exists($table) { $tn=split('.', $table); if(count($tn)==1) { $tn[1]=$tn[0]; $tn[0]='public'; /* could be worth to skip it and rely on search path */ }; return db_num_rows(db_query(" select table_name from information_schema.tables where table_name='".db_escape_table($tn[1]). "' and table_schema='".db_escape_table($tn[0])."')); } // not tested
Anyway it is worth a try to see if replacing db_table_exists with something more similar to the pg version may work.
You may hack mysql version so that it switch connection according to the "prefix". A bit of pain...
I think there were some improvement about db_table_exists (and schema support??) in D7.
Good to know that CCK don't work "very well" if not at all in a shared DB environment.
Isn't CCK getting into core as Fields?
grepping in D5 code there is not much use of db_table_exists still there are a bunch of places where db_escape_table don't play nice with schemas. (domain and sequences up to my memory). You may check if you may experience similar problems for mysql and maybe you could get around this.
Ivan Sergio Borgonovo ha scritto:
mmm well there are several problems about db_table_exists.
- db_escape_table don't accept '.' in table names (at least in D5)
It works in D6.
- SHOW TABLES should be changed with something more DB agnostic
using information_schema that should be supported by MySQL 5.X as well (I think this has been fixed)
fixed in Drupal 7 ?
I'm really not aware how MySQL mix and match schema and db connections. So it may not be too easy to patch core for your needs.
No tnx. I don't want to patch the core.
M.
I have solved this problem in this way:
in settings.php file create a new $db_url[] entry:
$db_url['shared'] = 'mysqli://username:password@localhost/databasename_of_shared_db_container';
Next create a module (or attach to a existent module) and in the .install file add this function:
<?php
function MYMODULE_schema() { global $db_url; global $db_prefix;
$db_old = $db_prefix;
$schema = array(); if (isset($db_url['shared'])) { db_set_active('shared'); if (function_exists('content_schema')) { $db_prefix['content_node_field'] = ''; $db_prefix['content_node_field_instance'] = ''; $schema = content_schema(); } db_set_active('default'); } //dpm($schema); $db_prefix = $db_old; return $schema; }
It works for me. For the moment at least :D
M.