HEX
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: u41188965 (3074900)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /homepages/16/d176908298/htdocs/wdev/wp-content/plugins/statify/inc/class-statify-cron.php
<?php
/**
 * Statify: Statify_Cron class
 *
 * This file contains the derived class for the plugin's cron features.
 *
 * @package   Statify
 * @since     1.4.0
 */

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;

/**
 * Statify_Cron
 *
 * @since 1.4.0
 */
class Statify_Cron extends Statify {

	/**
	 * Cleanup obsolete DB values
	 *
	 * @since    0.3.0
	 * @version  1.4.0
	 */
	public static function cleanup_data() {

		// Global.
		global $wpdb;

		// Remove items.
		$wpdb->query(
			$wpdb->prepare(
				"DELETE FROM `$wpdb->statify` WHERE created <= SUBDATE(%s, %d)",
				current_time( 'Y-m-d' ),
				(int) self::$_options['days']
			)
		);

		// Optimize DB.
		$wpdb->query(
			"OPTIMIZE TABLE `$wpdb->statify`"
		);
	}
}