Search-replace for staging breaking sites


#1

There is a major flaw in the new staging feature, which can render a cloned staging site unusable. It seems to do a full search-n-replace for things similar to the domain name, in all of the source code.

Example:
We have a WP site, just cloned with staging feature to a separate server. Let’s say the domain name is client.se. In the functions.php file, we have functions that might be called client_setup(). All these have now gotten replaced by “wordpress-XXXXXX-XXXXXX.cloudwaysapps.comtup()”, of course breaking the site entirely and requiring manual work to enable it again.

One function also calls an external API, which has the URL api.client.se. This of course breaks entirely as well as it gets replaced with the new Cloudways temporary domain name.

This needs to be fixed asap as it is a very unreliable process as it stands, and the search-replace should of course only target the actual spots needed to alter the URL, and not go thru all content and all source code.


#2

Hi Daniel,

It’s unlikely, that the client_setup() function name was changed because it should be client.setup() to be replaced.

I believe that the code is not affected and the replacement works for database only. Do you have URL api.client.se for that API function stored in the database?

Best,
-Nadia


#3

Well, simply put, you are wrong I’m afraid. It is unlikely, it is weird, and it is wrong. Hence why I’m writing about it here. I would hardly bother otherwise.

I cloned a site as staging, it gives a 500 error, referencing a function in functions.php as the source. I review the functions.php on the newly created site, and find that all instances of “clientname_se” as well as “clientname.se” have been replaced. So “clientname_setup()” has been renamed “wordpress-XXXXXX-XXXXXX.cloudwaysapps.comtup()”, just like I initially stated.

So yes, this happened.


#4

Hm, really, it changes the files as well. In my case, it’s just URLs. Never thought I have them in the code :slight_smile:

It’s weird that “clientname_se” instances were changed as well and should be fixed, of course. Sorry for interfering, it seemed to me you were mistaken.


#5

Yeah I hear you, it sounds like such bad practice that you don’t think they could possibly have set up a script that actually alters the source code of a site being cloned, but yup… (facepalm)

Cloudways, please address this… Changing the source code of an app with an automatic script is just horribly bad. It’s bad enough that you change all instances in the db so any content that contains the domain name gets screwed up (it should of course only target the site URL rows in the db), but changing the source code is just a major flaw.


#6

Hi @daniel & @wpuxsolutions

Thanks for letting us know, we are investigating it on priority basis.


#7

For a pure Wordpress site it should only make changes to wp-config.php. There will still be absolute URLs in the database, and it could change them too, but a bit dangerous. For a custom site it shouldn’t (and couldn’t) change anything.


#8

Hi @daniel, it has been fixed. Can you please test and share your feedback?

Thanks!