We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This is a quick approximation of what it should be, but it should work. It sets three placeholders, so you should be able to do whatever you want with it (though it should have some more sanity checks):

    [[+currentVersion]]
    [[+latestVersion]]
    [[+updateMessage]]


    function curl($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
    
    
    $url = 'http://modx.com/download/';
    
    $content =  curl($url);
    
    $pattern = '/>\s*MODX Revolution\s*(\d+\.\d+\.\d+\-*[a-z]*)\s*\</';
    preg_match($pattern, $content, $matches);
    
    $latestVersion = 'Unable to get latest version';
    
    if (isset($matches[1])) {
        $latestVersion =  $matches[1];
    }
    unset ($content);
    
    $currentVersion = $modx->getOption('settings_version');
    
    $modx->setPlaceholder('currentVersion', $currentVersion);
    $modx->SetPlaceholder('latestVersion', $latestVersion);
    
    $msg = $currentVersion == $latestVersion
        ? 'Up to Date'
        : 'New Version Available: ' . $latestVersion;
    
    $modx->setPlaceholder('updateMessage', $msg);
    
    return '';
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 36551
      • 416 Posts
      Bob

      This looks just like what I was looking for. How would this be implemented?
        • 36551
        • 416 Posts
        Look what I just found!

        http://modx.com/extras/package/updater

        This extra provides notifying tools for updates both of the modx core and installed packages. It includes a widget for your dashboard showing you the update state of your modx system (the core) and if there are updates/installations for packages available.

        Just install it and place the updater widget to your dashboard.
        • Nice!
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 23018
            • 353 Posts
            Quote from: terrybarth at Mar 04, 2015, 02:35 AM
            Look what I just found!

            http://modx.com/extras/package/updater

            This extra provides notifying tools for updates both of the modx core and installed packages. It includes a widget for your dashboard showing you the update state of your modx system (the core) and if there are updates/installations for packages available.

            Just install it and place the updater widget to your dashboard.

            Shame on me, I remember Jens Külzer talking about this during MODX CCC 2015. I guess he built a package for this beauty with one hand while he solved my regex problems with the other one.

            Thanks for sharing your find!
              Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
              • 23018
              • 353 Posts
              @smashingred / @modx It would be great to have official xml (json) feeds for evo and revo including the version, download path, publish date, etc off the current stable as well as all available previous releases.

              As all necessary information is already present in the system, this should not be too difficult.

              This would offer some serious benefits and would also be less hacky than the solutions Bob and me came up with. [ed. note: pepebe last edited this post 9 years, 2 months ago.]
                Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
              • We were talking about this yesterday and it may not be much effort to add a web service endpoint for this info. I don't know if the output would be XML or JSON but it's doable at some point. The question is whether it can be done before 2.4 is nearing completion, due to workloads internally.

                This is a nice stop-gap though.
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
                  • 52634
                  • 60 Posts
                  Hello there!

                  You may check the current version of Updater 0.2.4-beta at http://modx.com/extras/package/updater available at the repo. New and quite useful functionality (esp. if you maintain a lot of splattered modx installations at different hosting environments): the modx installations themselves can now send you a notifier e-mail if they detect that there is a core update or are package updates available! Although a "digest" email with version information can be send on a regular base (eg. once a month).

                  I hope the Updater Extra helps people to keep their installations up-to-date and prevents a lot of installations out there which are out-of-date. Currently I am looking for a proper way to promote it a bit. Ideas?
                  Nevertheless I believe its functionality should definetly be part of the MODX core!

                  The previously named "dirty details": Updater does check the github tags for new versions first and then searches for the corresponding zip-ball at modx.com. In fact it would be very useful to have a json or xml file (both!) containing versions information at modx.com - shouldn't be that hard to implement, can even be a static file to protect server performance. Currently you have no chance to automatically checks for new versions without beeing dirty.
                  The data there should also include a flag if a version contains security-related patches or if it is only a bugfix release (IMHO bugfix releases and security only releases should be separated in the future). This way users could choose to be informed about security updates only. The same goes for packages: currently there is no flag in package metadata, if a new version contains security fixes, package maintainers can only deprecate old versions.

                  @pepebe: is your regex still working as expected? smiley
                    • 52634
                    • 60 Posts
                    FYI: I have just opened a thread under Add-ons/General Repository Items Support for comments on Updater: http://forums.modx.com/thread/96613/support-comments-for-updater-0-2-4-beta.