src/Service/Cdn.php
public function getObjectFromTrash($object, $bucket = '', $data = [])
    {
        $oDb = Factory::service('Database');

        if (is_numeric($object)) {

            //  Check the cache
            $cacheKey = 'object-trash-' . $object;
            $cache    = $this->getCache($cacheKey);

            if ($cache) {
                return $cache;
            }

            // --------------------------------------------------------------------------

            $oDb->where('o.id', $object);

        } else {

            //  Check the cache
            $cacheKey = 'object-trash-' . $object;
            $cacheKey .= !empty($bucket) ? '-' . $bucket : '';
            $cache    = $this->getCache($cacheKey);

            if ($cache) {
                return $cache;
            }

            // --------------------------------------------------------------------------

            $oDb->where('o.filename', $object);

            if (!empty($bucket)) {
                if (is_numeric($bucket)) {
                    $oDb->where('b.id', $bucket);
                } else {
                    $oDb->where('b.slug', $bucket);
                }
            }
        }

        $objects = $this->getObjectsFromTrash(null, null, $data);

        if (empty($objects)) {
            return false;
        }

        // --------------------------------------------------------------------------

        //  Cache the object
        $this->setCache($cacheKey, $objects[0]);

        // --------------------------------------------------------------------------

        return $objects[0];
    }
public function getObjectFromTrash($object, $bucket = '', $data = [])
    {
        $oDb = Factory::service('Database');

        if (is_numeric($object)) {

            //  Check the cache
            $cacheKey = 'object-trash-' . $object;
            $cache    = $this->getCache($cacheKey);

            if ($cache) {
                return $cache;
            }

            // --------------------------------------------------------------------------

            $oDb->where('o.id', $object);

        } else {

            //  Check the cache
            $cacheKey = 'object-trash-' . $object;
            $cacheKey .= !empty($bucket) ? '-' . $bucket : '';
            $cache    = $this->getCache($cacheKey);

            if ($cache) {
                return $cache;
            }

            // --------------------------------------------------------------------------

            $oDb->where('o.filename', $object);

            if (!empty($bucket)) {
                if (is_numeric($bucket)) {
                    $oDb->where('b.id', $bucket);
                } else {
                    $oDb->where('b.slug', $bucket);
                }
            }
        }

        $objects = $this->getObjectsFromTrash(null, null, $data);

        if (empty($objects)) {
            return false;
        }

        // --------------------------------------------------------------------------

        //  Cache the object
        $this->setCache($cacheKey, $objects[0]);

        // --------------------------------------------------------------------------

        return $objects[0];
    }
public function getObjectFromTrash ( $ object , $ bucket = '' , $ data = [ ] ) { $ oDb = Factory :: service ( 'Database' ) ; if ( is_numeric ( $ object ) ) { //  Check the cache $ cacheKey = 'object-trash-' . $ object ; $ cache = $ this -> getCache ( $ cacheKey ) ; if ( $ cache ) { return $ cache ; } // -------------------------------------------------------------------------- $ oDb -> where ( 'o.id' , $ object ) ; } else { //  Check the cache $ cacheKey = 'object-trash-' . $ object ; $ cacheKey .= ! empty ( $ bucket ) ? '-' . $ bucket : '' ; $ cache = $ this -> getCache ( $ cacheKey ) ; if ( $ cache ) { return $ cache ; } // -------------------------------------------------------------------------- $ oDb -> where ( 'o.filename' , $ object ) ; if ( ! empty ( $ bucket ) ) { if ( is_numeric ( $ bucket ) ) { $ oDb -> where ( 'b.id' , $ bucket ) ; } else { $ oDb -> where ( 'b.slug' , $ bucket ) ; } } } $ objects = $ this -> getObjectsFromTrash ( null , null , $ data ) ; if ( empty ( $ objects ) ) { return false ; } // -------------------------------------------------------------------------- //  Cache the object $ this -> setCache ( $ cacheKey , $ objects [ 0 ] ) ; // -------------------------------------------------------------------------- return $ objects [ 0 ] ; }
Returns a single object from the trash

@param mixed  $object The object's ID or filename
@param string $bucket The bucket's ID or slug
@param array  $data   Data to pass to getCountCommon()

@return mixed          stdClass on success, false on failure
Returns a single object from the trash