4 include_once
'./Services/FileSystem/classes/class.ilFileSystemStorage.php';
29 $this->logger = $DIC->logger()->wsrv();
30 $this->logger->logStack();
48 $settings = $DIC->settings();
49 if (!$settings->get(
'soap_user_administration', 0)) {
50 $this->logger->warning(
'Webservices disabled in administration.');
53 ->withHeader(
'Content-Type',
'text/html')
54 ->withStatus(\
Slim\Http\StatusCode::HTTP_FORBIDDEN)
55 ->write(
'Webservice not enabled.');
66 return 'ilRestFileStorage';
98 $file_id = $request->getParam(
'name');
100 $this->logger->debug(
'Original file name: ' . $file_id);
102 $real_path = realpath($this->
getPath() .
'/' . $file_id);
104 $this->logger->warning(
'No realpath found for ' . $this->
getPath() .
'/' . $file_id);
107 $file_name = basename($real_path);
108 $this->logger->debug(
'Translated name: ' . $this->
getPath() .
'/' . $file_name);
111 is_file($this->
getPath() .
'/' . $file_name) &&
112 file_exists($this->
getPath() .
'/' . $file_name)
114 $this->logger->info(
'Delivering file: ' . $this->
getPath() .
'/' . $file_name);
115 $return = file_get_contents($this->
getPath() .
'/' . $file_name);
117 $this->logger->dump($return);
119 $response = $response
120 ->withStatus(\
Slim\Http\StatusCode::HTTP_OK)
121 ->withHeader(
'Content-Type',
'application/json')
137 ->withHeader(
'Content-Type',
'text/html')
138 ->withStatus(\
Slim\Http\StatusCode::HTTP_NOT_FOUND)
139 ->write(
'File not found');
157 $request_body = $request->getParam(
'content');
163 $return = basename($tmpname);
165 $response = $response
166 ->withHeader(
'ContentType',
'application/json')
178 return basename($tmpname);
187 return $this->
getPath() .
'/' . $tmpname;
195 $max_age =
time() - self::AVAILABILITY_IN_DAYS * 24 * 60 * 60;
197 foreach ($ite as
$file) {
198 if ($file->getCTime() <= $max_age) {
200 @unlink($file->getPathname());
202 $this->logger->warning($e->getMessage());
createFile(\Slim\Http\Request $request, \Slim\Http\Response $response)
Create new file from post.
init()
init and create directory
deleteDeprecated()
Delete deprecated files.
getFile(\Slim\Http\Request $request, \Slim\Http\Response $response)
getStoredFilePath($tmpname)
getPathPostfix()
Get path prefix.
create()
Create directory.
writeToFile($a_data, $a_absolute_path)
Write data to file.
__construct()
Constructor.
const AVAILABILITY_IN_DAYS
storeFileForRest($content)
checkWebserviceActivation(\Slim\Http\Request $request, \Slim\Http\Response $response)
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
getPathPrefix()
Get path prefix.
Slim Framework (https://slimframework.com)
responeNotFound(\Slim\Http\Response $response)
Send 403.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file