application/Espo/Core/Utils/File/Manager.php
public function unsetContents($path, $unsets, $isJSON = true)
    {
        $currentData = $this->getContents($path);
        if (!isset($currentData) || !$currentData) {
            return true;
        }

        $currentDataArray = Utils\Json::getArrayData($currentData);

        $unsettedData = Utils\Util::unsetInArray($currentDataArray, $unsets, true);

        if (is_null($unsettedData) || (is_array($unsettedData) && empty($unsettedData))) {
            $fullPath = $this->concatPaths($path);
            if (!file_exists($fullPath)) {
                return true;
            }
            return $this->unlink($fullPath);
        }

        if ($isJSON) {
            return $this->putContentsJson($path, $unsettedData);
        }

        return $this->putContents($path, $unsettedData);
    }
public function unsetContents($path, $unsets, $isJSON = true)
    {
        $currentData = $this->getContents($path);
        if (!isset($currentData) || !$currentData) {
            return true;
        }

        $currentDataArray = Utils\Json::getArrayData($currentData);

        $unsettedData = Utils\Util::unsetInArray($currentDataArray, $unsets, true);

        if (is_null($unsettedData) || (is_array($unsettedData) && empty($unsettedData))) {
            $fullPath = $this->concatPaths($path);
            if (!file_exists($fullPath)) {
                return true;
            }
            return $this->unlink($fullPath);
        }

        if ($isJSON) {
            return $this->putContentsJson($path, $unsettedData);
        }

        return $this->putContents($path, $unsettedData);
    }
public function unsetContents ( $ path , $ unsets , $ isJSON = true ) { $ currentData = $ this -> getContents ( $ path ) ; if ( ! isset ( $ currentData ) || ! $ currentData ) { return true ; } $ currentDataArray = Utils \ Json :: getArrayData ( $ currentData ) ; $ unsettedData = Utils \ Util :: unsetInArray ( $ currentDataArray , $ unsets , true ) ; if ( is_null ( $ unsettedData ) || ( is_array ( $ unsettedData ) && empty ( $ unsettedData ) ) ) { $ fullPath = $ this -> concatPaths ( $ path ) ; if ( ! file_exists ( $ fullPath ) ) { return true ; } return $ this -> unlink ( $ fullPath ) ; } if ( $ isJSON ) { return $ this -> putContentsJson ( $ path , $ unsettedData ) ; } return $ this -> putContents ( $ path , $ unsettedData ) ; }
Unset some element of content data

@param  string | array $path
@param  array | string $unsets
@return bool
Unset some element of content data