* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class GetfileAction extends Action
{
/**
* Path of file to return
*/
-
var $path = null;
/**
*
* @return success flag
*/
-
function prepare($args)
{
parent::prepare($args);
}
if (empty($path) or !file_exists($path)) {
+ // TRANS: Client error displayed when requesting a non-existent file.
$this->clientError(_('No such file.'), 404);
return false;
}
if (!is_readable($path)) {
+ // TRANS: Client error displayed when requesting a file without having read access to it.
$this->clientError(_('Cannot read file.'), 403);
return false;
}
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return int last-modified date as unix timestamp
*/
-
function lastModified()
{
if (common_config('site', 'use_x_sendfile')) {
*
* @return string etag http header
*/
-
function etag()
{
if (common_config('site', 'use_x_sendfile')) {
return null;
}
- $cache = common_memcache();
+ $cache = Cache::instance();
if($cache) {
- $key = common_cache_key('attachments:etag:' . $this->path);
+ $key = Cache::key('attachments:etag:' . $this->path);
$etag = $cache->get($key);
if($etag === false) {
$etag = crc32(file_get_contents($this->path));
*
* @return void
*/
-
function handle($args)
{
// undo headers set by PHP sessions