| Server IP : 34.67.85.211 / Your IP : 216.73.217.52 Web Server : Apache System : Linux wordpress-1-vm 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 User : root ( 0) PHP Version : 7.4.9 Disable Function : 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, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/testimonial-free/includes/ |
Upload File : |
<?php
/**
* Fired during plugin updates
*
* @link https://shapedplugin.com/
* @since 2.1.5
*
* @package Testimonial
* @subpackage Testimonial/includes
*/
// don't call the file directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Fired during plugin updates.
*
* This class defines all code necessary to run during the plugin's updates.
*
* @since 2.1.5
* @package Testimonial
* @subpackage Testimonial/includes
* @author ShapedPlugin <support@shapedplugin.com>
*/
class Testimonial_Updates {
/**
* DB updates that need to be run
*
* @var array
*/
private static $updates = [
'2.1.5' => 'updates/update-2.1.5.php',
'2.2.5' => 'updates/update-2.2.5.php',
];
/**
* Binding all events
*
* @since 2.1.5
*
* @return void
*/
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'do_updates' ) );
}
/**
* Check if need any update
*
* @since 2.1.5
*
* @return boolean
*/
public function is_needs_update() {
$installed_version = get_option( 'testimonial_version' );
if ( false === $installed_version ) {
update_option( 'testimonial_version', SP_TFREE_VERSION );
update_option( 'testimonial_db_version', SP_TFREE_VERSION );
}
if ( version_compare( $installed_version, SP_TFREE_VERSION, '<' ) ) {
return true;
}
return false;
}
/**
* Do updates.
*
* @since 2.1.5
*
* @return void
*/
public function do_updates() {
$this->perform_updates();
}
/**
* Perform all updates
*
* @since 2.1.5
*
* @return void
*/
public function perform_updates() {
if ( ! $this->is_needs_update() ) {
return;
}
$installed_version = get_option( 'testimonial_version' );
foreach ( self::$updates as $version => $path ) {
if ( version_compare( $installed_version, $version, '<' ) ) {
include $path;
update_option( 'testimonial_version', $version );
}
}
update_option( 'testimonial_version', SP_TFREE_VERSION );
}
}
new Testimonial_Updates();