/** * Retrieve the file size of the path * * @return mixed * * @since 11.1 */ public function filesize() { if (!$this->filename) { $this->setError(JText::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILE_NOT_OPEN')); return false; } $retval = false; // Capture PHP errors $php_errormsg = ''; $track_errors = ini_get('track_errors'); ini_set('track_errors', true); $res = @filesize($this->filename); if (!$res) { $tmp_error = ''; if ($php_errormsg) { // Something went wrong. // Store the error in case we need it. $tmp_error = $php_errormsg; } $res = JFilesystemHelper::remotefsize($this->filename); if (!$res) { if ($tmp_error) { // Use the php_errormsg from before $this->setError($tmp_error); } else { // Error but nothing from php? How strange! Create our own $this->setError(JText::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILE_SIZE')); } } else { $this->_filesize = $res; $retval = $res; } } else { $this->_filesize = $res; $retval = $res; } // Restore error tracking to what it was before. ini_set('track_errors', $track_errors); // return the result return $retval; }
/** * Retrieve the file size of the path */ function filesize() { if (!$this->filename) { $this->setError(JText::_('File not open')); return false; } $retval = false; // Capture PHP errors $php_errormsg = ''; $track_errors = ini_get('track_errors'); ini_set('track_errors', true); $res = @filesize($this->filename); if (!$res) { $tmp_error = ''; if ($php_errormsg) { // some bad went wrong $tmp_error = $php_errormsg; // store the error in case we need it } $res = JFilesystemHelper::remotefsize($this->filename); if (!$res) { if ($tmp_error) { // use the php_errormsg from before $this->setError($tmp_error); } else { // error but nothing from php? how strange! create our own $this->setError(JText::_('Failed to get file size. This may not work for all streams!')); } } else { $this->_filesize = $res; $retval = $res; } } else { $this->_filesize = $res; $retval = $res; } // restore error tracking to what it was before ini_set('track_errors', $track_errors); // return the result return $retval; }