We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36551
    • 416 Posts
    While you in there, it would be great to also have a setting for who can see the widget. Right now it is for Sudo users only. It would be great if it could be made visible to other users too.

    Thanks for a great extra!
      • 52634
      • 60 Posts
      Hey Terry,

      that is already implemented. As it is a permission related thing, this is not managed by system settings, but via ACL permissions.

      Any user who has the permission system_perform_maintenance_tasks will be able to see the widget at the dashboard (as long as it is added to its dashboard!).

      One of the next versions will include the corresponding policy template and policy. Until then you will have to create them manually.
        • 36551
        • 416 Posts
        Got it.

        Thank you!
          • 52634
          • 60 Posts
          A new intermediate version 0.2.13-beta is published.

          The only fix inside is because of a github curiosity resulting in Updater not reporting the latest 2.4.0-pl but the previous 2.4.0-rc1. This is fixed now and Updater should inform you then about the all new and famous MODX release!
            • 36551
            • 416 Posts
            I've installed Updater 0.2.13 beta on Modx 2.3.5-pl, PHP 5.2.17.

            When I add the widget to the dashboard I get a white screen on the dashboard. Other parts of the manager work normally.

            Also, if the Notifier plugin is enabled, the front-end of the site is a white screen.

            There are no errors in the modx error log.

            The server log has this
            [21-Aug-2015 15:06:49] PHP Parse error: syntax error, unexpected T_FUNCTION in /home7/xxxxxxx/public_html/core/components/updater/model/updater.class.php on line 336


            This is line 336
            usort( $versionArr, function($a,$b) {
                                   if ($a->name == $b->name) {
                                       return 0;
                                   }
                                   return -version_compare( $a->name, $b->name );
                                });
            • I suspect that has to do with your PHP version. Closures (anonymous functions) are available since PHP 5.3

              http://php.net/manual/en/functions.anonymous.php
                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
                • 36551
                • 416 Posts
                I will upgrade php and try this again.

                It would be cool if it could check for the php version before installing.

                Thank you!
                  • 3749
                  • 24,544 Posts
                  I suspect that's new code. I benchmarked something similar and for that use case, an insertion sort is much faster (and avoids the anonymous function). I've tried to modify it to match your code.

                  Here's my code if you want it:

                  $versonsToShow = $this->modx->getOption('versionsToShow, $scriptProperties, 5);
                  $versionsToShow = min($versionsToShow, count($versionArray);
                  for ($i = 1; $i < $versionsToShow; $i++) {
                      $element = $versionArray[$i];
                      $j = $i;
                      while ($j > 0 && version_compare($versionArray[$j - 1]->name, $element->name) < 0) {
                          $versionArray[$j] = $versionArray[$j - 1];
                          $j = $j - 1;
                      }
                      $versionArray[$j] = $element;
                  }


                    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
                    • 52634
                    • 60 Posts
                    Performance was not an issue here for me (and should not have a real world impact on an array of about 20 version tags). But you are right: the taglist is almost sorted when coming from github, and usort uses quicksort, which performes somehow bad in this case...

                    I prefer short and elegant code, and the usort + anonymous function provides that. Besides, of course I can change that to a named function, which should work even with PHP 5.2.

                    But: the main purpose of Updater was to keep installations up-to-date and therefore more secure. Having an extremely old version of PHP and supporting that contradicts that a bit.
                    From my point of view it is ok to _not_ support oldest PHP versions (in order to somehow force people to update their environment too...)
                      • 52634
                      • 60 Posts
                      Update: as long as Updater only uses the last version (showing more than one version is prepared, but not implemented yet), we can set the sorting aside completely and do a linear walkthrough the array - which is indeed Bob's code for versionsToShow = 1... smiley

                      I will change the code there completely - it was only a quick solution for the current tag problem on github, to keep Updater working with the famous new versions...