Deletes thumbnail file

@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
507391
protected function _deleteThumbnail($oArticle)
    {
        if ($this->canDeleteThumbnail($oArticle)) {
            if (!$oArticle->isDerived()) {
                $oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
                $oPicHandler->deleteThumbnail($oArticle);
            }

            //reseting field
            $oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
        }
    }
547721
private function getImageDetails(TdbShopArticle $oArticle, $oImage, IMapperCacheTriggerRestricted $oCacheTriggerManager)
    {
        $oCacheTriggerManager->addTrigger('cms_media', $oImage->fieldCmsMediaId);

        $router = $this->getRouter();
        $quickShopLink = $router->generateWithPrefixes('shop_article_quickshop', array('identifier' => $oArticle->sqlData['cmsident']));
        $quickShopLink = $quickShopLink.'?imageid='.$oImage->id;

        $aImage = array(
            'sImageId' => $oImage->fieldCmsMediaId,
            'sImageTitle' => '',
            'sSelectImageURL' => $quickShopLink,
            'sLargeImageId' => $oImage->fieldCmsMediaId,
            'sLargeTitle' => '',
            'sLargeSelectImageURL' => $quickShopLink,
        );

        return $aImage;
    }
1208324
protected function _isArticleAssigned($oArticle)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDiscountIdQuoted = $oDb->quote($this->oxdiscount__oxid->value);

        $sQ = "select 1
                from oxobject2discount
                where oxdiscountid = {$sDiscountIdQuoted} and oxtype = 'oxarticles' ";
        $sQ .= $this->_getProductCheckQuery($oArticle);

        return $oDb->getOne($sQ) ? true : false;
    }
76512
public function clearThumbnail($defaultThumbnail = null)
    {
        $action = $this->thumbnail->js();
        if (isset($defaultThumbnail)) {
            $action->attr('src', $defaultThumbnail);
        } else {
            $action->removeAttr('src');
        }
        $this->addJSAction($action);
    }
198710
public function removeActionArticle()
    {
        $sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        //$sActionId = $this->getConfig()->getConfigParam( 'oxid' );

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $oDb->Execute(
            'delete from oxobject2action '
            . 'where oxactionid=' . $oDb->quote($sActionId)
            . ' and oxclass = "oxarticle"'
        );
    }
330211
public function getArticleDiscounts($oArticle, $oUser = null)
    {
        $aList = [];
        $aDiscList = $this->_getList($oUser)->getArray();
        foreach ($aDiscList as $oDiscount) {
            if ($oDiscount->isForArticle($oArticle)) {
                $aList[$oDiscount->getId()] = $oDiscount;
            }
        }

        return $aList;
    }
1144189
function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null )
    {
        $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
        $sys = eZSys::instance();
        $storage_dir = $sys->storageDirectory();
        if ( $version == null )
        {
            $mediaFiles = eZMedia::fetch( $contentObjectAttributeID, null );
            foreach ( $mediaFiles as $mediaFile )
            {
                $mimeType =  $mediaFile->attribute( "mime_type" );
                list( $prefix, $suffix ) = explode('/', $mimeType );
//                $orig_dir = "var/storage/original/" . $prefix;
                $orig_dir = $storage_dir . '/original/' . $prefix;
                $fileName = $mediaFile->attribute( "filename" );

                if ( $fileName == '' )
                    continue;

                $file = eZClusterFileHandler::instance( $orig_dir . "/" . $fileName );
                if ( $file->exists() )
                    $file->delete();
            }
        }
        else
        {
            $mediaFiles = eZMedia::fetchByContentObjectID( $contentObjectAttribute->attribute( 'contentobject_id' ) );
            $count = 0;
            $currentBinaryFile = eZMedia::fetch( $contentObjectAttributeID, $version );
            if ( $currentBinaryFile != null )
            {
                $mimeType =  $currentBinaryFile->attribute( "mime_type" );
                $currentFileName = $currentBinaryFile->attribute( "filename" );
                list( $prefix, $suffix ) = is_string( $mimeType ) && $mimeType ? explode( '/', $mimeType ) : array( null, null );
//              $orig_dir = "var/storage/original/" . $prefix;
                $orig_dir = $storage_dir . '/original/' . $prefix;
                foreach ( $mediaFiles as $mediaFile )
                {
                    $fileName = $mediaFile->attribute( "filename" );
                    if( $currentFileName == $fileName )
                        $count += 1;
                }
                if ( $count == 1 && $currentFileName != '' )
                {
                    $file = eZClusterFileHandler::instance( $orig_dir . "/" . $currentFileName );
                    if ( $file->exists() )
                        $file->delete();
                }
            }
        }
        eZMedia::removeByID( $contentObjectAttributeID, $version );
    }
573341
public function thumbnailAction(Thumbnail $thumbnail)
    {
        if ($thumbnail->getResource() === null && $thumbnail->getStaticResource() === null) {
            $this->thumbnailService->refreshThumbnail($thumbnail);
        }
        $this->redirectToUri($this->thumbnailService->getUriForThumbnail($thumbnail), 0, 302);
    }
817222
public function getRecommListsTitle(\OxidEsales\Eshop\Application\Model\Article $oArticle)
    {
        $oLang = Registry::getLang();
        $iLang = $oLang->getBaseLanguage();

        return $this->_prepareFeedName(sprintf($oLang->translateString('LISTMANIA_LIST_FOR', $iLang), $oArticle->oxarticles__oxtitle->value));
    }
1142580
public function delete(ThumbnailRequest $request)
    {
        $crudeName = $request->input('crudeName');
        $crude = CrudeInstance::get($crudeName);
        $id = $request->input('model_id');
        $column = $request->input('model_column');

        $model = $crude->deleteThumbnailByIdAndColumn($id, $column);

        return ['model' => $model];
    }
