Puncte:0

Add prefix on tables break my site

drapel 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
drapel ua
Ai adăugat prefixul la codul de conexiune site/default/settings.php db?
drapel ru
Da, se adaugă conexiunea db în settings.php

Postează un răspuns

Majoritatea oamenilor nu înțeleg că a pune multe întrebări deblochează învățarea și îmbunătățește legătura interpersonală. În studiile lui Alison, de exemplu, deși oamenii își puteau aminti cu exactitate câte întrebări au fost puse în conversațiile lor, ei nu au intuit legătura dintre întrebări și apreciere. În patru studii, în care participanții au fost implicați în conversații ei înșiși sau au citit transcrieri ale conversațiilor altora, oamenii au avut tendința să nu realizeze că întrebarea ar influența – sau ar fi influențat – nivelul de prietenie dintre conversatori.