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

Introduce mimetype DB update occ command #18742

Merged
merged 5 commits into from
Sep 6, 2015
Merged

Introduce mimetype DB update occ command #18742

merged 5 commits into from
Sep 6, 2015

Conversation

RobinMcCorkell
Copy link
Member

This occ command allows mimetypes in the database to be updated from changed mimetypes in config/mimetypemapping.json. By default, it adds any new mimetypes it finds and updates the filecache based on those, but with an option it can scan all existing mimetypes to update mimetypes on files.

For example, you add a new mapping of '.foo' to 'application/foobar', but your existing '.foo' files still have the 'application/octet-stream' mimetype since they were uploaded before. Run ./occ maintenance:mimetype:update-db to update this. Or, if the 'application/foobar' mimetype already existed, ./occ maintenance:mimetype:update-db --repair-filecache (will be a lot slower for big filecaches!).

Please review @rullzer @icewind1991 @MorrisJobke @PVince81 @icewind1991 @DeepDiver1975

cc @carlaschroder for documentation around the new occ command, and rename of the maintenance:mimetypesjs command to maintenance:mimetype:update-js

Fixes #17625

@RobinMcCorkell RobinMcCorkell added this to the 8.2-current milestone Sep 1, 2015
@karlitschek
Copy link
Contributor

good idea 👍

@icewind1991
Copy link
Contributor

👍 code looks good, saw it work

@rullzer
Copy link
Contributor

rullzer commented Sep 1, 2015

Looking good!
And works!
👍

But we really should have tests for this as well (I know I did not write them either...)
Also remember to also update the existing docs since the command is changed.

$application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
$application->add(new OC\Core\Command\Maintenance\Repair(new \OC\Repair(\OC\Repair::getRepairSteps()), \OC::$server->getConfig()));
$application->add(new OC\Core\Command\Maintenance\SingleUser(\OC::$server->getConfig()));
$application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetic order 🙊

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like the rest of the file is? 😆

@RobinMcCorkell RobinMcCorkell force-pushed the mimetype-updatedb branch 2 times, most recently from e38039d to f6355b3 Compare September 4, 2015 16:29
@RobinMcCorkell
Copy link
Member Author

Well, doing it properly turned out to be a lot more work than expected, but at least some code smell has been removed. Everything is unit tested too

@scrutinizer-notifier
Copy link

A new inspection was created.

@icewind1991
Copy link
Contributor

Looks good 👍

@rullzer
Copy link
Contributor

rullzer commented Sep 6, 2015

Looks good and everything seems to work. 👍
Thanks for the tests :)

rullzer added a commit that referenced this pull request Sep 6, 2015
Introduce mimetype DB update occ command
@rullzer rullzer merged commit 24f5f50 into master Sep 6, 2015
@rullzer rullzer deleted the mimetype-updatedb branch September 6, 2015 14:56
@oparoz
Copy link
Contributor

oparoz commented Sep 6, 2015

Awesome! :)

@carlaschroder
Copy link

But I like code smell. It smells like victory.

@nickvergessen
Copy link
Contributor

Regression: master unit tests are broken:
bildschirmfoto vom 2015-09-11 13 23 36

#18975

@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mimetype mapping occ command needed
8 participants