HEX
Server: LiteSpeed
System: Linux atali.colombiahosting.com.co 5.14.0-570.12.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 13 06:11:55 EDT 2025 x86_64
User: coopserp (1713)
PHP: 8.2.29
Disabled: dl,exec,passthru,proc_open,proc_close,shell_exec,memory_limit,system,popen,curl_multi_exec,show_source,symlink,link,leak,listen,diskfreespace,tmpfile,ignore_user_abord,highlight_file,source,show_source,fpaththru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setid,posix_times,posix_ttyname,posix_uname,proc_get_status,proc_nice,proc_terminate
Upload Files
File: /home/coopserp/public_html/wp-content/plugins/siteground-migrator/core/Activator/Activator.php
<?php

namespace SiteGround_Migrator\Activator;

use SiteGround_Migrator\Helper\Helper;
use SiteGround_Migrator\Directory_Service\Directory_Service;
/**
 * Class managing plugin activation.
 */
class Activator {

	/**
	 * Fires on plugin activation.
	 *
	 * @since    1.0.0
	 */
	public function activate() {
		// Check the php version and deactivate the plugin is it's lower that 7.0.
		if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
			$this->siteground_migrator_compatability_warning();
			$this->siteground_migrator_deactivate_self();
		}

		if ( is_multisite() && is_network_admin() ) {
			$this->siteground_migrator_multisite_warning();
			$this->siteground_migrator_deactivate_self();
		}

		// Check the hosting envirnoment.
		self::check_hosting_environment();
		// Set the temp directory.
		self::set_temp_directory();
		// Set the encryption key.
		self::set_encryption_key();

		$directory_service = new Directory_Service();

		$directory_service->create_temp_directories();
	}

	/**
	 * Set temp directory.
	 *
	 * @since 1.0.0
	 */
	public static function set_temp_directory() {
		// Try to get the temp dir.
		$temp_dir = get_option( 'siteground_migrator_temp_directory' );

		// Set the directory is it's empty.
		if ( empty( $temp_dir ) ) {
			update_option( 'siteground_migrator_temp_directory', time() . '-' . sha1( mt_rand() ) );
		}
	}

	/**
	 * Set the encryption key for current installation.
	 *
	 * @since 1.0.0
	 */
	public static function set_encryption_key() {
		// Get the encryption key.
		$encryption_key = get_option( 'siteground_migrator_encryption_key' );

		// Generate encryption key if it's not set already.
		if ( empty( $encryption_key ) ) {
			update_option( 'siteground_migrator_encryption_key', sha1( uniqid() ) );
		}
	}

	/**
	 * Check the hosting environment.
	 *
	 * @since  1.0.25
	 */
	public static function check_hosting_environment() {
		// Update the option.
		update_option( 'siteground_migrator_is_siteground_env', Helper::is_siteground() );
	}

	/**
	 * Display notice for minimum supported php version.
	 *
	 * @since  1.0.0
	 */
	public function siteground_migrator_compatability_warning() {
		printf(
			__( '<div class="error"><p>ā€œ%1$sā€ requires PHP %2$s (or newer) to function properly. Your site is using PHP %3$s. Please upgrade. The plugin has been automatically deactivated.</p></div>', 'siteground-migrator' ),
			'SiteGround Migrator',
			'7.0',
			PHP_VERSION
		);

		// Hide "Plugin activated" message.
		if ( isset( $_GET['activate'] ) ) {
			unset( $_GET['activate'] );
		}
	}

	/**
	 * Display notice if wp is multisite.
	 *
	 * @since  1.0.1
	 */
	public function siteground_migrator_multisite_warning() {
		_e( '<div class="error"><p>This plugin does not support full Multise Network migrations.</p></div>', 'siteground-migrator' );

		// Hide "Plugin activated" message.
		if ( isset( $_GET['activate'] ) ) {
			unset( $_GET['activate'] );
		}
	}

	/**
	 * Deactivate the plugin if server php version
	 * is lower than plugin supported version.
	 *
	 * @since  1.0.0
	 */
	public function siteground_migrator_deactivate_self() {
		deactivate_plugins( plugin_basename( __FILE__ ) );
	}
}