Fix EZP-21913: ezpublish:legacy:script may break with usage of globals in scripts

https://jira.ez.no/browse/EZP-21913

Replaces #826 .

This PR replaces usage of flawed `global` keyword by closures. This allows to *import* context from inside the script.

## Scripts to fix up

* [x] updateniceurls.php
* [ ] changelog2xmltext.php
* [ ] clusterize.php
* [ ] convertprice2multiprice.php
* [ ] ezasynchronouspublisher.php
* [ ] ezconvertdbcharset.php
* [ ] ezflowupgrade.php
* [ ] ezsubtreecopy.php
* [ ] ezwebincommon.php
* [ ] ezwebininstall.php
* [ ] ezwebinupgrade.php