Created
December 6, 2011 18:49
-
-
Save idris/1439392 to your computer and use it in GitHub Desktop.
Script to update theme slugs
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
/******************************************************************** | |
* fix-theme-slugs-mongo.js | |
* | |
* To run, replace localhost/db_name with your connection info and | |
* run this command: | |
* | |
* mongo localhost/db_name --quiet fix-layout-slugs-mongo.js | |
* | |
*/ | |
var newSlugs = new Array(); | |
newSlugs["bonapetit"] = "menu"; | |
newSlugs["creativejuice"] = "vibrantabstract"; | |
newSlugs["darkroom"] = "darkchrome"; | |
newSlugs["ecoenviro"] = "ecofriendly"; | |
newSlugs["fashionmi"] = "fashion"; | |
newSlugs["kids_toys"] = "playtime"; | |
newSlugs["lifestyle2"] = "magazine"; | |
newSlugs["maliku_blue"] = "cool_rays"; | |
newSlugs["medica"] = "corporate"; | |
newSlugs["papermade"] = "crafty"; | |
newSlugs["rayoflight"] = "faith"; | |
newSlugs["refolio"] = "fabrica_noir"; | |
newSlugs["shortandsimple"] = "concise"; | |
newSlugs["welcome_inn"] = "getaway"; | |
print("===== Themes ====="); | |
db.themes.find().forEach( function(theme) { | |
print(theme.name); | |
if(newSlugs[theme.slug]){ | |
theme.slug = newSlugs[theme.slug]; | |
print("\tNew Slug: " + theme.slug); | |
}else{ | |
print("\tUnchaged"); | |
} | |
db.themes.save(theme); | |
}); | |
print("===== Sites ====="); | |
db.sites.find().forEach( function(site) { | |
print(site.username); | |
if(newSlugs[site.theme]){ | |
site.theme = newSlugs[site.theme]; | |
print("\tNew Slug: " + site.theme); | |
}else{ | |
print("\tUnchaged"); | |
} | |
db.sites.save(site); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment