Score:0

Add prefix on tables break my site

ธง ru

I have an old site on an old shared server which used an old shared PHP 5 we can not update. I create a copy of this website which will run on a different (and dedicated) server with PHP 5.6 and present the contents in a API with the module RESTFUL (which need PHP 5.5.9 minimally to work). This copy will be used only to expose the content in the API. The old website will still be used to add contents. So we want share the same database.

Like Restful, Plug and Registry Autoload don't work before PHP 5.5.9, I faked them on the old website. There is these 3 modules but they are composed of an empty .module and a .info very simple. So no issue with the fact they are not existant or than some classes are not find (because charge with the plugin system which doesn't work on the old version of PHP 5).

I try with the two version on my local which share the same database. Technically, it works well until I empty the cache on the old website. At this moment, I loose all my endpoint on the new website. They come back when I empty the cache on the new website.

To bypass this issue, I thought to separate cache tables in the database. So each website will have their dedicated cache tables. So I cloned all cache tables and used a different prefix depending the website. But, after adding a prefix, my websites no more work and I have bugs with views and features.

My list of prefix for the website with API is:

$db_prefix = array(
  "default" => "main_",
  "cache" => "api_",
  "cache_bootstrap" => "api_",
  "cache_page" => "api_"
  ...
);

I tried to separate all the 21 cache tables. That doesn't work.

I try to only used prefix for the cache tables and let the default prefix empty. That doesn't work.

To see if tables prefix works, I tried to simply add the same and unique prefix to all tables of my database on the new website which run without connection with the old website. That doesn't work and I have the same issue for all my tests when I empty the cache or try to access to one of the website:

PHP Fatal error:  Call to undefined method stdClass::init_display() in /var/www/html/web/sites/default/modules/contrib/views/views.module on line 704

Fatal error: Call to undefined method stdClass::init_display() in /var/www/html/web/sites/default/modules/contrib/views/views.module on line 704
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                 [error]
Error: Call to undefined method stdClass::init_display() in /var/www/html/web/sites/default/modules/contrib/views/views.module, line 704

There is this ticket https://www.drupal.org/project/views/issues/371049 so I'm exploring views but I don't know if I don't forget something when I add my prefixes which create this issue or do something wrong.

No Sssweat avatar
ua flag
คุณเพิ่มคำนำหน้าในรหัสการเชื่อมต่อ db ของ sites/default/settings.php หรือไม่
ru flag
Yes, it's add in the db connection in settings.php

โพสต์คำตอบ

คนส่วนใหญ่ไม่เข้าใจว่าการถามคำถามมากมายจะปลดล็อกการเรียนรู้และปรับปรุงความสัมพันธ์ระหว่างบุคคล ตัวอย่างเช่น ในการศึกษาของ Alison แม้ว่าผู้คนจะจำได้อย่างแม่นยำว่ามีคำถามกี่ข้อที่ถูกถามในการสนทนา แต่พวกเขาไม่เข้าใจความเชื่อมโยงระหว่างคำถามและความชอบ จากการศึกษาทั้ง 4 เรื่องที่ผู้เข้าร่วมมีส่วนร่วมในการสนทนาด้วยตนเองหรืออ่านบันทึกการสนทนาของผู้อื่น ผู้คนมักไม่ตระหนักว่าการถามคำถามจะมีอิทธิพลหรือมีอิทธิพลต่อระดับมิตรภาพระหว่างผู้สนทนา