Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

New Function in FilesModel to list Subfolders #7942

Closed
wants to merge 5 commits into from
Closed

New Function in FilesModel to list Subfolders #7942

wants to merge 5 commits into from

Conversation

christianromeni
Copy link

This would be very usefull if you want to make sure all log entries are stored to a file before cleaning the log.
Many companies have to keep log-files, but dont want the log table to get full.
I have created a log-rotation module, that does that. But the log could be purged before beeing saved to file...

Here is the sorce of my module (unfinished and a little bit insecure up to now..):
https://github.com/christianromeni/cLogRotate

Also, there is only the option to look for multiple files in a folder, but not for multiple folders. This would be a nice feature to look for subfolders. maybe this could be extended to be recursive as well..

This would be very usefull if you want to make sure all log entries are stored to a file before cleaning the log.
Many companies have to keep log-files, but dont want the log table to get full.
I have created a log-rotation module, that does that. But the log could be purged before beeing saved to file...

Here is the sorce of my module (unfinished and a little bit insecure up to now..):
https://github.com/christianromeni/cLogRotate

Greets
Why does the model only offer to find multiply files by folder, and not multiple folders by folder (good way to get subfolders). This could be extended to be recursive..
@christianromeni christianromeni changed the title Add new hook right before purging the log Add new hook right before purging the log & new function in FilesModel Jul 28, 2015
@discordier
Copy link
Contributor

First off, please do not mix two separate features in one PR, this makes things harder for us to read and if we should decide against one feature, the PR has to be rejected causing the second feature to get rejected also.

Second, while I do not have anything against the HOOK in general, I think the naming should rather be purgeSystemLog and the retrieval of the database object should stick to its usage. Therefore the HOOK should IMO be called first.

Third, on your new method in the FilesModel, I fail to see a usecase but I guess you have one at hand?

@christianromeni
Copy link
Author

Ok, sorry, I'm new to the PR thing... Also I'm not sure why the branch is called patch-1 ... I'll try and fix that tomorrow as well as splitting the PR up.

There is no problem calling it different. I'll change that.

A usecase for finding subfolder in my case is: I have definied one folder (eg: /files/logs/) but I'm dynamically creating subfilders depending on the year (eg: /files/logs/2015/).
I would now like to list all files in the subfolders of the defined folder.

This could also be used for multi-dimensional gallerys.

@aschempp
Copy link
Member

First of all, this feature would be added to the next version of Contao 4, and then we should use events and not hooks.
Secondly, I wonder if we should use Monolog for the backend logging, too? I'm pretty sure there would be event options there…

@christianromeni
Copy link
Author

So there is no chance for it to be added in any Contao 3 release?

@aschempp
Copy link
Member

Contao 3.5 is the last version of Contao 3, and a bugfix-release cannot contain new features…

@leofeyer
Copy link
Member

If you remove the logging hook and just add the FilesModel::findMultipleFoldersByFolder() method in this pull request, I could merge it (if there are not other objections).

@christianromeni
Copy link
Author

Ok, will do.
Will be ready soon.

Remove Hook, since its not needed anymore.
@christianromeni christianromeni changed the title Add new hook right before purging the log & new function in FilesModel New Function in FilesModel to list Subfolders Apr 15, 2016
leofeyer pushed a commit to contao/core-bundle that referenced this pull request Oct 24, 2017
@leofeyer leofeyer added this to the 4.5.0 milestone Oct 24, 2017
@leofeyer
Copy link
Member

Merged in contao/core-bundle@3f0687f.

@leofeyer leofeyer closed this Oct 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants