src/Service/Cdn.php
public function objectIncrementCount($action, $object, $bucket = null)
    {
        /** @var \CI_Db $oDb */
        $oDb = Factory::service('Database');

        switch (strtoupper($action)) {
            case 'SERVE':
                $oDb->set('o.serves', 'o.serves+1', false);
                break;

            case 'DOWNLOAD':
                $oDb->set('o.downloads', 'o.downloads+1', false);
                break;

            case 'THUMB':
            case 'CROP':
                $oDb->set('o.thumbs', 'o.thumbs+1', false);
                break;

            case 'SCALE':
                $oDb->set('o.scales', 'o.scales+1', false);
                break;
        }

        if (is_numeric($object)) {
            $oDb->where('o.id', $object);
        } else {
            $oDb->where('o.filename', $object);
        }

        if ($bucket && is_numeric($bucket)) {
            $oDb->where('o.bucket_id', $bucket);
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        } elseif ($bucket) {
            $oDb->where('b.slug', $bucket);
            $oDb->join(NAILS_DB_PREFIX . 'cdn_bucket b', 'b.id = o.bucket_id');
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        } else {
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        }
    }
public function objectIncrementCount($action, $object, $bucket = null)
    {
        /** @var \CI_Db $oDb */
        $oDb = Factory::service('Database');

        switch (strtoupper($action)) {
            case 'SERVE':
                $oDb->set('o.serves', 'o.serves+1', false);
                break;

            case 'DOWNLOAD':
                $oDb->set('o.downloads', 'o.downloads+1', false);
                break;

            case 'THUMB':
            case 'CROP':
                $oDb->set('o.thumbs', 'o.thumbs+1', false);
                break;

            case 'SCALE':
                $oDb->set('o.scales', 'o.scales+1', false);
                break;
        }

        if (is_numeric($object)) {
            $oDb->where('o.id', $object);
        } else {
            $oDb->where('o.filename', $object);
        }

        if ($bucket && is_numeric($bucket)) {
            $oDb->where('o.bucket_id', $bucket);
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        } elseif ($bucket) {
            $oDb->where('b.slug', $bucket);
            $oDb->join(NAILS_DB_PREFIX . 'cdn_bucket b', 'b.id = o.bucket_id');
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        } else {
            return $oDb->update(NAILS_DB_PREFIX . 'cdn_object o');
        }
    }
public function objectIncrementCount ( $ action , $ object , $ bucket = null ) { /** @var \CI_Db $oDb */ $ oDb = Factory :: service ( 'Database' ) ; switch ( strtoupper ( $ action ) ) { case 'SERVE' : $ oDb -> set ( 'o.serves' , 'o.serves+1' , false ) ; break ; case 'DOWNLOAD' : $ oDb -> set ( 'o.downloads' , 'o.downloads+1' , false ) ; break ; case 'THUMB' : case 'CROP' : $ oDb -> set ( 'o.thumbs' , 'o.thumbs+1' , false ) ; break ; case 'SCALE' : $ oDb -> set ( 'o.scales' , 'o.scales+1' , false ) ; break ; } if ( is_numeric ( $ object ) ) { $ oDb -> where ( 'o.id' , $ object ) ; } else { $ oDb -> where ( 'o.filename' , $ object ) ; } if ( $ bucket && is_numeric ( $ bucket ) ) { $ oDb -> where ( 'o.bucket_id' , $ bucket ) ; return $ oDb -> update ( NAILS_DB_PREFIX . 'cdn_object o' ) ; } elseif ( $ bucket ) { $ oDb -> where ( 'b.slug' , $ bucket ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'cdn_bucket b' , 'b.id = o.bucket_id' ) ; return $ oDb -> update ( NAILS_DB_PREFIX . 'cdn_object o' ) ; } else { return $ oDb -> update ( NAILS_DB_PREFIX . 'cdn_object o' ) ; } }
Increments the stats of on object

@param string $action The stat to increment
@param mixed  $object The object's ID or filename
@param mixed  $bucket The bucket's ID or slug

@return boolean
Increments the stats of on object