Plugin: Cleanup Database

Plugin: Cleanup Database

Essential WordPress Tips To Help Optimise And Cleanup Database

WordPress › WP Clean Up Optimizer - Optimize WordPress

Database Cleaning as Optimization Strategy

cleanup

Ono što podrazumevamo pod “cleanup” je to remove post revisions, remove unused database options, remove expired, transient options, optimize tables, etc.

WP-Sweep

My plugin as cleanup champion is WP-Sweep, from a recognized plugin developer. I really do like this plugin as it is simple and efficient, exactly what is needed. For more info, read a very good review here

WP-Optimize is quite similar to a WP-Sweep, but I do like more the WP-Sweep as it shows the details about what it will clean. This one also supports scheduled cleanups.

Cleaning Transients

In WordPress, transients are a way to temporarily store and retrieve cached data, such as database query results or API responses. Transients have an expiration time, so after a certain period of time, they will automatically be deleted and the data will be fetched again the next time it’s needed.

Unfortunately, arhitektura transients in WP je takva da se expired entries brišu samo kad attempt to access that exact transient again. Očigledno je da “transient garbage collection” baš nije sjajan i to je razlog zašto expired transients ostaju večno u bazi i zagađuju je i zašto se javlja potreba za pluginovima koji će “protrčati” sve transiente i obrisati one kojima je rok trajanja istekao.

Logično je da je istekle transiente je savršeno bezbedno da budu obrisani. Ali, nije tragedija ni da se svi transienti obrišu bilo kad, jer na kraju krajeva, to je samo vrsta cache-a pa je to bezbedno uvek a osim toga, ako ih sve obrišem biću siguran da neki autor nije “omanuo” i zadao da transient ima unlimited expiry.

Inače, kada koristiš neki object cache (redisi ili memcached), WordPress neće držati transient records in the options table nego u Redis/Memcached serveru.

Transients Manager je skroz besplatan i kao što ime kaže, možeš da edituješ svaki tarnsient, ako baš insistiraš da koristiš odvojeni plugin za ovo.

Delete Expired Transients je što se mene tiče, sasvim dovoljno detaljan

WP CleanFix requires the “wpXtreme” framework to run properly and this is enough reason not to use it anymore anywhere.

The Transient Cleaner plugin appeared to be unmaintained, but has recently been updated. Its repository is located at dartiss/transient-cleaner, so it may not be something to discard just yet.

Tu je naravno WP CLI možda najbolji, na primer:

wp revisions clean 0
wp transient delete --all

Može i najjednostavniji one-link plugin za clean revisons na repo Mamaduka/easy-delete-revisions: Delete all post revisions with a single click.

Plugin - Optimize wp_options

Really advanced idea how to remove unneeded options is explained here.

  • Tweak Option
    Perfect! This one has it all. Simple and efficient. You can edit as well as delete options and there is search functionality. Autoloading is indicated, also. Ma ne radi pravilno kada se edituje bilo kakav serialized option.

  • Option Inspector
    Also very good. Has it everything + very nice visualization of serialized data. Autoload flag is not displayed in main table, and overall - design is a bit rough. Close second, ali je defunct od 2022 godine

Above two are good enough.

In the end, I concluded that the only way, the best way, and even simplest way is to edit directly in the database.

  • Part of WordPress Core is the /wp-admin/options.php page, but it is unable to edit or display serialized data. There are a lot of plugins that create a link to that page in dashboard.

  • WP Options Editor All the options editing (click on value) and removing. Međutim, escape-uje serialized data pa je neupotrebljiv.

  • Options Pixie No way to edit or delete options - there is paid version for that. But other than that, it’s written as it should be.

  • Clean Options is the oldest and not maintained anymore.

  • Options View od mog omiljenog Japanskog autora minimaliste

I ovde je lepo objašnjeno upotrebom WP CLI: Using WP-CLI doctor Command to Fix Large wp_options autoload Data •


Manual Cleanup

Plugin bi po pravilu trebao da ima načina da očisti sve što je on upisivao u bazu, a naročito ako je pravio nove tabele. Međutim, mnogi pluginovi to ne rade. Osim toga, te zaostale tabele se mogu pojaviti i ako plugin nije regularno deinstaliran, već je samo obrisan kroz FTP.

