PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/princesspicnicevents.com/wp-content/plugins/wp-automatic/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/princesspicnicevents.com/wp-content/plugins/wp-automatic/test.php

<?php
 
 
if( ! function_exists('get_option') ) exit;

global $wpdb;

//current table version
$wp_automatic_version = get_option('wp_automatic_version' , 199 );

echo '<br>Current table version:'.$wp_automatic_version. ' the latest is 202';

//table version 201
if($wp_automatic_version < 201 ){
	
	//remove all status != 0 from camp_general as status is no more used
	$querys = "DELETE FROM `{$prefix}automatic_general` WHERE `item_status` = 1;
ALTER TABLE `{$prefix}automatic_general` CHANGE `item_type` `item_type` VARCHAR(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `{$prefix}automatic_general` ADD INDEX(`item_type`);
DELETE FROM `{$prefix}automatic_amazon_links` WHERE `link_status` = 1;
ALTER TABLE `{$prefix}automatic_amazon_links` ADD INDEX(`link_keyword`);
DELETE FROM `{$prefix}automatic_articles_links` WHERE `status` = 1;
ALTER TABLE `{$prefix}automatic_articles_links` ADD INDEX(`keyword`);
DELETE FROM `{$prefix}automatic_clickbank_links` WHERE `link_status` = 1;
ALTER TABLE `{$prefix}automatic_clickbank_links` ADD INDEX(`link_keyword`);
DELETE FROM `{$prefix}automatic_youtube_links` WHERE `link_status` = 1;
ALTER TABLE `{$prefix}automatic_youtube_links` ADD INDEX(`link_keyword`);" ;
	
	//executing quiries
	$que=explode(';',$querys);
	
	foreach($que  as $query){
		if(trim($query)!=''){
			$resval = $wpdb->query($query);
		}
	}
	
	update_option('wp_automatic_version' , 201 ); //table version 200
	echo '<br>Update 1 of 2 implemented successfully';
	
}//version 201

//table version 202 change original_title tag to md5 of original link for duplication check
if($wp_automatic_version < 202 ){
	
	$last_meta = get_option( 'wp_automatic_last_meta' , '0' );
	
	$query="SELECT * FROM {$prefix}postmeta where meta_key= 'original_link' and meta_id > $last_meta order by meta_id ASC limit 1000";
	$rows=$wpdb->get_results($query);
	
	
	if(count($rows) == 0){
		echo '<br>Congratulation! Tables were updated successfully';
		update_option('wp_automatic_version' , 202 ); //table version 202
	}
	
	 
	foreach ($rows as $meta_row){
		 
		$md5 = md5($meta_row->meta_value);
		$update_query = "update {$prefix}postmeta set meta_key = '$md5' where meta_key = 'original_title' and post_id={$meta_row->post_id} ";
		$r = $wpdb->query($update_query);
		
	}
	
	$last_meta = $meta_row->meta_id;
	update_option('wp_automatic_last_meta' , $last_meta);
	echo '<br>Updated 1000 record Last meta ID is :'.$last_meta.' updating another batch....';
	
	echo '<script type="text/javascript"> window.location.reload(); </script>';
	

}else{
	echo '<br>Your database tables are already up to date!';
}