loadAllObjects

loadAllObjects ( bool|default:true _isDisplayWarning , string _pathFile ) : object

Allows to load all global variables previously saved with saveAllObjects. It is usefull for long analysis where it can have an interruption.
Returns true if it is a succes, false else.

Example


loadAllObjects() //load all previous variables (linksToVisit and linksVisited)

if(!isGlobalVariableExists("linksToVisit")) //for first run
{
linksToVisit = ["http://target-site.com"]
linksVisited = []
}

//crawling
def analyzePageAndAddLinks()
{
myLink = remove(linksToVisit, 0)
if(!arrayContains(linksVisited, myLink))
{
.... //do something

saveAllObjects(30) //each 30 links all variables are saved (linksToVisit and linksVisited especially)
}

linksVisited.add(myLink)
saveAllObjects()
}

while(linksToVisit) analyzePageAndAddLinks() //crawl if there are links to visit


See also

saveAllObjects
saveObject
loadOrCreateObject
isGlobalVariableExists

Parameters

_isDisplayWarning (optional)

At the first call, this tool ask if we need to load the last state of variables saved. If _isDisplayWarning = false, we consider you argee. If _isDisplayWarning = -1, we consider you disargee.

_pathFile (optional)

You can indicate a special path on your disk to save all objects. Else it is loaded from the folder savedObject of Grimport Crawler.