I created an app that writes all files activity on a log “only files activities” , such as creating, deleting renaming, the response contains the use, the action, “rename for example” and the path.
I only need to get the file size, how to do that? its from this function if yes how to use the function? since I don’t know what that function returns
unfortunately I don’t have the app on the GitHub but assume I want to get file size here
<?php
namespace OCA\Tracer\Actions;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
class Files extends Action {
public function create(array $params) {
if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) {
return;
}
$str = 'test';
$node = $this->rootFolder->getUserFolder($str)->get($params['path']);
$node->getSize();
$this->log(
'File created: "%s"',
$params,
[
'path',
]
);
}
at the script in the link FilesService.php the object rootFolder was passed to class FilesService by the constructor not created.
note that I’m using same logger of the NextCloud server
I appreciate the help