File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ This directory is intended as a repository of scripts having some (at most)
2+ short lived purpose. Any scripts having ongoing value should reside elsewhere.
3+
4+ Since many of these scripts would be harmful if accidentally run, consider
5+ chmod'ing them without the executable bit set.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ # Found on production-console in May 2016, with no knowledge beyond its
3+ # contents.
4+ # ubuntu@production-console:~$ ls -l invalidate_level_source_images
5+ # -rw-r--r-- 1 ubuntu ubuntu 845 Nov 25 2014 invalidate_level_source_images
6+
7+ require_relative '../../config/environment'
8+
9+ # invalidate level_source_images by breaking the md5. Future solutions
10+ # will now create a new LevelSource because it can't find the existing
11+ # one.
12+
13+ # Some bad level_source_images may have been created before this bug
14+ # was fixed:
15+ # https://github.com/code-dot-org/code-dot-org/commit/1db0dfffb2c1a3634d467b67138b31eb3de257b9
16+ # we want to change the urls (eg: http://studio.code.org/sh/47434474/)
17+ # by generating a new level source id (instead of just fixing the
18+ # image) because facebook hangs on to images in the cache for too
19+ # long.
20+
21+ LevelSource . where ( level_id : Script . find_by_name ( 'frozen' ) . level_ids ) .
22+ where ( 'created_at < ?' , '2014-11-20' ) . each do |level_source |
23+ new_md5 = ( "invalid-" + level_source . md5 ) . slice ( 0 ..31 )
24+ level_source . update_attribute ( :md5 , new_md5 )
25+ end
You can’t perform that action at this time.
0 commit comments