HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/popup-maker/includes/functions/utils/upgrades.php
<?php
/**
 * Functions for Upgrades Utility
 *
 * @package   PopupMaker
 * @copyright Copyright (c) 2024, Code Atlantic LLC
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Adds an upgrade action to the completed upgrades array
 *
 * @since 1.7.0
 *
 * @see PUM_Utils_Upgrades::set_upgrade_complete
 *
 * @param  string $upgrade_id The action to add to the competed upgrades array
 *
 * @return bool If the function was successfully added
 */
function pum_set_upgrade_complete( $upgrade_id = '' ) {
	return PUM_Utils_Upgrades::instance()->set_upgrade_complete( $upgrade_id );
}

/**
 * Get's the array of completed upgrade actions
 *
 * @since 1.7.0
 *
 * @return array The array of completed upgrades
 */
function pum_get_completed_upgrades() {
	return PUM_Utils_Upgrades::instance()->get_completed_upgrades();
}

/**
 * Check if the upgrade routine has been run for a specific action
 *
 * @since 1.7.0
 *
 * @param  string $upgrade_id The upgrade action to check completion for
 *
 * @return bool  If the action has been added to the completed actions array
 */
function pum_has_completed_upgrade( $upgrade_id = '' ) {
	return PUM_Utils_Upgrades::instance()->has_completed_upgrade( $upgrade_id );
}

/**
 * Clean up postmeta by removing all keys from the given post_id.
 *
 * @param int   $post_id
 * @param array $keys_to_delete
 */
function pum_cleanup_post_meta_keys( $post_id = 0, $keys_to_delete = [] ) {
	/**
	 * Clean up automatically.
	 */
	if ( ! empty( $keys_to_delete ) ) {
		global $wpdb;

		$keys_to_delete = array_map( 'esc_sql', (array) $keys_to_delete );
		$meta_keys      = implode( "','", $keys_to_delete );

		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
		$wpdb->query(
			$wpdb->prepare(
				// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
				"DELETE FROM `$wpdb->postmeta` WHERE `post_id` = %d AND `meta_key` IN ('{$meta_keys}')",
				$post_id
			)
		);

		wp_cache_delete( $post_id, 'post_meta' );
	}
}