HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/sg-cachepress/core/Supercacher/Supercacher_Comments.php
<?php
namespace SiteGround_Optimizer\Supercacher;

use SiteGround_Optimizer\Helper\Update_Queue_Trait;

/**
 * SG CachePress class that handle comment updates and purge the cache.
 */
class Supercacher_Comments {
	use Update_Queue_Trait;

	/**
	 * Purge comment post cache.
	 *
	 * @since  5.0.0
	 *
	 * @param  int $comment_id The comment ID.
	 */
	public function purge_comment_post( $comment_id ) {
		// Get the comment data.
		$commentdata = get_comment( $comment_id, OBJECT );

		// Check if the value is null.
		if ( ! isset( $commentdata ) ) {
			return;
		}

		// Check if the comment moderation is turned on or if the comment is marked as spam and what the current hook is.
		if (
			'wp_insert_comment' === current_action() &&
			( 'spam' === $commentdata->comment_approved || 1 === intval( get_option( 'comment_moderation', 0 ) ) )
		) {
			return;
		}

		// Purge the rest API cache.
		$this->update_queue(
			array(
				get_rest_url(),
				get_permalink( intval( $commentdata->comment_post_ID ) ),
			)
		);
	}
}