My first contribution to wordpress core


Yesterday i made my first contribution towards wordpress core ( its not merged yet ). In the past i have created an issue about the docs related to image size which is how i got this badge.





What was the fix about ?





When wordpress deletes a subsite, it drops all the tables related to the subsite. The issue is it doesnt consider there may be foreign key constraints in the external plugin tables. This leads to deleted site tables not being removed from db.





How i patched it ?





Before the fix, this is how the tables were dropped.





$wpdb->query( "DROP TABLE IF EXISTS `$table`" ); 




I change this line to





$wpdb->query( "SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `$table`; SET FOREIGN_KEY_CHECKS=1;" ); 




at the time of writing this article, the fix is not merged to wordpress core.


Share:

0 comments:

Post a Comment