1374175
protected function _removeParentArticles($sHeapTable)
    {
        if (!(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blExportMainVars"))) {
            $oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sArticleTable = getViewName('oxarticles');

            // we need to remove again parent articles so that we only have the variants itself
            $sQ = "select $sHeapTable.oxid from $sHeapTable, $sArticleTable where
                          $sHeapTable.oxid = $sArticleTable.oxparentid group by $sHeapTable.oxid";

            $oRs = $oDB->select($sQ);
            $sDel = "delete from $sHeapTable where oxid in ( ";
            $blSep = false;
            if ($oRs != false && $oRs->count() > 0) {
                while (!$oRs->EOF) {
                    if ($blSep) {
                        $sDel .= ",";
                    }
                    $sDel .= $oDB->quote($oRs->fields[0]);
                    $blSep = true;
                    $oRs->fetchRow();
                }
            }
            $sDel .= " )";
            $oDB->execute($sDel);
        }
    }
632059
public function deleteAction(Article $article)
    {
        $blogViewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $article->getBlog()->getId()]);

        $this->get('victoire_blog.manager.article')->delete($article);

        $message = $this->get('translator')->trans('victoire.blog.article.delete.success', [], 'victoire');
        $this->congrat($message);

        $response = [
            'success' => true,
            'url'     => $this->generateUrl('victoire_core_page_show', [
                    'url' => $blogViewReference->getUrl(),
                ]
            ),
            'message' => $message,
        ];

        return new JsonResponse($response);
    }
844723
protected function _getCategory($oArticle, $iLang)
    {
        $oCat = null;
        $oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
        if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
            $oCat = $oView->getActiveCategory();
        } elseif ($oView instanceof \OxidEsales\Eshop\Core\Controller\BaseController) {
            $oCat = $oView->getActCategory();
        }

        return $oCat;
    }
315029
public function deleteZoomPicture($oObject, $iIndex)
    {
        // checking if oxzoom field exists
        $oDbHandler = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class);
        $iZoomPicCount = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iZoomPicCount');

        if ($iIndex > $iZoomPicCount || !$oDbHandler->fieldExists("oxzoom" . $iIndex, "oxarticles")) {
            if ($sZoomPicName = $this->getZoomName($oObject->{"oxarticles__oxpic" . $iIndex}->value, $iIndex)) {
                $sFieldToCheck = "oxpic" . $iIndex;
            } else {
                return;
            }
        } else {
            $sZoomPicName = basename($oObject->{"oxarticles__oxzoom" . $iIndex}->value);
            $sFieldToCheck = "oxzoom" . $iIndex;
        }

        if ($sZoomPicName && $sZoomPicName != "nopic.jpg") {
            // deleting zoom picture
            $sPath = \OxidEsales\Eshop\Core\Registry::getConfig()->getPictureDir(false) . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType("Z" . $iIndex);
            \OxidEsales\Eshop\Core\Registry::getUtilsPic()->safePictureDelete($sZoomPicName, $sPath, "oxarticles", $sFieldToCheck);
        }
    }
733434
public function delete() {
        global $DB;

        $this->delete_attachments();
        $this->remove_associations();

        // Get record to pass onto the event.
        $record = $DB->get_record('post', array('id' => $this->id));
        $DB->delete_records('post', array('id' => $this->id));
        core_tag_tag::remove_all_item_tags('core', 'post', $this->id);

        $event = \core\event\blog_entry_deleted::create(array(
            'objectid'      => $this->id,
            'relateduserid' => $this->userid
            ));
        $event->add_record_snapshot("post", $record);
        $event->set_blog_entry($this);
        $event->trigger();
    }
223400
protected function _formJumpList($oArticle, $oParentArticle)
    {
        $aJumpList = [];
        //fetching parent article variants
        $sOxIdField = 'oxarticles__oxid';
        if (isset($oParentArticle)) {
            $aJumpList[] = [$oParentArticle->$sOxIdField->value, $this->_getTitle($oParentArticle)];
            $sEditLanguageParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage");
            $oParentVariants = $oParentArticle->getAdminVariants($sEditLanguageParameter);
            if ($oParentVariants->count()) {
                foreach ($oParentVariants as $oVar) {
                    $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)];
                    if ($oVar->$sOxIdField->value == $oArticle->$sOxIdField->value) {
                        $oVariants = $oArticle->getAdminVariants($sEditLanguageParameter);
                        if ($oVariants->count()) {
                            foreach ($oVariants as $oVVar) {
                                $aJumpList[] = [$oVVar->$sOxIdField->value, " -- " . $this->_getTitle($oVVar)];
                            }
                        }
                    }
                }
            }
        } else {
            $aJumpList[] = [$oArticle->$sOxIdField->value, $this->_getTitle($oArticle)];
            //fetching this article variants data
            $oVariants = $oArticle->getAdminVariants(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage"));
            if ($oVariants && $oVariants->count()) {
                foreach ($oVariants as $oVar) {
                    $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)];
                }
            }
        }
        if (count($aJumpList) > 1) {
            $this->_aViewData["thisvariantlist"] = $aJumpList;
        }
    }
233872
protected function _checkForArticleCategories($oArticle)
    {
        // check if article is in some assigned category
        $aCatIds = $oArticle->getCategoryIds();
        if (!$aCatIds || !count($aCatIds)) {
            // no categories are set for article, so no discounts from categories..
            return false;
        }

        $sCatIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCatIds)) . ")";

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        // getOne appends limit 1, so this one should be fast enough
        $sQ = "select oxobjectid from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxobjectid in $sCatIds and oxtype = 'oxcategories'";

        return $oDb->getOne($sQ);
    }