public function update(&$modulesUpdated = null)
    {
        require_once($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/classes/general/update_client_partner.php');

        if (!$this->isThirdParty()) {
            throw new Exception\ModuleUpdateException('Kernel module updates are currently not supported.',
                $this->getName());
        }

        // ensures module existence
        $this->getObject();

        $errorMessage = $updateDescription = null;
        $loadResult = \CUpdateClientPartner::LoadModulesUpdates(
            $errorMessage,
            $updateDescription,
            LANGUAGE_ID,
            $this->isBeta() ? 'N' : 'Y',
            [$this->getName()],
            true
        );
        switch ($loadResult) {
            // archive loaded
            case "S":
                return $this->update($modulesUpdated);

            // error
            case "E":
                throw new Exception\ModuleUpdateException($errorMessage, $this->getName());

            // finished installing updates
            case "F":
                return false;

            // need to process loaded update
            case 'U':
                break;
        }

        /** @var string Temp directory with update files */
        $updateDir = null;

        if (!\CUpdateClientPartner::UnGzipArchive($updateDir, $errorMessage, true)) {
            throw new Exception\ModuleUpdateException('[CL02] UnGzipArchive failed. ' . $errorMessage,
                $this->getName());
        }

        $this->validateUpdate($updateDir);

        if (isset($updateDescription["DATA"]["#"]["NOUPDATES"])) {
            \CUpdateClientPartner::ClearUpdateFolder($_SERVER["DOCUMENT_ROOT"] . "/bitrix/updates/" . $updateDir);
            return false;
        }

        $modulesUpdated = $updateDescr = [];
        if (isset($updateDescription["DATA"]["#"]["ITEM"])) {
            foreach ($updateDescription["DATA"]["#"]["ITEM"] as $moduleInfo) {
                $modulesUpdated[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["VALUE"];
                $updateDescr[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["DESCR"];
            }
        }

        if (\CUpdateClientPartner::UpdateStepModules($updateDir, $errorMessage)) {
            foreach ($modulesUpdated as $key => $value) {
                if (Option::set('main', 'event_log_marketplace', "Y") === "Y") {
                    \CEventLog::Log("INFO", "MP_MODULE_DOWNLOADED", "main", $key, $value);
                }
            }
        } else {
            throw new Exception\ModuleUpdateException('[CL04] UpdateStepModules failed. ' . $errorMessage,
                $this->getName());
        }

        return true;
    }
public function update(&$modulesUpdated = null)
    {
        require_once($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/classes/general/update_client_partner.php');

        if (!$this->isThirdParty()) {
            throw new Exception\ModuleUpdateException('Kernel module updates are currently not supported.',
                $this->getName());
        }

        // ensures module existence
        $this->getObject();

        $errorMessage = $updateDescription = null;
        $loadResult = \CUpdateClientPartner::LoadModulesUpdates(
            $errorMessage,
            $updateDescription,
            LANGUAGE_ID,
            $this->isBeta() ? 'N' : 'Y',
            [$this->getName()],
            true
        );
        switch ($loadResult) {
            // archive loaded
            case "S":
                return $this->update($modulesUpdated);

            // error
            case "E":
                throw new Exception\ModuleUpdateException($errorMessage, $this->getName());

            // finished installing updates
            case "F":
                return false;

            // need to process loaded update
            case 'U':
                break;
        }

        /** @var string Temp directory with update files */
        $updateDir = null;

        if (!\CUpdateClientPartner::UnGzipArchive($updateDir, $errorMessage, true)) {
            throw new Exception\ModuleUpdateException('[CL02] UnGzipArchive failed. ' . $errorMessage,
                $this->getName());
        }

        $this->validateUpdate($updateDir);

        if (isset($updateDescription["DATA"]["#"]["NOUPDATES"])) {
            \CUpdateClientPartner::ClearUpdateFolder($_SERVER["DOCUMENT_ROOT"] . "/bitrix/updates/" . $updateDir);
            return false;
        }

        $modulesUpdated = $updateDescr = [];
        if (isset($updateDescription["DATA"]["#"]["ITEM"])) {
            foreach ($updateDescription["DATA"]["#"]["ITEM"] as $moduleInfo) {
                $modulesUpdated[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["VALUE"];
                $updateDescr[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["DESCR"];
            }
        }

        if (\CUpdateClientPartner::UpdateStepModules($updateDir, $errorMessage)) {
            foreach ($modulesUpdated as $key => $value) {
                if (Option::set('main', 'event_log_marketplace', "Y") === "Y") {
                    \CEventLog::Log("INFO", "MP_MODULE_DOWNLOADED", "main", $key, $value);
                }
            }
        } else {
            throw new Exception\ModuleUpdateException('[CL04] UpdateStepModules failed. ' . $errorMessage,
                $this->getName());
        }

        return true;
    }
public function update ( & $ modulesUpdated = null ) { require_once ( $ _SERVER [ "DOCUMENT_ROOT" ] . '/bitrix/modules/main/classes/general/update_client_partner.php' ) ; if ( ! $ this -> isThirdParty ( ) ) { throw new Exception \ ModuleUpdateException ( 'Kernel module updates are currently not supported.' , $ this -> getName ( ) ) ; } // ensures module existence $ this -> getObject ( ) ; $ errorMessage = $ updateDescription = null ; $ loadResult = \ CUpdateClientPartner :: LoadModulesUpdates ( $ errorMessage , $ updateDescription , LANGUAGE_ID , $ this -> isBeta ( ) ? 'N' : 'Y' , [ $ this -> getName ( ) ] , true ) ; switch ( $ loadResult ) { // archive loaded case "S" : return $ this -> update ( $ modulesUpdated ) ; // error case "E" : throw new Exception \ ModuleUpdateException ( $ errorMessage , $ this -> getName ( ) ) ; // finished installing updates case "F" : return false ; // need to process loaded update case 'U' : break ; } /** @var string Temp directory with update files */ $ updateDir = null ; if ( ! \ CUpdateClientPartner :: UnGzipArchive ( $ updateDir , $ errorMessage , true ) ) { throw new Exception \ ModuleUpdateException ( '[CL02] UnGzipArchive failed. ' . $ errorMessage , $ this -> getName ( ) ) ; } $ this -> validateUpdate ( $ updateDir ) ; if ( isset ( $ updateDescription [ "DATA" ] [ "#" ] [ "NOUPDATES" ] ) ) { \ CUpdateClientPartner :: ClearUpdateFolder ( $ _SERVER [ "DOCUMENT_ROOT" ] . "/bitrix/updates/" . $ updateDir ) ; return false ; } $ modulesUpdated = $ updateDescr = [ ] ; if ( isset ( $ updateDescription [ "DATA" ] [ "#" ] [ "ITEM" ] ) ) { foreach ( $ updateDescription [ "DATA" ] [ "#" ] [ "ITEM" ] as $ moduleInfo ) { $ modulesUpdated [ $ moduleInfo [ "@" ] [ "NAME" ] ] = $ moduleInfo [ "@" ] [ "VALUE" ] ; $ updateDescr [ $ moduleInfo [ "@" ] [ "NAME" ] ] = $ moduleInfo [ "@" ] [ "DESCR" ] ; } } if ( \ CUpdateClientPartner :: UpdateStepModules ( $ updateDir , $ errorMessage ) ) { foreach ( $ modulesUpdated as $ key => $ value ) { if ( Option :: set ( 'main' , 'event_log_marketplace' , "Y" ) === "Y" ) { \ CEventLog :: Log ( "INFO" , "MP_MODULE_DOWNLOADED" , "main" , $ key , $ value ) ; } } } else { throw new Exception \ ModuleUpdateException ( '[CL04] UpdateStepModules failed. ' . $ errorMessage , $ this -> getName ( ) ) ; } return true ; }
Update module.

It must be called repeatedly until the method returns false.
After each call php must be restarted (new process created) to update module class and function definitions.

@param array $modulesUpdated [optional]
@return bool
Update module .