HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/epamokos.kaunokolegija.lt/wp-content/plugins/download-attachments/includes/update.php
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
	exit;

/**
 * Download_Attachments_Update class.
 *
 * @class Download_Attachments_Update
 */
class Download_Attachments_Update {

	/**
	 * Class constructor.
	 *
	 * @return void
	 */
	public function __construct() {
		// actions
		add_action( 'init', [ $this, 'check_update' ] );
	}

	/**
	 * Update plugin version.
	 *
	 * @return void
	 */
	public function check_update() {
		if ( ! current_user_can( 'manage_options' ) )
			return;

		// get current database version
		$current_db_version = get_option( 'download_attachments_version', '1.0.0' );

		// new version?
		if ( version_compare( $current_db_version, Download_Attachments()->defaults['version'], '<' ) ) {
			// update plugin version
			update_option( 'download_attachments_version', Download_Attachments()->defaults['version'], false );
		}
	}
}

new Download_Attachments_Update();