FIX: Restrict scope of old scheme upload migration.

FIX: Restrict scope of old scheme upload migration.

Some sites have external URLs that don’t even match `%/uploads/%’ and some sites surprise me with URLs that contains the default path when it is a site in a multisite cluster. We can’t do anything about those.

diff --git a/app/models/upload.rb b/app/models/upload.rb
index 0e5fef5..d803e2f 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -224,8 +224,7 @@ class Upload < ActiveRecord::Base
       max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
       local_store = FileStore::LocalStore.new
 
-      scope = Upload.by_users
-        .where("url NOT LIKE '%/original/_X/%'")
+      scope = Upload.by_users.where("url NOT LIKE '%/original/_X/%' AND url LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}%'")
         .order(id: :desc)
 
       scope = scope.limit(limit) if limit

GitHub sha: 4037a2fd