Details
-
Bug
-
Resolution: Invalid
-
Medium
-
None
-
4.0.1
-
None
Description
Hi
I have a database here where many attributes are missing for about 1000 user objects. Since there are about 100 000 user objects in total I assume that the reason for these missing attributes is that the execution timed out during class editing at some time (I am not sure of this though)
Attached is a script which scans the database for missing attributes. It goes through objects of a specified classID and compares the object attributes with what is defined in the class definition.
To scan all objects of certain class:
php fixmissingobjectattributes.php --classid=18
In order to just scan the db and report back errors detected (no changes in database is performed):
php fixmissingobjectattributes.php --classid=18 --report
Just fix one special object
php fixmissingobjectattributes.php --classid=18 --objectid=123
Sometimes it can be very time consuming (and CPU intensive) to scan all object of a certain class.
It is therefore possible to for instance copy your site (db) to a test system, run the script and log all corrupted objects to a file. You may then rerun the script on the live server and the script will only investigate the objects specified in this file. In my case it took 2 hours to scan all the objects, but only a couple of minutes to actually fix the corrupted objects.
example:
# Just scan the database and log corrupted objects
php fixmissingobjectattributes.php --classid=18 --report --export-file=curruptedobjects.txt
# rerun the script, only check objects specified in the logfile
php fixmissingobjectattributes.php --classid=18 --import-file=curruptedobjects.txt
The script will fix all the objects' versions and translations.
However, regarding translations: this has been little tested.
Note:
The script will only add missing object attributes. It will not remove any object attributes which shouldn't be there. Neither does it check that object attributes are of the correct datatype
PS:
The script was inspired by the addmissingobjectattributes.php script made by PK/KC (issue #10203)
Attachments
Issue Links
- relates to
-
EZP-10203 Changing classes with a lot of objects can result in a maximum execution time error
- Closed