Fix EZP-21913: fatal error in updateniceurls using legacy:script

JIRA: https://jira.ez.no/browse/EZP-21913

Do not rely on the the ```$cli``` variable instantiated in the start of the script to be global, when run through ezpublish/console it isn't any more.
This PR makes sure that ```$cli``` is an actual eZCLI instance.