ClassicPress Development with GitHub: Creating release zips

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

In the last post of this series, when discussing creating a release, I mentioned that you should upload a zip file containing the release code.

While users can download the source code directly, this will leave -master on the folder name. By creating a release zip, you can avoid this.

I have developed quite a few plugins for ClassicPress and have instances where I make changes to several plugins for release at the same time. To make this easier, I have a Windows batch command which will call 7-zip to compress all folders, in the same folder as the batch file, as zip files:

for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a -xr!.git\ -xr!*~ "%%X.zip" "%%X\"

I didn’t create this command line statement all on my own, but think I might have added the argument to exclude files with a .git suffix. Unfortunately, I started using it a few months ago and do not remember from where the original script came.

ClassicPress Development with GitHub: Create Release

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

When developing with GitHub, you can make a release; this is a way of grouping together all of the changes since the last release to make it easy to download that particular code set. One point to note, is that while GitHub will automatically create a zip of the source code, this isn’t suitable to use for a ClassicPress release as it will include -master in the contained directory name. However, you can upload a zip file containing the code in the correct folder.

To create a new release, load the repository page on GitHub and click the releases button (red ringed):

Repository page

Continue reading “ClassicPress Development with GitHub: Create Release”

Replacing ClassicPress Cron with system cron

ClassicPressClassicPress is a hard-fork of Wordpress 4.9 and has the same functionality as that version of WordPress although version 2 of ClassicPress is on the way, which is where changes will start to be introduced.

Some of my sites have been experiencing a growing number of visitors to the point where it is starting to cause problems. The reason for the problems is that the built-in ClassicPress cron handler (WP-Cron) is not a real cron job, but a mimic. And an inefficient one at that.

On high traffic sites this cron-mimic can cause performance problems. A normal system cron job will run continuously and trigger at the scheduled times, but WP-Cron does not run continuously. Instead, it fires on every page load which is where the performance problems can come in; if there are not sufficient PHP workers for the requested processes, a request will be initiated and wait until the next worker comes available. There is also an issue on low traffic sites that a scheduled task won’t start until a page is loaded.

It is recommended that the WP-Cron job be disabled and a system job created and run on a pre-defined schedule.

Disabling WP-Cron is easy to do; edit your wp-config.php file and add the following code above the /* That's all, stop editing! Happy blogging. */ line:

/** Disable cron. */
define('DISABLE_WP_CRON', 'true');

You then need to create the system cron job; the format of this may vary depending on your host. This is the one which works for my host:

cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php

Two possible variations are:

cd /home/{username}/public_html; php -q wp-cron.php
php -q /home/{username}/public_html/wp-cron.php

For my main sites I have set the cron to once every hour, but on less trafficked sites I’ve opted for once or twice a day or week.

azurecurve ClassicPress Plugin: Get GitHub File

ClassicPress PluginsThis is part of the which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is a brand new one written for ClassicPress; Get Github File.

Functionality

Gets the content of a file from a GitHub repository and outputs using a shortcode.

Settings allow default options, such as author, folder, filename to be specified. Additional options to allow the removal or conversion of WordPress headers in readme.txt files.

Available shortcode parameters:

  • account – account on GitHub
  • branch – branch to get file from
  • folder – folder containing the file
  • file – file to get from GitHub repository
  • repository – name of GitHub repository
  • startfrom – text in file to start outputting from (e.g. # Description)
  • htmlastext – 1 to output HTMl as text and 0 to output as HTML
  • shortcodesastext – 1 to output shortcodes as text and 0 to output as shortcode
  • wordpresstitles – remove/ignore/convert

All parameters except repository can be defined as defaults in settings.

Output is in markdown, but use of a plugin such as Markdown by azurecurve can convert this markdown to HTML markup.

Download

The plugin can be downloaded via my Development site.

ClassicPress Development with TortoiseGit: Revert Last Commit

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

When you have changes committed to GitHub, you need to make a release of your plugin. Making a release has two main benefits:

  1. It labels the files in the repository with a tag making it easy to download a particular version of the plugin.
  2. You can upload a zip file containing the plugin folder giving a zip file which users can download and upload to their ClassicPress site.

To create a release, open the GitHub repository page and click the releases link at the top (ringed in red):

Github repository

Continue reading “ClassicPress Development with TortoiseGit: Revert Last Commit”

ClassicPress Development with TortoiseGit: Commit

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

Once the repository has been cloned and changes made, you need to submit the changes back to the repository to keep control of changes. This is referred to as a “commit”. To commit your change, right-click the folder (or file) to commit and select Git Commit -> “master” on the context menu:

Git Commit

Continue reading “ClassicPress Development with TortoiseGit: Commit”

ClassicPress Development with TortoiseGit: Clone Repository

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

With TortoiseGit installed we can start using it for managing source control on projects. The first thing you will want to do is to make a copy of your GitHub repository on your PC so you can amend files. In TortoiseGit terms this is done by cloning the repository.

On my local PC I have a folder called Plugins into which I want to close a repository. To do this, right-click the folder and select Git Clone from the context menu:

Right-click menu showing the clone option

Continue reading “ClassicPress Development with TortoiseGit: Clone Repository”

ClassicPress Development with TortoiseGit: Update

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

TortoiseGit is like any other application and should be updated when an update is available. Fortunately, it comes with automatic updates includes. You will receive a popup telling you there is an update available; click Download to download the new version:

Check For Updates - TortoiseGit: New version available

Continue reading “ClassicPress Development with TortoiseGit: Update”

ClassicPress Development with TortoiseGit: First run

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

On the last stage of installing TortoiseGit had the run First Start Wizard marked. When the First Start Wizard launches, select your language and click Next:

First Start Wixzard - TortoiseGit: Welcome to TortoiseGit

Continue reading “ClassicPress Development with TortoiseGit: First run”

ClassicPress Development with TortoiseGit: Install TortoiseGit for Windows

TortoiseGitWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with TortoiseGit which is a sub-series of the ClassicPress Development with GitHub series.

With Git for Windows installed, we can move onto installing TortoiseGit itself. TortoiseGit can be downloaded from here:

Download TortoiseGit

Continue reading “ClassicPress Development with TortoiseGit: Install TortoiseGit for Windows”