Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Bug Report
Describe the current, buggy behavior
The time that the
wp site emptycommand takes to run increases approximately linearly to the number of posts, comments, terms, and taxonomies on the site, because of all the querying and cache clearance that happens. This means it scales very poorly.In addition, the query to fetch comments for deletion is unbounded, which means memory exhaustion could be experience on a site with a very large number of comments.
Describe how other contributors can replicate this bug
time wp site empty --yesand then go and put the kettle on.Describe what you would expect as the correct outcome
The time that
wp site emptytakes to run shouldn't be dictated by the number of objects in the database.Provide a possible solution
Ideally the cache clearance would happen on a per-group basis to avoid the need to delete every cache entry for every object, but I understand that this is typically not possible.
It may be possible to simply call
wp_cache_flush()after truncating all the tables to flush the entire cache, although this will have side effects on a Multisite installation.