403Webshell
Server IP : 193.146.211.90  /  Your IP : 10.85.6.55
Web Server : Apache
System : Linux wordpress-gti-69dcdb54f7-n4wdq 6.11.8-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 15 Nov 2024 15:35:07 +0000 x86_64
User : 1001 ( 1001)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/plugins/presto-player/inc/Database/Upgrades/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/wp-content/plugins/presto-player/inc/Database/Upgrades/VisitsUpgrade.php
<?php

namespace PrestoPlayer\Database\Upgrades;

use PrestoPlayer\Models\ReusableVideo;

class VisitsUpgrade {

	protected $table;
	protected $version = 2;
	protected $name    = 'presto_player_visits_upgrade_version';

	public function run() {
		$this->fixReusableVideoStats();
	}

	/**
	 * Fixes error where reusable video ids were stored instead of video id
	 * in visits table
	 *
	 * @return void
	 */
	public function fixReusableVideoStats() {
		global $wpdb;

		$current_version = get_option( $this->name, 0 );

		// we've already done this one
		if ( $this->version <= $current_version ) {
			return;
		}

		// get all reusable video ids
		$reusable_videos = get_posts(
			array(
				'posts_per_page' => -1,
				'post_type'      => 'pp_video_block',
			)
		);

		// bail if we have no reusable videos
		if ( empty( $reusable_videos ) ) {
			return;
		}

		// get visits with this id and update to video
		foreach ( $reusable_videos as $reusable_video ) {
			$video_block = new ReusableVideo( $reusable_video );
			$block       = $video_block->getBlock();

			if ( ! empty( $block['attrs']['id'] ) ) {
				$id = $block['attrs']['id'];
				try {
					$wpdb->update( $wpdb->prefix . 'presto_player_visits', array( 'video_id' => $id ), array( 'video_id' => (int) $reusable_video->ID ) );
				} catch ( \Exception $e ) {
				}
			}
		}

		update_option( $this->name, $this->version );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit