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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/laravel-crm/packages/Webkul/DataTransfer/src/Helpers/Importers/Products/   drwxrwxrwx
Free 13.2 GB of 57.97 GB (22.77%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Webkul\DataTransfer\Helpers\Importers\Products;

use 
Webkul\Product\Repositories\ProductRepository;

class 
SKUStorage
{
    
/**
     * Delimiter for SKU information.
     */
    
private const DELIMITER '|';

    
/**
     * Items contains SKU as key and product information as value.
     */
    
protected array $items = [];

    
/**
     * Columns which will be selected from database.
     */
    
protected array $selectColumns = [
        
'id',
        
'sku',
    ];

    
/**
     * Create a new helper instance.
     *
     * @return void
     */
    
public function __construct(protected ProductRepository $productRepository) {}

    
/**
     * Initialize storage.
     */
    
public function init(): void
    
{
        
$this->items = [];

        
$this->load();
    }

    
/**
     * Load the SKU.
     */
    
public function load(array $skus = []): void
    
{
        if (empty(
$skus)) {
            
$products $this->productRepository->all($this->selectColumns);
        } else {
            
$products $this->productRepository->findWhereIn('sku'$skus$this->selectColumns);
        }

        foreach (
$products as $product) {
            
$this->set($product->sku, [
                
'id'  => $product->id,
                
'sku' => $product->sku,
            ]);
        }
    }

    
/**
     * Get SKU information.
     */
    
public function set(string $sku, array $data): self
    
{
        
$this->items[$sku] = implode(self::DELIMITER, [
            
$data['id'],
            
$data['sku'],
        ]);

        return 
$this;
    }

    
/**
     * Check if SKU exists.
     */
    
public function has(string $sku): bool
    
{
        return isset(
$this->items[$sku]);
    }

    
/**
     * Get SKU information.
     */
    
public function get(string $sku): ?array
    {
        if (! 
$this->has($sku)) {
            return 
null;
        }

        
$data explode(self::DELIMITER$this->items[$sku]);

        return [
            
'id' => $data[0],
        ];
    }

    
/**
     * Is storage is empty.
     */
    
public function isEmpty(): int
    
{
        return empty(
$this->items);
    }
}

:: 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.0056 ]--