!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)

/uploads/script/vendor/doctrine/cache/lib/Doctrine/Common/Cache/   drwxr-xr-x
Free 13.15 GB of 57.97 GB (22.68%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

declare(strict_types=1);

namespace 
Doctrine\Common\Cache;

use 
Couchbase\Bucket;
use 
Couchbase\Document;
use 
Couchbase\Exception;
use 
RuntimeException;

use function 
phpversion;
use function 
serialize;
use function 
sprintf;
use function 
substr;
use function 
time;
use function 
unserialize;
use function 
version_compare;

/**
 * Couchbase ^2.3.0 cache provider.
 *
 * @deprecated Deprecated without replacement in doctrine/cache 1.11. This class will be dropped in 2.0
 */
final class CouchbaseBucketCache extends CacheProvider
{
    private const 
MINIMUM_VERSION '2.3.0';

    private const 
KEY_NOT_FOUND 13;

    private const 
MAX_KEY_LENGTH 250;

    private const 
THIRTY_DAYS_IN_SECONDS 2592000;

    
/** @var Bucket */
    
private $bucket;

    public function 
__construct(Bucket $bucket)
    {
        if (
version_compare(phpversion('couchbase'), self::MINIMUM_VERSION) < 0) {
            
// Manager is required to flush cache and pull stats.
            
throw new RuntimeException(sprintf('ext-couchbase:^%s is required.'self::MINIMUM_VERSION));
        }

        
$this->bucket $bucket;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doFetch($id)
    {
        
$id $this->normalizeKey($id);

        try {
            
$document $this->bucket->get($id);
        } catch (
Exception $e) {
            return 
false;
        }

        if (
$document instanceof Document && $document->value !== false) {
            return 
unserialize($document->value);
        }

        return 
false;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doContains($id)
    {
        
$id $this->normalizeKey($id);

        try {
            
$document $this->bucket->get($id);
        } catch (
Exception $e) {
            return 
false;
        }

        if (
$document instanceof Document) {
            return ! 
$document->error;
        }

        return 
false;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doSave($id$data$lifeTime 0)
    {
        
$id $this->normalizeKey($id);

        
$lifeTime $this->normalizeExpiry($lifeTime);

        try {
            
$encoded serialize($data);

            
$document $this->bucket->upsert($id$encoded, [
                
'expiry' => (int) $lifeTime,
            ]);
        } catch (
Exception $e) {
            return 
false;
        }

        if (
$document instanceof Document) {
            return ! 
$document->error;
        }

        return 
false;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doDelete($id)
    {
        
$id $this->normalizeKey($id);

        try {
            
$document $this->bucket->remove($id);
        } catch (
Exception $e) {
            return 
$e->getCode() === self::KEY_NOT_FOUND;
        }

        if (
$document instanceof Document) {
            return ! 
$document->error;
        }

        return 
false;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doFlush()
    {
        
$manager $this->bucket->manager();

        
// Flush does not return with success or failure, and must be enabled per bucket on the server.
        // Store a marker item so that we will know if it was successful.
        
$this->doSave(__METHOD__true60);

        
$manager->flush();

        if (
$this->doContains(__METHOD__)) {
            
$this->doDelete(__METHOD__);

            return 
false;
        }

        return 
true;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function doGetStats()
    {
        
$manager          $this->bucket->manager();
        
$stats            $manager->info();
        
$nodes            $stats['nodes'];
        
$node             $nodes[0];
        
$interestingStats $node['interestingStats'];

        return [
            
Cache::STATS_HITS   => $interestingStats['get_hits'],
            
Cache::STATS_MISSES => $interestingStats['cmd_get'] - $interestingStats['get_hits'],
            
Cache::STATS_UPTIME => $node['uptime'],
            
Cache::STATS_MEMORY_USAGE     => $interestingStats['mem_used'],
            
Cache::STATS_MEMORY_AVAILABLE => $node['memoryFree'],
        ];
    }

    private function 
normalizeKey(string $id): string
    
{
        
$normalized substr($id0self::MAX_KEY_LENGTH);

        if (
$normalized === false) {
            return 
$id;
        }

        return 
$normalized;
    }

    
/**
     * Expiry treated as a unix timestamp instead of an offset if expiry is greater than 30 days.
     *
     * @src https://developer.couchbase.com/documentation/server/4.1/developer-guide/expiry.html
     */
    
private function normalizeExpiry(int $expiry): int
    
{
        if (
$expiry self::THIRTY_DAYS_IN_SECONDS) {
            return 
time() + $expiry;
        }

        return 
$expiry;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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