Is it possible to restore a PHP procedure from a backup without affecting the main database?
If yes, then in what way.
When editing a PHP procedure, I mixed up the source and destination of two procedures, as a result, I corrupted the source, which I cannot restore from memory. This happened due to the fact that the ACE-editor header does not contain the name of the module being edited, which is unfortunate.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Restore a PHP procedure from a backup
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Restore a PHP procedure from a backup
Manually extract and insert the specific row: MySQL dumps are plain text files that contain SQL statements. You can open the dump file using a text editor, locate the specific row you want to restore, and extract the relevant SQL statement(s) that insert that row into the database. You can then execute that SQL statement using a MySQL client (phpMyAdmin) to insert the row directly into the database, without affecting other rows.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Restore a PHP procedure from a backup
Open the Procedure and retrieve its Id via Options Menu -> Form Info -> Record Id
Open the dump file in a text editor and search for the Id (e.g 60f8e2ea4d13aff)
You'll find a statement that looks like this:
Replace "INSERT INTO" with "REPLACE INTO"
Run the SQL in e.g. phpMyAdmin
Open the dump file in a text editor and search for the Id (e.g 60f8e2ea4d13aff)
You'll find a statement that looks like this:
Code: Select all
INSERT INTO `zzzzsys_php` VALUES ('60f8e2ea4d13aff','NUIMPORTUSERS','Import users from a CSV file','nubuilder','$file = nuGetProperty(\'NUIMPORTUSERS_file\');\n$delimiter = nuGetProperty(\'NUIMPORTUSERS_delimiter\');\n\nnuImportUsersFromCSV(\"../temp/\".$file, $delimiter, \"\\n\");\nnuProcessImportedUsers();','window',NULL,'1','0','',NULL);
Replace "INSERT INTO" with "REPLACE INTO"
Run the SQL in e.g. phpMyAdmin