SproutCMS

This is the code documentation for the SproutCMS project

class FilesBackend

Abstract class for a backend storage for the database-managed files

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-08-23
**/
class NewClassName extends FilesBackend {
    
    /**
    * Saves file content as a string. Basically the same as file_put_contents
    **/
    public function putString ($filename, $content) {
        // Method code goes here
    }
    
    /**
    * Saves file content from a stream. Basically just fopen/stream_copy_to_stream/fclose
    **/
    public function putStream ($filename, $stream) {
        // Method code goes here
    }
    
    /**
    * Saves file content from an existing file
    **/
    public function putExisting ($filename, $existing) {
        // Method code goes here
    }
    
    /**
    * Create a copy of the file in a temporary directory.
    * Don't forget to File::destroy_local_copy($temp_filename) when you're done!
    **/
    public function createLocalCopy (string $filename) {
        // Method code goes here
    }
    
    /**
    * Remove a local copy of a file
    **/
    public function cleanupLocalCopy (string $temp_filename) {
        // Method code goes here
    }
    
    /**
    * Moves an uploaded file into the repository.
    * Returns TRUE on success, FALSE on failure.
    **/
    public function moveUpload ($src, $filename) {
        // Method code goes here
    }
    
    /**
    * This is the equivalent of the php readfile function
    **/
    public function readfile ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns file content as a string. Basically the same as file_get_contents
    **/
    public function getString ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns all files which match the specified mask.
    * I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.
    **/
    public function glob ($mask) {
        // Method code goes here
    }
    
    /**
    * Delete a file
    **/
    public function delete ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the size of an image, or false on failure.
    * 
    * Output format is the same as getimagesize, but will be at a minimum:
    *   [0] =&gt; width, [1] =&gt; height, [2] =&gt; type
    **/
    public function imageSize ($filename) {
        // Method code goes here
    }
    
    /**
    * Sets access and modification time of file
    **/
    public function touch ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the public URL for a given file, including domain.
    **/
    public function absUrl ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the URL for a resized image. Does not include domain.
    * Size should be 'rWIDTHxHEIGHT' or 'cWIDTHxHEIGHT'.
    **/
    public function resizeUrl ($filename, $size) {
        // Method code goes here
    }
    
    /**
    * Returns TRUE if the file exists, and FALSE if it does not
    **/
    public function exists ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the size, in bytes, of the specified file
    **/
    public function size ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the relative public URL for a given file.
    * Doesn't contain ROOT/ or domain. Use for content areas.
    **/
    public function relUrl ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the modified time, in unix timestamp format, of the specified file
    **/
    public function mtime ($filename) {
        // Method code goes here
    }
    
}
?>