$57 GRAYBYTE WORDPRESS FILE MANAGER $29

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/kigalix.com/wp-content/plugins/wpforms-lite/src/Migrations/

HOME
Current File : /home/bravrvjk/kigalix.com/wp-content/plugins/wpforms-lite/src/Migrations//Upgrade182.php
<?php

// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpUnused */

namespace WPForms\Migrations;

use WPForms\Helpers\Transient;

/**
 * Class v1.8.2 upgrade.
 *
 * @since 1.8.2
 */
class Upgrade182 extends UpgradeBase {

	/**
	 * Run upgrade.
	 *
	 * @since 1.8.2
	 *
	 * @return bool|null Upgrade result:
	 *                   true  - the upgrade completed successfully,
	 *                   false - in the case of failure,
	 *                   null  - upgrade started but not yet finished (background task).
	 */
	public function run() {

		$cache_dir           = $this->get_cache_dir();
		$templates_cache_dir = $cache_dir . 'templates/';

		$this->set_cache_time( $cache_dir, 'addons.json', 'wpforms_admin_addons_cache_ttl' );
		$this->set_cache_time( $cache_dir, 'docs.json', 'wpforms_admin_builder_help_cache_ttl' );
		$this->set_cache_time( $cache_dir, 'templates.json', 'wpforms_admin_builder_templates_cache_ttl' );

		$files = glob( $templates_cache_dir . '*.json' );

		foreach ( $files as $filename ) {
			$this->set_cache_time( $templates_cache_dir, basename( $filename ), 'wpforms_admin_builder_templates_cache_ttl' );
		}

		return true;
	}

	/**
	 * Set cache time to transient.
	 *
	 * @since 1.8.2
	 *
	 * @param string $cache_dir  Cache directory.
	 * @param string $cache_file Cache filename.
	 * @param string $filter     Filter name.
	 *
	 * @return void
	 */
	private function set_cache_time( $cache_dir, $cache_file, $filter ) {

		// phpcs:ignore WPForms.Comments.PHPDocHooks.RequiredHookDocumentation, WPForms.PHP.ValidateHooks.InvalidHookName
		$cache_ttl           = (int) apply_filters( $filter, WEEK_IN_SECONDS );
		$cache_file_path     = $cache_dir . $cache_file;
		$cache_modified_time = 0;
		$transient           = $cache_file;
		$time                = time();

		if ( is_file( $cache_file_path ) && is_readable( $cache_file_path ) ) {
			clearstatcache( true, $cache_file_path );

			// On WPVIP and similar filesystems, filemtime() could return false.
			$cache_modified_time = (int) filemtime( $cache_file_path );
		}

		if ( $cache_modified_time === 0 || $cache_modified_time + $cache_ttl <= $time ) {
			// Do not set transient for non-existing or expired cache.
			return;
		}

		$expiration = $cache_modified_time + $cache_ttl - $time;

		Transient::set( $transient, $cache_modified_time, $expiration );
	}

	/**
	 * Get cache directory path.
	 * Copy of the CacheBase method.
	 *
	 * @since 1.8.2
	 */
	private function get_cache_dir() {

		static $cache_dir;

		if ( $cache_dir ) {
			/**
			 * Since wpforms_upload_dir() relies on hooks, and hooks can be added unpredictably,
			 * we need to cache the result of this method.
			 * Otherwise, it is the risk to save cache file to one dir and try to get from another.
			 */
			return $cache_dir;
		}

		$upload_dir  = wpforms_upload_dir();
		$upload_path = ! empty( $upload_dir['path'] )
			? trailingslashit( wp_normalize_path( $upload_dir['path'] ) )
			: trailingslashit( WP_CONTENT_DIR ) . 'uploads/wpforms/';

		$cache_dir = $upload_path . 'cache/';

		return $cache_dir;
	}
}


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
9 May 2025 2.02 AM
bravrvjk / bravrvjk
0755
Tasks
--
9 May 2025 2.02 AM
bravrvjk / bravrvjk
0755
Base.php
11.871 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Migrations.php
0.908 KB
7 Nov 2024 5.15 PM
bravrvjk / bravrvjk
0644
Upgrade159.php
0.69 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Upgrade1672.php
0.843 KB
30 Jun 2022 3.09 PM
bravrvjk / bravrvjk
0644
Upgrade168.php
1.238 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Upgrade175.php
2.673 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Upgrade1751.php
0.549 KB
18 Aug 2022 2.59 PM
bravrvjk / bravrvjk
0644
Upgrade177.php
1.211 KB
29 Sep 2022 3.18 PM
bravrvjk / bravrvjk
0644
Upgrade182.php
3.036 KB
7 Jun 2023 5.54 PM
bravrvjk / bravrvjk
0644
Upgrade183.php
0.751 KB
10 Aug 2023 3.19 PM
bravrvjk / bravrvjk
0644
Upgrade184.php
0.888 KB
28 Sep 2023 3.44 PM
bravrvjk / bravrvjk
0644
Upgrade186.php
0.386 KB
16 Jan 2024 5.57 PM
bravrvjk / bravrvjk
0644
Upgrade187.php
1.354 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Upgrade1_9_1.php
1.373 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Upgrade1_9_2.php
0.89 KB
7 Nov 2024 5.15 PM
bravrvjk / bravrvjk
0644
UpgradeBase.php
3.43 KB
24 Apr 2025 2.53 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF