Commit Graph

30 Commits

Author SHA1 Message Date
wonda-tea-coffee 3cfabaf14c fix typo 2022-06-08 22:15:36 +09:00
M.Shibuya aab402fb52
Fix clean_cache! breaking with old format of cache id
7e0d939d5b (r33647408)
2019-05-23 18:06:00 +09:00
Shinya Maeda 096f7b2132 If no space left then remove old cache 2018-10-15 09:25:26 +09:00
Akira Matsuda 93800e5320 ⚠️ instance variable @file, @content, @cache_called, @content_type not initialized 2018-02-13 19:55:41 +09:00
Tatsuya Ogi 7e0d939d5b Fixed bug with difference key format between generate_cache_id and clean_cache! 2016-10-01 13:54:07 +09:00
Mehdi Lahmam f4501394b9 Remove UTF-8 magic comments from all the Ruby files
Ruby 2 made UTF-8 the default encoding, which make magic comments
omissible.
2016-01-02 16:38:59 +01:00
Patrick Helm d74ee6bd6a Store::File#cache! will retry after Errno::EMLINK
== Problem

    Errno::EMLINK: Too many links @ dir_s_mkdir

== Full Backtrace (carrierwave 0.9)

    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:247 :in `mkdir`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:247 :in `fu_mkdir`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:224 :in `block (2 levels) in mkdir_p`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:222 :in `reverse_each`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:222 :in `block in mkdir_p`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:208 :in `each`
    /opt/rubies/ruby-2.1.5/lib/ruby/2.1.0/fileutils.rb:208 :in `mkdir_p`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/sanitized_file.rb:290 :in `mkdir!`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/sanitized_file.rb:209 :in `copy_to`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/uploader/cache.rb:131 :in `block in cache!`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/uploader/callbacks.rb:17 :in `with_callbacks`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/uploader/cache.rb:122 :in `cache!`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/mount.rb:327 :in `cache`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/mount.rb:179 :in `file=`
    [GEM_ROOT]/gems/carrierwave-0.9.0/lib/carrierwave/orm/activerecord.rb:38 :in `file=`

== Why

Some file systems only allow a limited number of subdirectories.
Ext3 for example only allow ~32k subdirectories.

== Reproduce

Let's imagine a rails app with a User#avatar

    require 'tempfile'
    32001.times { User.new avatar: Tempfile.new("foo") }
    # This will create 32001 dirs within /public/uploads/tmp

== Fix

Clean cache after caching failed.

== Related Pull Requests / Issues / Links

* [How to: Delete cache garbage directories](https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Delete-cache-garbage-directories)
* [Remove the cached file after storing it #107](https://github.com/carrierwaveuploader/carrierwave/issues/107)
* [Remove the cached file after storing it #125](https://github.com/carrierwaveuploader/carrierwave/pull/125)
* [delete cache garbage dirs #338](https://github.com/carrierwaveuploader/carrierwave/issues/338)
* [delete cache garbage dirs issue #338 #346](https://github.com/carrierwaveuploader/carrierwave/pull/346)
* [Issue 338 #393](https://github.com/carrierwaveuploader/carrierwave/pull/393)
* [tmp files not being deleted #1489](https://github.com/carrierwaveuploader/carrierwave/issues/1489)
2015-11-26 08:53:22 +01:00
alpaca-tc f932840fb8 Ignore wrong cache directory 2014-11-05 16:08:54 +09:00
M.Shibuya 7d8301c26b Make cache storage pluggable 2014-02-19 16:06:50 +09:00
Felix Bünemann 26a4d3431d Support setting permissions of created directories
This adds a new uploader configuration option :directory_permissions
which allows to set the permissions of directories created by the
uploader. Specs have been added or fixed to reflect the changes.
This does NOT modify the permissions of existing directories because
that could be potentially harmful.
2012-04-25 01:33:17 +02:00
James Miller 83ed98e215 Trailing whitespace 2011-12-28 09:56:51 -08:00
Jason Sydes 8b113835fb Added documentation for move_to_cache and move_to_store options. 2011-11-05 16:21:19 -07:00
Jason Sydes 70122fca80 Changed move_into_cache/move_into_store to move_to_cache/move_to_store for method name consistency. 2011-11-05 14:22:39 -07:00
Jason Sydes 03362bff3a For large files, support optional "move_to" instead of "copy_to" for moving into both cache and store. 2011-11-04 14:25:04 -07:00
dmathieu 659fae44da Copy the file instead of moving it
So that it behaves in every storage engine the same.
2010-09-24 16:02:37 +02:00
Jonas Nicklas 97aa5bf5b8 improved the configuration (per uploader config) 2009-09-22 22:03:59 +02:00
Jonas Nicklas fb4dccfa2a removing some cruft 2009-09-18 01:12:34 +02:00
Jonas Nicklas 50ce9f0909 the `public` option has been renamed `root`
and the old `root` option was removed. This was
done to improve the consistency of the interface
and the ambiguity between the two methods.
2009-09-01 23:35:30 +02:00
Jonas Nicklas 957b2b568f All files are utf-8 encoded 2009-07-18 14:16:43 +02:00
Jonas Nicklas 5f13447db2 Reworked storage engines
so they can be aware of the identifier ahead of
time
2009-06-20 15:13:51 +02:00
Jonas Nicklas abfe1c2ad9 Fixed deleting on Amazon S3 2009-05-26 22:51:53 +02:00
Jonas Nicklas 3f61a4e939 Ignore blank files in Storage::File#destroy! 2009-05-10 13:57:20 +02:00
Pavel Kunc c51b2eddc1 Experimental file deleting when model is deleted for Sequel. 2009-05-08 14:32:06 +01:00
Jonas Nicklas 0c33b17633 BREAKING: Changed version name to be in filename
Previously versions were put in different
directories. This will break all existing
uploaded files with versions!!
2009-04-06 23:46:25 +02:00
Jonas Nicklas 940e90aec4 Use permissions in file store 2009-03-26 12:35:11 +01:00
Jonas Nicklas 8924343fba Converted some more docs to rdoc 2009-03-17 23:58:52 +01:00
Jonas Nicklas a62e3ae171 Needlessly pedantic linebreaks :P 2009-03-13 23:15:56 +01:00
Jonas Nicklas 0d8e6b8538 Added some class level documentation 2009-03-13 23:07:51 +01:00
Jonas Nicklas 20d47561ea Store dir is now relative to public
This should make it easier if the app is not
using 'public' as the public directory.
2009-03-06 19:40:12 +01:00
Jonas Nicklas 3c948d654b removed underscore in name 2009-03-02 21:45:35 +01:00