Dr Fragen in the operating room


  • Install a Zipfile with GitHub Updater


    If you maintain your codebase on GitHub, or another git host, the standard download of your repository from within GitHub is an automatically generated zipfile created from your repository. GitHub Updater uses this generated zipfile when it updates or installs a repository from GitHub.

    Build Processes

    Sometimes your project may require build tools such as Grunt, Gulp, Webpack, or some other process. The built project is usually added as a release asset to your release. GitHub Updater is capable of updating using this release asset.

    PHP Fatal

    Recently a problem and discussion arose about installing a plugin via either GitHub Updater’s Remote Install function or as a download of a GitHub repository. Obviously if the plugin requires a build process to be functional a PHP fatal error is likely to occur as some files will only exist after the completion of the build process.


    I created a solution where a Zipfile was merely one more type of git host for Remote Installation using GitHub Updater. You may either drop a local file path into the Plugin URI field or insert the URI to the remote zipfile.

    Zipfile install
    Install from a Zipfile or URI of Zipfile

    I was actually pleasantly surprised at how easy it was to add this functionality.

  • WordPress Debugging


    It is inevitable. At some point when running a WordPress site you will have a conflict, an error, or worst case – a PHP Fatal leading to a WSOD (White Screen of Death).

    My goal is to provide the means with which you should be able to view and hopefully understand, to some degree, the errors so that the most appropriate person can provide a solution.

    Why is it Inevitable?

    By virtue of the shear number of different WordPress plugins, themes, and PHP versions, there are bound to be interactions that cause issues. Hopefully these issues don’t bring down your site. But some will.

    Types of Errors

    There are a few basic types of errors common to WordPress sites. Primarily all are PHP errors. There are 3 primary types of PHP errors: PHP Fatal, PHP Warning, and PHP Notice.

    Under most circumstances you might not even be aware of either the PHP Warning or PHP Notice errors as they commonly only display in your PHP error log. A PHP Fatal error is the most common cause of the WSOD, but again you won’t see the actual error outside of an error log.

    By default WordPress doesn’t display these errors to the user. You can adjust certain settings within wp-config.php to bring these errors to display and/or log them to a WordPress specific debug.log.

    For many, modifying the wp-config.php file is a daunting task that in and of itself, can bring your site down. I’ve tried to simplify this with the creation of my WP Debugging plugin.

    My plugin will add settings to wp-config.php. More specifically setting WP_DEBUG to true and setting WP_DEBUG_LOG to true. There are a number of additional settings that can also set to assist in debugging.

    xDebug Isn’t the Only Way

    Tom McFarlin has written extensively about coding and debugging.

    In this member’s only post, Tom explains many of the individual settings that can assist in debugging a WordPress site using only native WordPress functions. These constants are also described in Debugging in WordPress.

    Automate All the Things

    WP Debugging is a plugin I wrote to automatically add many of WordPress’ built-in settings on plugin activation and remove them on plugin deactivation. The plugin uses the WP-CLI command to add and remove constants from the wp-config.php file. WP Debugging should be available in the Plugins Repository soon.

    There are two optional plugin dependencies that request to be installed, Query Monitor by John Billion and Debug Bar. The notice for these dismisses for 45 days.

    Query Monitor is an established development plugin that provides a wealth of information for debugging. Debug Bar is another excellent development plugin by Automattic.

    Debug Quick Look by Andrew Norcross is a wonderful plugin whose sole function is to display the debug.log that WordPress writes debugging errors to when WP_DEBUG_LOG is set to true. I have included a modified version of this plugin.

    Looking in the Logs

    Viewing the debug.log will allow you to gain insight into the cause of the error. Often these errors will provide a stack trace pointing to exactly the file, function, or line of the error. They will definitely aid the developer.

    Debugging is a art. One that you will only gain proficiency in through practice. It is my goal to help bring this information closer to you as simply as possible via the WP Debugging plugin.

    You can read more about the specifics of what the WP Debugging plugin does on GitHub and, as always, PRs are happily considered on the develop branch.

  • GitHub Updater and Gitea


    Gitea is the new kid on the block for creating a self-hosted git server. Gitea is written in Go and is highly performant with very low overhead. In fact, Gitea is so efficient you can run it on a Raspberry Pi. There’s another post coming about that. 😉

    As with most integrations of new git servers into GitHub Updater it all starts with an issue and a user willing to help. In this case, the user was Marco Berchart.

    Over the years, I’ve continued to refactor GitHub Updater to become more OOP based and adding Gitea support definitely shows that this was the way to go. Adding support for Gitea was far and away the simplest integration yet. Much of this has to do with API closely following the GitHub API.

    Marco was kind enough to start by creating  a PR and we were able to work on a branch until it was complete and able to be merged. There is a demo site at https://try.gitea.io where a test account can be created. There is no guarantee any sort of persistence and don’t expect your data, or possibly even your user, to be around long term. Marco was able to provide an account on his Gitea instance for me to test. I couldn’t have finished the integration with this access.

    Since then I have figured out how to install Gitea on a Raspberry Pi. I’ve actually done the process several times and even updated both Go and Gitea. It makes testing much easier for me and it makes setting up your own local git server for less than $100 simple.

  • GitHub Updater – the Path to 8


    In July it will have been 5 years since the first commit to GitHub Updater. In its 5 year span it has grown significantly in its evolution from a single file plugin to the complex integrated object oriented plugin that exists today.

    Version 8 will see a bump in the requirement to at least PHP 5.6. Yes, it does work in PHP 7.2 but as PHP 5.6 is the lowest version of PHP still supported, I thought this was a nice minimum requirement. When PHP 5.6 becomes EOL’d I will transition up to PHP 7. I can only hope that at some point WordPress follows suit. I have learned that what this also means is that the bootstrap file needs to be compliant with a lower PHP version or the file will white screen the user’s site.

    Version 8 has also seen a more modular architecture to the core of the plugin. What this means is that I’ve added a number of hooks to now allow me to keep most of the specific code siloed into its own classes. This has especially been beneficial to the Settings and Install functions.

    In the Settings, this can result in a slight cosmetic difference as the APIs are hit and the server specific subtabs display. I’ve added a number of icons, tooltips, and notices to let the user know what’s happening and that no it’s not broken.

    In case I haven’t mentioned it before, GitHub Updater also works with WP-CLI and can be used with a webhook for a continuous integration type of updating.

    There’s already been a bump to version 8.1.1. The new feature is automatic renaming of the GitHub Updater plugin upon activation. If the plugin is renamed the activation fails as the activated plugin no longer exists. It has been renamed. 😉

    As always, the best source of current information about GitHub Updater is the wiki.

    Here’s the changelog.

  • GitHub Updater and Background Updates


    GitHub Updater is a WordPress plugin that seeks to emulate the wp-admin dashboard updating experience for plugins and themes hosted on other git hosts. Among the most popular git hosts to use for social coding, or simply provide an external version control system, are GitHub, Bitbucket, GitLab, and Gitea. In order to provide an identical in-app experience GitHub Updater needs to make 5-6 API calls to the get all the data required. There are ways, and hooks, to bypass some of these API calls and therefore speed up the process, but this can result in a lesser experience.

    A solution presented itself in WP-Cron. By using WP-Cron I have been able to drastically reduce the time required to bring the site back to a usable condition while GitHub Updater does its API checks in the background.

    Naturally there is a hook to bypass this system as troubleshooting when WP-Cron is active can be difficult.

    Using a background process does mean that there may be times when the user might try to access an update or branch switching and it may not yet be available. I’ve tried to make as many indicators as I can to let the user know that nothing is broken and that they are simply waiting on WP-Cron to finish.

    The overall result is a much faster response time and much less potential wait while the GitHub Updater cache is updating or being refreshed.

    As always there is more information in the wiki.

  • WordCamp Orange County 2016


    Below are my slides for WordCamp OC 2016. They are rather generic. When the talk comes out on WordPress TV I will update here to include a link.
    BTW, these slides are embedded using my Plugin-A-Palooza third place plugin, Embed PDF Viewer. I think I want a recount. ????

    or from SpeakerDeck.