Created
December 17, 2011 23:29
-
-
Save danmayer/1491783 to your computer and use it in GitHub Desktop.
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
Dir.glob("./mayerdan.com/**/*.php") do |local_filename| | |
unless local_filename.to_s.match(/ayerdan\.com\/pics/) || | |
local_filename.to_s.match(/wastedbrains\.com\/art\/index\.php/) || | |
local_filename.to_s.match(/simplepie\/demo/) || | |
local_filename.to_s.match(/proj\/picts\/slideshow\.php/) || | |
local_filename.to_s.match(/prog\/bencode\/slideshow\.php/) || | |
local_filename.to_s.match(/proj\/phpquiz/) || | |
local_filename.to_s.match(/picts\/linpha-1\.0beta3\/adodb/) | |
doc = File.read(local_filename) | |
original_length = doc.length | |
doc = doc.gsub(/<\?php\r$/,'') | |
doc = doc.gsub(/\}\r\n\?>/m,'') | |
doc = doc.gsub(/global.*turnitupnow.net.*/,'') #safe on wastedbrains | |
add_back = Regexp.escape('<? include ($_SERVER[\'DOCUMENT_ROOT\']."/side.php") ?>') | |
doc = doc.gsub(/.*#{add_back}.*/,'<? include ($_SERVER[\'DOCUMENT_ROOT\']."/side.php") ?>') | |
doc = doc.gsub(/.*\r$/,'') | |
final_length = doc.length | |
puts "#{local_filename} #{original_length} #{final_length}" if original_length!=final_length | |
# puts local_filename | |
# File.open(local_filename, 'w') {|f| f.write(doc) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment