Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250530) (c39b7370636)
File Class Reference

Caches data to the filesystem. More...

Inheritance diagram for File:
Base moodle_simplepie_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
 
string const TYPE_FEED = 'spc'
 Feed cache type.
 
string const TYPE_IMAGE = 'spi'
 Image cache type.
 

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

Implements Base.

Member Function Documentation

◆ load()

File::load ( )

Retrieve the data saved to the cache.

Return values
arrayData for SimplePie::$data

Implements Base.

◆ mtime()

File::mtime ( )

Retrieve the last modified time for the cache.

Return values
intTimestamp

Implements Base.

◆ 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

Implements Base.

◆ touch()

File::touch ( )

Set the last modified time to the current time.

Return values
boolSuccess status

Implements Base.

◆ unlink()

File::unlink ( )

Remove the cache.

Return values
boolSuccess status

Implements Base.

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: