I have a PHP script will be ran on a production web server only once. The script loads a whole lot of db records and then iterates over them, json_decoding a field and checking it. Some fields will be amended and saved back to the database.
The script will consume a lot of memory and will potentially run for 1hr or more.
What should I keep in mind with this type of script with regards to making sure it doesn’t cause the site to go down or any other potential hazards of such scripts.
The basic flow of the script is as follows:
1. load all records from db table
2. iterate over each row
2.1 json_decode specific field
2.2 if a matching field is found then
2.2.1 Change the value
2.2.2 Save back to the database