=== added file 'resources/util/refreshSQLViews.R' --- resources/util/refreshSQLViews.R 1970-01-01 00:00:00 +0000 +++ resources/util/refreshSQLViews.R 2013-06-11 15:28:55 +0000 @@ -0,0 +1,19 @@ +#Author: Jason P. Pickering +#A simple script to refresh DHIS2 SQL views using R and curl +#Modify to suit your needs +username<-"admin" +password<-"district" +server<-"http://apps.dhis2.org/demo/" + +#Do not modify below, unless you need to. +require(XML) +require(RCurl) +pass<-paste0(username,":",password) +url<-paste0(server,"/api/sqlViews.xml") +response<-getURL(url,userpwd=pass,httpauth = 1L, header=FALSE,ssl.verifypeer = FALSE) +doc<-xmlTreeParse(response, useInternal = TRUE) +top <- xmlRoot(doc) +urls<-as.list(xmlSApply(top[[2]], xmlGetAttr, "href")) +commands<-paste0('curl "',urls,'/execute" -X POST -u ',pass,' -v') +for (i in 1:length(commands)) { +system(commands[i]) } \ No newline at end of file