def backup_sites(url, destination, overwrite=True): """Execute the script""" webapp = sp.get_webapplication(url) # make sure destination has a trailing slash if destination[-1] != "\\": destination = destination + "\\" def do_backup(site): backup_site(site, destination + _get_backup_filename(site.Url) + FILE_EXTENSION, overwrite) sp.enum_sites(webapp, do_backup)
def apply_theme(url, theme, force=False): """Applies the theme to all webs within the web application""" # always compare to lower case theme = theme.lower() def do_work(web): # make sure we're comparing to lower case wtheme = web.Theme.lower() if (theme == "none" and wtheme != "") or (theme != "none" and wtheme != theme) or force == True: print "Applying theme to", web.Url web.ApplyTheme(theme) # iterate over all sites, then all webs sp.enum_sites(url, lambda s: sp.enum_all_webs(s, do_work))