Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
File Class Reference

Caches data to the filesystem. More...

Inheritance diagram for File:

Public Member Functions

 __construct ($location, $name, $type)
 Create a new cache object.
 
 __construct ($url, $timeout=10, $redirects=5, $headers=null, $useragent=null, $force_fsockopen=false, $curl_options=[])
 
 load ()
 Retrieve the data saved to the cache.
 
 mtime ()
 Retrieve the last modified time for the cache.
 
 save ($data)
 Save data to the cache.
 
 touch ()
 Set the last modified time to the current time.
 
 unlink ()
 Remove the cache.
 

Public Attributes

 $body
 
 $error
 
 $headers = []
 
 $method = SimplePie\SimplePie::FILE_SOURCE_NONE
 
 $permanent_url
 
 $redirects = 0
 
 $status_code = 0
 
 $success = true
 
 $url
 
 $useragent
 

Protected Attributes

string $extension
 File extension.
 
string $filename
 Filename.
 
string $location
 Location string.
 
string $name
 File path.
 

Detailed Description

Caches data to the filesystem.

Used for fetching remote files and reading local files.

@subpackage Caching

Deprecated
since SimplePie 1.8.0, use implementation of "Psr::SimpleCache::CacheInterface" instead

Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support

This class can be overloaded with {

See also
SimplePie\SimplePie\set_file_class()}

@subpackage HTTP

Todo
Move to properly supporting RFC2616 (HTTP/1.1)

Constructor & Destructor Documentation

◆ __construct()

File::__construct ( $location,
$name,
$type )

Create a new cache object.

Parameters
string$locationLocation string (from SimplePie\$cache_location)
string$nameUnique ID for the cache
Base\TYPE_FEED | Base\TYPE_IMAGE$typeEither TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data

Member Function Documentation

◆ load()

File::load ( )

Retrieve the data saved to the cache.

Return values
arrayData for SimplePie\$data

◆ mtime()

File::mtime ( )

Retrieve the last modified time for the cache.

Return values
intTimestamp

◆ save()

File::save ( $data)

Save data to the cache.

Parameters
array | SimplePie\SimplePie$dataData to store in the cache. If passed a SimplePie object, only cache the $data property
Return values
boolSuccessfulness

◆ touch()

File::touch ( )

Set the last modified time to the current time.

Return values
boolSuccess status

◆ unlink()

File::unlink ( )

Remove the cache.

Return values
boolSuccess status

Member Data Documentation

◆ $location

string File::$location
protected

Location string.

See also
SimplePie\$cache_location

The documentation for this class was generated from the following files: