Deletes the auto-generated files for resize and letterboxing created by Timber
@param string  $local_file   ex: /var/www/wp-content/uploads/2015/my-pic.jpg
or: http://example.org/wp-content/uploads/2015/my-pic.jpg
12958
static function delete_generated_files( $local_file ) {
		if ( URLHelper::is_absolute($local_file) ) {
			$local_file = URLHelper::url_to_file_system($local_file);
		}
		$info = pathinfo($local_file);
		$dir = $info['dirname'];
		$ext = $info['extension'];
		$filename = $info['filename'];
		self::process_delete_generated_files($filename, $ext, $dir, '-[0-9999999]*', '-[0-9]*x[0-9]*-c-[a-z]*.');
		self::process_delete_generated_files($filename, $ext, $dir, '-lbox-[0-9999999]*', '-lbox-[0-9]*x[0-9]*-[a-zA-Z0-9]*.');
		self::process_delete_generated_files($filename, 'jpg', $dir, '-tojpg.*');
		self::process_delete_generated_files($filename, 'jpg', $dir, '-tojpg-[0-9999999]*');
	}
560253
private Status deleteLocalDocument(
            final String inDocID, String inRevID, final boolean obeyMVCC) {
        final String docID = inDocID;
        final String revID = inRevID;

        if (docID == null || !docID.startsWith("_local/"))
            return new Status(Status.BAD_ID);
        if (obeyMVCC && revID == null)
            // Didn't specify a revision to delete: 404 or a 409, depending
            return new Status(getLocalDocument(docID, null) != null ?
                    Status.CONFLICT : Status.NOT_FOUND);

        return inTransaction(new Task() {
            @Override
            public Status run() {
                try {
                    byte[][] metaNbody = forest.rawGet("_local", docID);
                    if (metaNbody == null) {
                        return new Status(Status.NOT_FOUND);
                    } else if (obeyMVCC && revID != null &&
                            !revID.equals(new String(metaNbody[0]))) {
                        return new Status(Status.CONFLICT);
                    } else {
                        forest.rawPut("_local", docID, null, null);
                        return new Status(Status.OK);
                    }
                } catch (ForestException e) {
                    return ForestBridge.err2status(e);
                }
            }
        });
    }
1055469
public static function removeFile(string $file): void
    {
        if (\is_file($file)) {
            if (!@\unlink($file)) {
                throw new \RuntimeException(\sprintf('Unable to delete file "%s"%s', $file, self::getErrorInfo()));
            }
        }
        
        \clearstatcache(true, $file);
    }
751906
protected function removeThumbnails() {
		$thumbnail = $this->thumbnail;
		$smallthumb = $this->smallthumb;
		$largethumb = $this->largethumb;

		//delete standard thumbnail image
		if ($thumbnail) {
			$delfile = new ElggFile();
			$delfile->owner_guid = $this->getOwnerGUID();
			$delfile->setFilename($thumbnail);
			$delfile->delete();
		}
		//delete small thumbnail image
		if ($smallthumb) {
			$delfile = new ElggFile();
			$delfile->owner_guid = $this->getOwnerGUID();
			$delfile->setFilename($smallthumb);
			$delfile->delete();
		}
		//delete large thumbnail image
		if ($largethumb) {
			$delfile = new ElggFile();
			$delfile->owner_guid = $this->getOwnerGUID();
			$delfile->setFilename($largethumb);
			$delfile->delete();
		}
	}
527967
public function setFilesLinks($filesLinks,$local='',$additional=''){
			if($local!='start' && $local!='end'){$local='end';}
			$this->filesLinks[$local][$filesLinks] = $additional;
		}
1300809
public function santitizeFileNames($file)
    {
        $path           = pathinfo($file['name']);
        $new_filename   = preg_replace('/.' . $path['extension'] . '$/', '', $file['name']);
        $file['name']   = $this->localLetterSanitize(sanitize_title($new_filename)) . '.' . $path['extension'];
        return $file;
    }