Nravno, moguće je ručno ukloniti tabele koje remove plugin residues in database, ali treba znati koje su tabele od kog plugina.

Ovde ću navest spisak tabela koje sam ja otkrio a ne znam da li su ovi pluginovi na nekom javnom spisku:

# WP Wizard Cloak (pmlc_*)
DROP TABLE wp_gdsr_*;

# GD Star Rating (gdsr_*)
DROP TABLE wp_gdsr_*;

WordPress Reset

Ustvari, ovo je odlična ideja. Ovi pluginovi allows you to reset the database - all tables or the only ones that you choose, back to its default values. Ustvari, ovo je običan truncate za već poznate tabele. Samo najbolji pluginovi omogućavaju i resetovanje datoteka na disku, ali mislim da to ne znači mnogo.

WP Reset

WP Reset is an exceptional plugin for development and debugging, although it requires payment. Its basic operation, resetting, can be performed in every possible way and it is perfectly granulated into different parts of data on disk or tables in the database. Operations are grouped into the “Nuclear” site reset, where only you as the user and the blog name remain and everything else is removed. Then there is the “Site Reset” (Regular), which completely wipes the entire database but does not touch the files on disk. The least invasive option is the “Options” reset, which only resets a small part of the database and nothing more, leaving posts-pages and comments as well as everything on disk untouched, and only cleans the site and plugin options.

I am particularly impressed with the “Collections” feature which can be activated automatically after each reset. “Snapshots” are copies of all tables in the database and are primarily a development tool. The plugin supports various Cloud providers such as Dropbox, Google Drive and pCloud where you can store plugin collections or snapshots. Actually, only a subset of plugins is stored in the cloud - only custom or paid plugins, and these are stored in the cloud as zip archives along with their licences.

I must once again emphasise how well implemented the “plugin collections” are, as you can apply sets of plugins from the cloud in bulk, automatically activated. There is also a “Tools” section where almost every part of WordPress can be wiped individually.

The licence I own is valid forever, obtained from AppSumo. It is assumed that all operations in the plugin can be initiated from WP-CLI.

WP Reset je “Lite” besplatna verzija plaćenog plugina. Osnovni uvod je u ovom videu on how To Recover WordPress Website & More

Besplatan WordPress Reset

WordPress Reset poštuje table prefix odnosno radi u multisite environment i bavi se samo resetovanjem database back to its defaults, a pritom ne modify any files, a autor je onaj dobar Grčki koder. Samo admin koji ima “level 10” permission will be recreated with same password and email. Has the ability to reactivate itself and any other plugins after the reset. To do that, edit wp-config.php and insert something like the follwoing.

define( 'REACTIVATE_WP_RESET', true );
$reactivate_wp_reset_additional = [ 'hello.php', 'akismet/akismet.php' ];

Other Reset Plugins

You can use WordPress Database Reset to reset either the entire database or specific database tables. However, I am unsure if it supports Multisite or only isolated wp-db-prefix. This plugin is developed by the same company that created the premium WP Reset plugin.

Advanced WordPress Reset appears to be a very advanced and free plugin, although I believe it will eventually be monetized. The current issue is that it does not currently support multisite installations, so I am uncertain if it will work for me.


What plugin uses what table?

Fascinating list of database tables:

from plugin WP-Optimize wpo-plugins-tables-list.json I think it’s this: https://www.sbtrade.rs/app/plugins/wp-optimize/plugin.json jeste - nalazi se u plugin root folderu kao plugin.json. Ali se nađe i u /wp-content/uploads/wpo-plugins-tables-list.json , na primer kod CNC

List of tables that various plugins are creating. Security Issue | WordPress.org


Plugins Garbage Collector (Database Cleanup) je baš odličan, i radi po onom spisku iz fajla. Znači, savršen! Iz koda možeš videti da oni drže JSON fajl na https://storage.yandexcloud.net/database-cleanup/db-tables.json


Baš super plugin: SpectrOM DB Cleanup Ali mrtav od 2015: spectrom/spectrom-db-cleanup: Database cleanup, optimization and reporting tool for WordPress


date 25. Nov 2016 | modified 30. Sep 2024
filename: Plugins » Database & SQL » Cleanup DB