Ingo_Script_Base::activate PHP Méthode

activate() public méthode

Connects to the backend, uploads the scripts and sets them active.
public activate ( boolean $activate = true, boolean $auto_update = true )
$activate boolean Activate the script?
$auto_update boolean Only update if auto_update is active?
    public function activate($activate = true, $auto_update = true)
    {
        global $injector, $prefs;
        if (!$this->hasFeature('script_file') || $auto_update && !$prefs->getValue('auto_update')) {
            return;
        }
        $transport = $injector->getInstance('Ingo_Factory_Transport');
        foreach ($this->generate() as $val) {
            if (!$activate) {
                $val['script'] = '';
            }
            try {
                $transport->create($val['transport'])->setScriptActive($val);
            } catch (Ingo_Exception $e) {
                $msg = $activate ? _("There was an error activating the script.") : _("There was an error deactivating the script.");
                throw new Ingo_Exception(sprintf(_("%s The driver said: %s"), $msg, $e->getMessage()));
            }
        }
    }