This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Saotn Database Table Optimizer | |
* Plugin URI: https://www.saotn.org | |
* Description: Optimizes WordPress database behind the scenes by executing an OPTIMIZE TABLE statement on all MySQL tables, 'daily' or 'hourly'. Please <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4EFPSXA623NZA" title="donate to Sysadmins of the North">donate $2.50 USD</a> through PayPal to support me in my research time and hosting costs. | |
* Version: 1.0.2 | |
* Author: Jan Reilink | |
* Author URI: https://www.saotn.org | |
* License: GPLv2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP/cURL function to check a web site status. If HTTP status is not 200 or 302, or | |
* the requests takes longer than 10 seconds, the website is unreachable. | |
* | |
* Follow me on Twitter: @Jan_Reilink | |
* | |
* @param string $url URL that must be checked | |
*/ | |
function url_test($url) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Executes an OPTIMIZE TABLE statement on all WordPress database | |
* tables. | |
*/ | |
public static function saotn_wpdb_optimizer() { | |
global $wpdb; | |
$tables = $wpdb->get_col( "SHOW TABLES" ); | |
foreach ( $tables as $table ) { | |
$wpdb->query( "OPTIMIZE TABLE $table" ); | |
} |
NewerOlder