LLMS_Abstract_Session_Database_Handler::clean( boolean $expired_only = true )

Delete all sessions from the database


Description Description

This method is the callback function for the llms_delete_expired_session_data cron event, which deletes expired sessions hourly.

This method is also used by the admin tool to remove all sessions on demand.


Top ↑

Parameters Parameters

$expired_only

(boolean) (Optional) If true, only delete expired sessions, otherwise deletes all events.

Default value: true


Top ↑

Return Return

(int)


Top ↑

Source Source

File: includes/abstracts/llms-abstract-session-database-handler.php

	public function clean( $expired_only = true ) {

		global $wpdb;

		$query = "DELETE FROM {$wpdb->prefix}lifterlms_sessions";
		if ( $expired_only ) {
			$query .= $wpdb->prepare( ' WHERE expires < %d', time() );
		}

		LLMS_Cache_Helper::invalidate_group( $this->cache_group );

		return $wpdb->query( $query ); // phpcs:ignore: WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.