wp-config remove old dbase info | Feature Request | Forum Archive

The free forums are no longer in use. It remains available as read-only archive.

Avatar
Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_TopicIcon
wp-config remove old dbase info
November 16, 2010
5:55 am
Avatar
davidjp
Member
Members
Forum Posts: 6
Member Since:
September 30, 2010
sp_UserOfflineSmall Offline

Hi,

 

Is it possible to have xcloner not keep the old database info (name, user, pw) when installing a clone?

Also, how about having it generate a new "AUTH_KEY" etc..

This will save me having to manually edit the wp-config file whenever i install a clone.

 

Thanks,

 

David

November 16, 2010
8:33 am
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

Hi David! When doing a restore, XCloner updates the new config file with the new mysql details, and comments the others, if it does not do this however, there might be a restore issue, did you receive the success message on the configuration update?

 

As for AUTH_KEY, we will need to look into that to see if changing it will affect the site functionality.

 

Regards, Ovidiu

November 16, 2010
10:50 am
Avatar
davidjp
Member
Members
Forum Posts: 6
Member Since:
September 30, 2010
sp_UserOfflineSmall Offline

Yep, restore was successfull, but now i need to go in and remove the commenting out of the old database info.

I think i can hack the xcloner.php file not to include the old info, but think this should be a checkbox option.

 

David

November 16, 2010
11:16 am
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

XCloner tries to keep the files as intact as possible during a restore, it only updates the necessary config options, rewriting the wp-config file would require indeed more coding which might lead to more points of error, we will consider however the checkbox option

 

Regards, Ovidiu

November 16, 2010
1:21 pm
Avatar
davidjp
Member
Members
Forum Posts: 6
Member Since:
September 30, 2010
sp_UserOfflineSmall Offline

$config_data = preg_replace("define('DB_HOST.*", "define('DB_HOST', '".$_REQUEST[mysql_server]."');#", $config_data);

 

is giving me an error- little help?

David

November 16, 2010
1:41 pm
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

Try this code

 

$config_data = preg_replace("/define\('DB_HOST(.*)/i", "define('DB_HOST', '".$_REQUEST[mysql_server]."');#", $config_data);

 

let me know if it works

 

Ovidiu

November 16, 2010
2:00 pm
Avatar
davidjp
Member
Members
Forum Posts: 6
Member Since:
September 30, 2010
sp_UserOfflineSmall Offline

$config_data = preg_replace("/define\('DB_HOST(.*)/i", "define('DB_HOST', '".$_REQUEST[mysql_server]."');#", $config_data);
$config_data = preg_replace("/define\('DB_USER(.*)/i", "define('DB_USER', '".$_REQUEST[mysql_username]."');#", $config_data);
$config_data = preg_replace("/define('DB_PASSWORD(.*)/i", "define('DB_PASSWORD', '".$_REQUEST[mysql_pass]."');#", $config_data);
$config_data = preg_replace("/define('DB_NAME(.*)/i", "define('DB_NAME', '".$_REQUEST[mysql_db]."');#", $config_data);

 

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 23

November 16, 2010
2:36 pm
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

Check your last 2 lines, the define( should be replace with define\(

 

Ovidiu

November 16, 2010
3:05 pm
Avatar
davidjp
Member
Members
Forum Posts: 6
Member Since:
September 30, 2010
sp_UserOfflineSmall Offline

Awesome- worked perfectly:

 

$config_data = preg_replace("/define\('AUTH_KEY(.*)/i", "define('AUTH_KEY', '".$randomkey."authkey');#", $config_data);
$config_data = preg_replace("/define\('SECURE_AUTH_KEY(.*)/i", "define('SECURE_AUTH_KEY', '".$randomkey."secureauthkey');#", $config_data);
$config_data = preg_replace("/define\('LOGGED_IN_KEY(.*)/i", "define('LOGGED_IN_KEY', '".$randomkey."loggedinkey');#", $config_data);
$config_data = preg_replace("/define\('NONCE_KEY(.*)/i", "define('NONCE_KEY', '".$randomkey."noncekey');#", $config_data);
$config_data = preg_replace("/define\('AUTH_SALT(.*)/i", "define('AUTH_SALT', '".$randomkey."authsalt');#", $config_data);
$config_data = preg_replace("/define\('SECURE_AUTH_SALT(.*)/i", "define('SECURE_AUTH_SALT', '".$randomkey."securesalt');#", $config_data);
$config_data = preg_replace("/define\('LOGGED_IN_SALT(.*)/i", "define('LOGGED_IN_SALT', '".$randomkey."loggedsalt');#", $config_data);
$config_data = preg_replace("/define\('NONCE_SALT(.*)/i", "define('NONCE_SALT', '".$randomkey."noncesalt');#", $config_data);

 

Thanks,

 

David

November 16, 2010
3:15 pm
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

Thank you for sharing, i will look into getting this code added in the restore script for the main package

 

Regards, Ovidiu

Forum Timezone: America/Chicago
Most Users Ever Online: 867
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
mlguru: 30
Django29: 29
D: 21
Andy: 21
Marcus: 20
Jamie F: 19
Member Stats:
Guest Posters: 737
Members: 9453
Moderators: 2
Admins: 3
Forum Stats:
Groups: 3
Forums: 7
Topics: 2397
Posts: 8236
Newest Members:
Vladimir Smitka
Moderators: TriP: 0, Steve Burge: 0
Administrators: Ovidiu Liuta: 2484, Victor Drover: 1, Valentin Barbu: 0