985220
protected function delTree($localpath) {
		foreach ($this->_scandir($localpath) as $p) {
			@set_time_limit(30);
			$stat = $this->stat($this->convEncOut($p));
			$this->convEncIn();
			($stat['mime'] === 'directory')? $this->delTree($p) : $this->_unlink($p);
		}
		return $this->_rmdir($localpath);
	}
131433
def clear
      flush
      with_tmpfile do |path, file|
        file.write(@format.header)
        file.close
        # Clear replaces the database file like a compactification does
        with_flock(File::LOCK_EX) do
          File.rename(path, @file)
        end
      end
      open
    end
235143
protected void localRelease() {
        super.localRelease();
        _fatalError = false;
        _templatePage = null;
        _innerErrors = null;
        _reportErrors = false;
        _savedContext = null;
    }
15126
protected void localRelease()
    {
        super.localRelease();

        _defaultValue = null;
        _escapeWhiteSpace = true;
        _formatters = null;
        _formatterErrors = false;
        _formatDefaultValue = false;
        _value = null;
    }
380886
protected function _validateLocalPart($local_part)
    {
        $parts = explode('.', $local_part);
        $words = array();

        // Split the local_part into words.
        while (count($parts) > 0) {
            $words[] = $this->_splitCheck($parts, '.');
            for ($i = 0; $i < $this->index + 1; $i++) {
                array_shift($parts);
            }
        }

        // Validate each word.
        foreach ($words as $word) {
            // word cannot be empty (#17317)
            if ($word === '') {
                return false;
            }
            // If this word contains an unquoted space, it is invalid. (6.2.4)
            if (strpos($word, ' ') && $word[0] !== '"')
            {
                return false;
            }

            if ($this->_validatePhrase(trim($word)) === false) return false;
        }

        // Managed to get here, so return the input.
        return $local_part;
    }
645781
private function deleteFiles($attr)
    {
        $base = $this->getSavePath($attr);
        /* @var $model ActiveRecord */
        $model = $this->owner;
        if ($model->isNewRecord) {
            $value = $model->{$attr};
        } else {
            $value = $model->oldAttributes[$attr];
        }
        $file = $base . $value;

        if (is_file($file)) {
            unlink($file);
        }
        if ($this->issetThumbnails($attr)) {
            foreach ($this->attributes[$attr]['thumbnails'] as $name => $options) {
                $this->ensureAttribute($name, $options);
                $file = $base . $name . '_' . $value;
                if (is_file($file)) {
                    unlink($file);
                }
            }
        }
    }
780195
public function delete($file)
	{
		$metaFile = $this->getMetaFilePath($file);
		if ($this->fs->exists($metaFile))
			$this->fs->delete($metaFile);
		if ($this->f3->get('CACHE')) {
			$cache = \Cache::instance();
			if ($cache->exists($cacheHash = $this->getCacheHash($file)))
				$cache->clear($cacheHash);
		}
	}
905031
public function removeTranslationFile($locale)
    {
        unset($this->locales[$locale]);
        unset($this->translations[$locale]);
        unset($this->fileType[$locale]);
    }
111096
protected void localRelease()
    {
        super.localRelease();

        _state.clear();

        _formatters = null;
        _password = false;
        _formatErrors = false;
    }
1218482
public function put($local_file, $remote_file, $mode=null)
    {

        if(!is_null($mode)){
            return $this->scpSend($local_path, $remote_path, $mode);
            return true;
        }
        $stream = @fopen("ssh2.sftp://".$this->sftp.$remote_file, 'w');

        if (! $stream){
            throw new \Exception("Could not open file: $remote_file");
        }

        $data_to_send = @file_get_contents($local_file);
        if ($data_to_send === false){
            throw new \Exception("Could not open local file: $local_file.");
        }

        if (@fwrite($stream, $data_to_send) === false){
            throw new \Exception("Could not send data from file: $local_file.");
        }

        @fclose($stream);

        return true;
    }
710747
public function deleteFile($file, $subdir)
    {
        $path = $this->getFilePath($subdir, '', true);
        foreach($this->owner->sizes as $size) {
            if(file_exists($path . $size['catalog'] . '/' . $file))
                unlink($path . $size['catalog'] . '/' . $file);
        }
    }