Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GUIDs to comments and trackbacks, and clean up Article GUID code.…
… Use GUIDs in Atom 1.0 feeds because our old IDs were nasty and not unique. Still thinking about adding them to RSS 2.0 and Atom 0.3; it'll be user-visible if we change them. git-svn-id: http://svn.typosphere.org/typo/trunk@636 820eb932-12ee-0310-9ca8-eeb645f39767
- Loading branch information
scott
committed
Sep 6, 2005
1 parent
837d01c
commit afa5906
Showing
16 changed files
with
84 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class AddGuids < ActiveRecord::Migration | ||
def self.up | ||
STDERR.puts "Adding GUIDs to Comments and Trackbacks" | ||
Comment.transaction do | ||
add_column :comments, :guid, :string | ||
add_column :trackbacks, :guid, :string | ||
|
||
Comment.find(:all).each do |c| | ||
c.save if c.guid.blank? | ||
end | ||
Trackback.find(:all).each do |t| | ||
t.save if t.guid.blank? | ||
end | ||
end | ||
end | ||
|
||
def self.down | ||
remove_column :comments, :guid | ||
remove_column :trackbacks, :guid | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'md5' | ||
|
||
module TypoGuid | ||
def create_guid | ||
self.guid rescue return true | ||
return true unless self.guid.blank? | ||
|
||
guid_text = self.inspect+Time.now.to_f.to_s | ||
begin | ||
guid_text += File.open("/dev/urandom",'r').read(16) | ||
rescue => err | ||
end | ||
self.guid = Digest::MD5.new(guid_text).to_s | ||
true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters