HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/z/w/a/zwafgyp/lacalita/wp-content/plugins/rey-core/inc/libs/importer/tasks/get-data.php
<?php
namespace ReyCore\Libs\Importer\Tasks;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use ReyCore\Libs\Importer\Base;
use ReyCore\Libs\Importer\Helper;

class GetData extends TaskBase
{

	public function get_id(){
		return 'get-data';
	}

	public function get_status(){
		return esc_html__('Retrieve data ...', 'rey-core');
	}

	public function run(){

		if( ! ($path = get_transient('rey_demo_temp_path')) ){
			return $this->add_error( 'Cannot retrieve data path.' );
		}

		$content = ( Helper::fs()->exists( $path . 'data.json' ) ) ? Helper::fs()->get_contents( $path . 'data.json' ) : false;

		if ( false === $content ) {
			Helper::fs()->delete( $path, true );
			return $this->add_error( 'Import failed. No configuration file found.' );
		}

		// check for template data
		$content_data = json_decode( $content, true );

		if ( empty( $content_data ) ) {
			Helper::fs()->delete( $path, true );
			return $this->add_error( 'Import failed. Empty data.' );
		}

		set_transient('rey_demo_data', $content_data, $this->importer::TRANSIENT_EXPIRATION);

	}

}