application/Espo/Services/AdminNotifications.php
public function jobCheckNewExtensionVersion($data)
    {
        $config = $this->getConfig();

        if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewExtensionVersion')) {
            return true;
        }

        $pdo = $this->getEntityManager()->getPDO();

        $query = "
            SELECT id, name, version, check_version_url as url
            FROM extension
            WHERE deleted = 0
            AND is_installed = 1
            ORDER BY created_at
        ";

        $sth = $pdo->prepare($query);
        $sth->execute();

        $rowList = $sth->fetchAll(\PDO::FETCH_ASSOC);

        $latestReleases = [];
        foreach ($rowList as $row) {

            $url = !empty($row['url']) ? $row['url'] : null;
            $extensionName = $row['name'];

            $latestRelease = $this->getLatestRelease($url, [
                'name' => $extensionName,
            ]);

            if (!empty($latestRelease) && !isset($latestRelease['error'])) {
                $latestReleases[$extensionName] = $latestRelease;
            }
        }

        $latestExtensionVersions = $config->get('latestExtensionVersions', []);

        $save = false;
        foreach ($latestReleases as $extensionName => $extensionData) {

            if (empty($latestExtensionVersions[$extensionName])) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];
                $save = true;
                continue;
            }

            if ($latestExtensionVersions[$extensionName] != $extensionData['version']) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];

                if (!empty($extensionData['notes'])) {
                    //todo: create notification
                }

                $save = true;
                continue;
            }

            if (!empty($extensionData['notes'])) {
                //todo: find and modify notification
            }
        }

        if ($save) {
            $config->set('latestExtensionVersions', $latestExtensionVersions);
            $config->save();
        }

        return true;
    }
public function jobCheckNewExtensionVersion($data)
    {
        $config = $this->getConfig();

        if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewExtensionVersion')) {
            return true;
        }

        $pdo = $this->getEntityManager()->getPDO();

        $query = "
            SELECT id, name, version, check_version_url as url
            FROM extension
            WHERE deleted = 0
            AND is_installed = 1
            ORDER BY created_at
        ";

        $sth = $pdo->prepare($query);
        $sth->execute();

        $rowList = $sth->fetchAll(\PDO::FETCH_ASSOC);

        $latestReleases = [];
        foreach ($rowList as $row) {

            $url = !empty($row['url']) ? $row['url'] : null;
            $extensionName = $row['name'];

            $latestRelease = $this->getLatestRelease($url, [
                'name' => $extensionName,
            ]);

            if (!empty($latestRelease) && !isset($latestRelease['error'])) {
                $latestReleases[$extensionName] = $latestRelease;
            }
        }

        $latestExtensionVersions = $config->get('latestExtensionVersions', []);

        $save = false;
        foreach ($latestReleases as $extensionName => $extensionData) {

            if (empty($latestExtensionVersions[$extensionName])) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];
                $save = true;
                continue;
            }

            if ($latestExtensionVersions[$extensionName] != $extensionData['version']) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];

                if (!empty($extensionData['notes'])) {
                    //todo: create notification
                }

                $save = true;
                continue;
            }

            if (!empty($extensionData['notes'])) {
                //todo: find and modify notification
            }
        }

        if ($save) {
            $config->set('latestExtensionVersions', $latestExtensionVersions);
            $config->save();
        }

        return true;
    }
public function jobCheckNewExtensionVersion ( $ data ) { $ config = $ this -> getConfig ( ) ; if ( ! $ config -> get ( 'adminNotifications' ) || ! $ config -> get ( 'adminNotificationsNewExtensionVersion' ) ) { return true ; } $ pdo = $ this -> getEntityManager ( ) -> getPDO ( ) ; $ query = "
            SELECT id, name, version, check_version_url as url
            FROM extension
            WHERE deleted = 0
            AND is_installed = 1
            ORDER BY created_at
        " ; $ sth = $ pdo -> prepare ( $ query ) ; $ sth -> execute ( ) ; $ rowList = $ sth -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ latestReleases = [ ] ; foreach ( $ rowList as $ row ) { $ url = ! empty ( $ row [ 'url' ] ) ? $ row [ 'url' ] : null ; $ extensionName = $ row [ 'name' ] ; $ latestRelease = $ this -> getLatestRelease ( $ url , [ 'name' => $ extensionName , ] ) ; if ( ! empty ( $ latestRelease ) && ! isset ( $ latestRelease [ 'error' ] ) ) { $ latestReleases [ $ extensionName ] = $ latestRelease ; } } $ latestExtensionVersions = $ config -> get ( 'latestExtensionVersions' , [ ] ) ; $ save = false ; foreach ( $ latestReleases as $ extensionName => $ extensionData ) { if ( empty ( $ latestExtensionVersions [ $ extensionName ] ) ) { $ latestExtensionVersions [ $ extensionName ] = $ extensionData [ 'version' ] ; $ save = true ; continue ; } if ( $ latestExtensionVersions [ $ extensionName ] != $ extensionData [ 'version' ] ) { $ latestExtensionVersions [ $ extensionName ] = $ extensionData [ 'version' ] ; if ( ! empty ( $ extensionData [ 'notes' ] ) ) { //todo: create notification } $ save = true ; continue ; } if ( ! empty ( $ extensionData [ 'notes' ] ) ) { //todo: find and modify notification } } if ( $ save ) { $ config -> set ( 'latestExtensionVersions' , $ latestExtensionVersions ) ; $ config -> save ( ) ; } return true ; }
Job for cheking a new version of installed extensions

@param  object $data

@return boolean
Job for cheking a new version of installed extensions