public function approveRemoval($sourceDir, array $options, $username)
    {
        $this->init($sourceDir, $options, $username);
        $targetFilename = sprintf('%s/blocks/%s.json', $this->productionDir, $options['blockname']);
        if (!file_exists($targetFilename)) {
            // @codeCoverageIgnoreStart
            return;
            // @codeCoverageIgnoreEnd
        }

        Dispatcher::dispatch(
            BlockEvents::BLOCK_APPROVING_REMOVAL,
            new BlockApprovingRemovalEvent($this->serializer, $targetFilename)
        );

        $this->filesystem->remove($targetFilename);

        $slotDefinition = $this->getSlotDefinition($this->productionDir);
        $blocks = $slotDefinition["blocks"];
        $key = array_search($options['blockname'], $blocks);
        unset($blocks[$key]);
        $slotDefinition["blocks"] = $blocks;
        $this->saveSlotDefinition($this->productionDir, $slotDefinition, $username);

        Dispatcher::dispatch(
            BlockEvents::BLOCK_APPROVED_REMOVAL,
            new BlockApprovedRemovalEvent($this->serializer, $targetFilename)
        );

        DataLogger::log(
            sprintf(
                'Block "%s" has been approved for removal on the "%s" slot on page "%s" for the "%s_%s" language',
                $options["blockname"],
                $options["slot"],
                $options["page"],
                $options["language"],
                $options["country"]
            )
        );
    }
public function approveRemoval($sourceDir, array $options, $username)
    {
        $this->init($sourceDir, $options, $username);
        $targetFilename = sprintf('%s/blocks/%s.json', $this->productionDir, $options['blockname']);
        if (!file_exists($targetFilename)) {
            // @codeCoverageIgnoreStart
            return;
            // @codeCoverageIgnoreEnd
        }

        Dispatcher::dispatch(
            BlockEvents::BLOCK_APPROVING_REMOVAL,
            new BlockApprovingRemovalEvent($this->serializer, $targetFilename)
        );

        $this->filesystem->remove($targetFilename);

        $slotDefinition = $this->getSlotDefinition($this->productionDir);
        $blocks = $slotDefinition["blocks"];
        $key = array_search($options['blockname'], $blocks);
        unset($blocks[$key]);
        $slotDefinition["blocks"] = $blocks;
        $this->saveSlotDefinition($this->productionDir, $slotDefinition, $username);

        Dispatcher::dispatch(
            BlockEvents::BLOCK_APPROVED_REMOVAL,
            new BlockApprovedRemovalEvent($this->serializer, $targetFilename)
        );

        DataLogger::log(
            sprintf(
                'Block "%s" has been approved for removal on the "%s" slot on page "%s" for the "%s_%s" language',
                $options["blockname"],
                $options["slot"],
                $options["page"],
                $options["language"],
                $options["country"]
            )
        );
    }
public function approveRemoval ( $ sourceDir , array $ options , $ username ) { $ this -> init ( $ sourceDir , $ options , $ username ) ; $ targetFilename = sprintf ( '%s/blocks/%s.json' , $ this -> productionDir , $ options [ 'blockname' ] ) ; if ( ! file_exists ( $ targetFilename ) ) { // @codeCoverageIgnoreStart return ; // @codeCoverageIgnoreEnd } Dispatcher :: dispatch ( BlockEvents :: BLOCK_APPROVING_REMOVAL , new BlockApprovingRemovalEvent ( $ this -> serializer , $ targetFilename ) ) ; $ this -> filesystem -> remove ( $ targetFilename ) ; $ slotDefinition = $ this -> getSlotDefinition ( $ this -> productionDir ) ; $ blocks = $ slotDefinition [ "blocks" ] ; $ key = array_search ( $ options [ 'blockname' ] , $ blocks ) ; unset ( $ blocks [ $ key ] ) ; $ slotDefinition [ "blocks" ] = $ blocks ; $ this -> saveSlotDefinition ( $ this -> productionDir , $ slotDefinition , $ username ) ; Dispatcher :: dispatch ( BlockEvents :: BLOCK_APPROVED_REMOVAL , new BlockApprovedRemovalEvent ( $ this -> serializer , $ targetFilename ) ) ; DataLogger :: log ( sprintf ( 'Block "%s" has been approved for removal on the "%s" slot on page "%s" for the "%s_%s" language' , $ options [ "blockname" ] , $ options [ "slot" ] , $ options [ "page" ] , $ options [ "language" ] , $ options [ "country" ] ) ) ; }
Approves the removal of the given contribution

@param string $sourceDir
@param array $options
@param string $username
Approves the removal of the given contribution