Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33.7
Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system
Directory :  /nas/content/live/attorneyexperi/wp-content/plugins/redirection/database/schema/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /nas/content/live/attorneyexperi/wp-content/plugins/redirection/database/schema/240.php
<?php

/**
 * There are several problems with 2.3.3 => 2.4 that this attempts to cope with:
 * - some sites have a misconfigured IP column
 * - some sites don't have any IP column
 */
class Red_Database_240 extends Red_Database_Upgrader {
	public function get_stages() {
		return [
			'convert_int_ip_to_varchar_240' => 'Convert integer IP values to support IPv6',
			'expand_log_ip_column_240' => 'Expand IP size in logs to support IPv6',
			'convert_title_to_text_240' => 'Expand size of redirect titles',
			'add_missing_index_240' => 'Add missing IP index to 404 logs',
		];
	}

	private function has_ip_index( $wpdb ) {
		$wpdb->hide_errors();
		$existing = $wpdb->get_row( "SHOW CREATE TABLE `{$wpdb->prefix}redirection_404`", ARRAY_N );
		$wpdb->show_errors();

		if ( isset( $existing[1] ) && strpos( strtolower( $existing[1] ), 'key `ip` (' ) !== false ) {
			return true;
		}

		return false;
	}

	protected function has_varchar_ip( $wpdb ) {
		$wpdb->hide_errors();
		$existing = $wpdb->get_row( "SHOW CREATE TABLE `{$wpdb->prefix}redirection_404`", ARRAY_N );
		$wpdb->show_errors();

		if ( isset( $existing[1] ) && strpos( strtolower( $existing[1] ), '`ip` varchar(45)' ) !== false ) {
			return true;
		}

		return false;
	}

	protected function has_int_ip( $wpdb ) {
		$wpdb->hide_errors();
		$existing = $wpdb->get_row( "SHOW CREATE TABLE `{$wpdb->prefix}redirection_404`", ARRAY_N );
		$wpdb->show_errors();

		if ( isset( $existing[1] ) && strpos( strtolower( $existing[1] ), '`ip` int' ) !== false ) {
			return true;
		}

		return false;
	}

	protected function convert_int_ip_to_varchar_240( $wpdb ) {
		if ( $this->has_int_ip( $wpdb ) ) {
			$this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` ADD `ipaddress` VARCHAR(45) DEFAULT NULL AFTER `ip`" );
			$this->do_query( $wpdb, "UPDATE {$wpdb->prefix}redirection_404 SET ipaddress=INET_NTOA(ip)" );
			$this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` DROP `ip`" );
			return $this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` CHANGE `ipaddress` `ip` VARCHAR(45) DEFAULT NULL" );
		}

		return true;
	}

	protected function expand_log_ip_column_240( $wpdb ) {
		return $this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_logs` CHANGE `ip` `ip` VARCHAR(45) DEFAULT NULL" );
	}

	protected function add_missing_index_240( $wpdb ) {
		if ( $this->has_ip_index( $wpdb ) ) {
			// Remove index
			$this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` DROP INDEX ip" );
		}

		// Ensure we have an IP column
		$this->convert_int_ip_to_varchar_240( $wpdb );
		if ( ! $this->has_varchar_ip( $wpdb ) ) {
			$this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` ADD `ip` VARCHAR(45) DEFAULT NULL" );
		}

		// Finally add the index
		return $this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_404` ADD INDEX `ip` (`ip`)" );
	}

	protected function convert_title_to_text_240( $wpdb ) {
		return $this->do_query( $wpdb, "ALTER TABLE `{$wpdb->prefix}redirection_items` CHANGE `title` `title` text" );
	}
}

Spamworldpro Mini