25require_once
"class.ilObjectDAV.php";
27require_once
'./Services/History/classes/class.ilHistory.php';
28require_once
'Services/Utilities/classes/class.ilUtil.php';
29require_once
"Modules/File/classes/class.ilObjFile.php";
52 parent::__construct($refid,
$obj);
68 $this->obj->setFileType($this->obj->guessFileType());
70 $this->obj->setPermissions($this->
getRefId());
77 $this->obj->setVersion($this->obj->getVersion() + 1);
79 $this->obj->getFileName().
",".$this->obj->getVersion());
113 return $this->obj->guessFileType();
121 $this->obj->setFileType($type);
129 $this->writeLog(
'setContentLength('.$length.
')');
130 $this->obj->setFileSize($length);
146 $file = $this->obj->getFile();
147 return (file_exists(
$file)) ? fopen(
$file,
'r') :
null;
155 $file = $this->obj->getFile();
156 $parent = dirname(
$file);
157 if (! file_exists($parent))
162 return fopen(
$file,
'w');
175 $file = $this->obj->getFile();
176 return file_exists(
$file) ? filesize(
$file) : 0;
194 if (is_null($this->obj))
206 $this->isNewFile = $this->obj->getVersion() == 0;
207 if ($this->isNewFile)
209 $this->obj->setVersion(1);
An exception for terminatinating execution or to throw for unit testing.
static _createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
getContentData()
Returns the content of the object as a byte array.
setContentType($type)
Sets the mime type of the content of this object.
getContentOutputStreamLength()
Returns the length of the content output stream.
__construct($refid, $obj=null)
Constructor.
initFromNull()
Initializes the object after it has been converted from the NULL type.
createNewVersion()
Creates a new version of the object.
write()
Writes the object data.
getContentType()
Returns the mime type of the content of this object.
getContentLength()
Returns the number of bytes of the content.
getResourceType()
Returns the display name of this object.
read()
Reads the object data.
setContentLength($length)
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
$obj
Application layer object.
getRefId()
Returns the ref id of this object.
getResourceName()
Returns the resource name of this object.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file