Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From file guid, how can I know if a file is a "cfile" file ? #211

Open
Gilbertdelyon opened this issue Feb 29, 2024 · 1 comment
Open

From file guid, how can I know if a file is a "cfile" file ? #211

Gilbertdelyon opened this issue Feb 29, 2024 · 1 comment
Labels

Comments

@Gilbertdelyon
Copy link

Context:
I have a custom module with some actions when a file is downloaded.
I need to know if the downloaded file is managed by cfile.

The way I do:
Get file guid from request parameters:
$fileguid = Yii::$app->request->get('guid')
Then query in db 'file' table to get the file id
Then query in db cflies_file table and check if the id is in the table.
If the id is in the table it means that it's a "cfile" file.

Issue:
Some times it works, some times it doesn't.
This is because a lot of files that are referenced in folders are not in the "cfiles_file" table.
It seems that only "old" files are in the table but not new files.
When I browse in the folders, all files are present and download counter is updated. But I cannot find counter value of new files in db
So I worry about the way it works.

Questions

  • Please, how does it work?
  • From de file guid, is there a simple way to check is the file is a "cfile" file?

Thank you in advance for your comments

@Gilbertdelyon Gilbertdelyon changed the title From fiel guid, how can I know if a file is a "cfile" file ? From file guid, how can I know if a file is a "cfile" file ? Feb 29, 2024
@Gilbertdelyon
Copy link
Author

Gilbertdelyon commented Feb 29, 2024

In the meantime I found that I was on the wrong way (newbee error). I need to use object_id. from file table and compare with id in cfile-file table

@luke- luke- added the question label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants