Tag name:wordpress

Setting up a ubuntu for my development enviroment

13th May 2021

So I'm experimenting with a new development environment - this one is a ubuntu 20.04 running inside of Oracle VM Virtual Box. The initial installation was done following the cookbook from Abhishek Prakash.

Initial VM setup

  • Download and install VirtualBox
  • Download the ISO for Ubuntu
  • Start Virtual Box and create a new VM - I specified 4GB memory, 4 processor and approx 60GB Hard Disc
  • Start the VM using the ISO image and complete the Ubuntu installation

Development Environment Setup

  • Install fossil using sudo apt install fossil
  • Install ant using sudo apt install ant
  • Install npm using sudo apt install npm
  • Install php 7.4 using sudo apt install php7.4
  • Create directory for the website development mkdir website
  • Clone the website fossil and open it:
    • fossil clone http://david:password@virtual.internal:7780/website website.fossil
    • cd website
    • fossil open ../website.fossil
  • Install prereq npm packages:
    • sudo npm -g install jshint@2.11
    • sudo npm -g install qunit@2.10
    • sudo npm -g install ajv-cli@4.0
  • Test the build by
    • cd build
    • ant rebuild-all

WordPress setup

  • Install prereqs by sudo apt install apache2 mysql-server libapache2-mod-php php-mysql
  • Configure and enable apache2 by
    • sudo systemctl start apache2
    • sudo systemctl enable apache2
    • sudo ufw allow in "Apache Full"
  • Configure mysql and setup a database for wordpress by
    • sudo mysql_secure_installation
    • sudo mysql -u root -p and enter these commands:
      • CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
      • CREATE USER wordpress IDENTIFIED WITH mysql_native_password BY '12345';
      • GRANT ALL ON wordpress.* TO 'wordpress'@'%';
      • quit
  • Install php extensions used by wordpress using sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
  • Restart apache2 using sudo systemctl restart apache2
  • Install curl using sudo apt install curl
  • Download wordpress using curl -O https://wordpress.org/latest.tar.gz
  • Extract the archive and move under apache:
    • tar -xzvf latest.tar.gz
    • sudo mv wordpress /var/www/html
    • sudo chown -R www-data:www-data /var/www/html/wordpress
    • sudo chmod -R 775 /var/www/html/wordpress
  • Setup the wordpress config:
    • cd /var/www/html/wordpress
    • sudo mv wp-config-sample.php wp-config.php
    • Edit wp-config.php to setup the credentials for the database
  • Setup the apache2 config for wordpress:
    • sudo nano /etc/apache2/sites-available/wordpress.conf
    • Make the contents to these lines:
      <Directory /var/www/html>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Require all granted
      </Directory>
      <VirtualHost *:80>
              ServerName wordpress
              ServerAdmin webmaster@localhost
              DocumentRoot /var/www/html/wordpress
              ErrorLog ${APACHE_LOG_DIR}/error.log
              CustomLog ${APACHE_LOG_DIR}/access.log combined
      </VirtualHost>
      
    • Check the config via: apache2ctl -t
    • Enable it with sudo a2ensite wordpress
    • Disable the default site with sudo a2dissite 000-default
    • Activate the new apache2 configuration with sudo systemctl restart apache2
  • Complete the wordpress install by browsing the image's website

phpMyAdmin installation

  • Install phpmyadmin via sudo apt install phpmyadmin
  • You may need to enable the apache2 conf via:
    • sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
    • sudo a2enconf phpmyadmin
    • udo systemctl reload apache2

Ningxia Child Theme

15th April 2021

Description

This child theme provides customisations for the Chronicle, En Garde! and Liftoff!
  • Version: 3.169.0
  • Author: David Vines
  • Last Updated: 2022-01-10T15:31:57Z
  • Requires WordPress Version: 4.0 or higher
  • License: This theme is based on the ming theme used under the terms of the GPL v2 license. This theme may be used under the terms of the GNU General Public License, version 2 license.

Many thanks to Axiu, the author of the ming theme.

Change Log

3.169.0 - 10 January 2022

Support Domain of the Ancients

3.168.0 - 04 January 2022

Support Domain of the Ancients

3.165.0 - 11 September 2021

Support a template that is 'wider' but for a sandpit (i.e., a page without a header)

3.161.0 - 09 September 2021

Fix update detection logic

3.158.0 - 23 July 2021

Common up copyright logic!

3.157.0 - 21 July 2021

Fix updating logic!

3.144.0 - 18 May 2021

  • Reinstate version strings

3.126.0 - 15 April 2021

  • Support plugin information pages

3.97.0 - 22 February 2021

  • Remove empty and duplicate annotations from image and video pages

3.96.0 - 15 February 2021

  • Modify the font size on tag cloud to utilise the space freed up by the smaller count

3.95.0 - 14 February 2021

  • Make counts on the tag cloud small

3.93.0 - 10 February 2021

  • Modify font size on the tag cloud

3.90.0 - 07 February 2021

  • Move fonts (and one style) that should have been in this child theme to this child theme

3.76.0 - 28 January 2021

  • Add support for self-hosted update notification

The information on this page was retrieved by Plugin Information Version 3.161.0.

Sumo Oyakata Plugin Details

28th March 2021

Description

This plugin adds the ability to insert an instance of the Sumo Oyakata game. To do this:
  • It adds a new shortcode that inserts the game. Examples of use:
    [sumoOyakata/]
    Inserts an instance of the game.
  • Version: 3.161.0
  • Author: David Vines
  • Last Updated: 2021-09-09T14:09:19Z
  • Requires WordPress Version: 4.0 or higher
  • License: Although I claim sole ownership of the copyright for this plugin, I hereby grant permission to use this plugin under the terms of the GNU General Public License, version 2 license.

Change Log

3.161.0 - 09 September 2021

Fix update detection logic!

3.157.0 - 21 July 2021

Fix updating logic!

3.153.0 - 21 July 2021

  • Common up the plugin updating code between my plugins

3.152.0 - 09 June 2021

  • Make debug a toggle and adjust some text

3.151.0 - 08 June 2021

  • Fix four+ way ties

3.150.0 - 08 June 2021

  • Add Mono-ii text
  • Rikishi tire quicker
  • Adjust success odds (ironically back to much closer to the original 🙂

3.149.0 - 04 June 2021

  • Refactoring, add debug flag to see the odds and die rolls

3.148.0 - 29 May 2021

  • Change the algorithm used for the odds of a move to succeed
  • Change rikishi's stats a little between bashos

3.147.0 - 23 May 2021

  • Fix checking for Ozeki winning two basho in a row
  • Tighten the odds (i.e., stats matter more than randomness (to a degree)
  • Some code refactoring
  • Yet more names added as the basis for the name generator

3.146.0 - 21 May 2021

  • More names added as the basis for the name generator. Allowed names increased to 12 characters

3.145.0 - 18 May 2021

  • Bug and typo fixes

3.144.0 - 18 May 2021

  • Properly support version numbering for more correct browser cache busting

3.142.0 - 18 May 2021

  • Add trip action
  • Add some more names
  • Fix odds of successful (base number was inverted)

3.139.0 - 14 May 2021

  • Some more names

3.135.0 - 30 April 2021

  • Check for demotion from Komusubi before automatic promotion

3.134.0 - 27 April 2021

  • Fix date display when the load is older than 2 days

3.133.0 - 19 April 2021

  • Reduce further the element of luck in the bouts

3.132.0 - 19 April 2021

  • Reduce the element of luck in the bouts
  • Use west's odds for west's moves (instead of east's!)

3.130.0 - 18 April 2021

  • Increase width of the info panel
  • Improved description of the bout

3.128.0 - 16 April 2021

  • Fix the Bug fix - Ozeki should not be automatically Maegashira (in fact they never move directly to Maegashira!)

3.127.0 - 16 April 2021

  • More Bug fixes

3.125.0 - 14 April 2021

  • Bug fixes

3.124.0 - 13 April 2021

  • Mark Kadoban Ozeki

3.123.0 - 12 April 2021

  • Stop showing champion at the top of the list for the entire Basho
  • Setup the next button on load rather than just doing it

3.122.0 - 12 April 2021

  • Add info below load/save buttons

3.121.0 - 11 April 2021

  • Don't count non-yokuzuna as yokuzuna!

3.120.0 - 11 April 2021

  • Fix save/load during tie-breaks
  • Fix three+ tie-breaks

3.119.0 - 11 April 2021

  • Take account of yokozunua, ozeki, sekiwake and komusubi counts when deciding on maegashira demotions
  • Stop KK winnners from being demoted to Juryo
  • Highlight Kachikoshi and Makekoshi results

3.118.0 - 11 April 2021

  • Fix broken fix of load between Bashos

3.117.0 - 11 April 2021

  • Fix saving of the seed state for the random number generator
  • Fix load between Bashos

3.116.0 - 10 April 2021

  • Fix spelling of Komusubi
  • Fix save during tie breaks
  • Fix some promotion/demotion logic (including allowing Komusubi to be promoted directly to Ozeki)
  • Allow retirement of Yokozuna and for promotion/demotion from/to Juryo

3.115.0 - 08 April 2021

  • Fix tie break logic and bugs in that logic
  • Reduce effects of randomness
  • Reduce order on the name generations (names more random, but more likely to generate strange letter combos)
  • Allow wider choice of opponents at the beginning of the basho and narrow down as the days pass
  • Assign initial ranks at the end of the first basho
  • Add load and save buttons
  • Have multiple bashos

3.114.0 - 06 April 2021

  • Expand to 42 rikishi (the size of the Makuuchi)
  • Fix some odds
  • Decide on the bouts at the beginning of the day, avoid duplicate bouts

3.113.0 - 03 April 2021

Fix tie break match logic, more names (simplify names to allow generator more scope)

3.112.0 - 01 April 2021

Fix slug used for the plugin (again!)

3.111.0 - 01 April 2021

Fix slug used for the plugin

3.110.0 - 01 April 2021

Used the procedure from The Compleat Strateyst to choose between moves

3.109.0 - 29 March 2021

Added intelligence. Allow for tie-breakers at the end of the basho.

3.108.0 - 29 March 2021

Initial Version


The information on this page was retrieved by Plugin Information Version 3.161.0.

Plugin Information Plugin Details

22nd March 2021

Description

This plugin adds the ability the description and change log of one of my plugins in a similar way to that provided by the wordpress admin. In support of this, the plugin provides three shortcodes:

pluginInformation

This shortcode provides the description and other information about the plugin. Additional information may be added into the right handbox of the generated table by placing the text inside of the shortcode. The additional text will be placed inside a list item (<li> tag)

Example of use
[pluginInformation slug="LatinSquares"]<strong>License:</strong> GPL v2[pluginInformation]

If the attachment attribute is provided on the shortcode, links will be updated to point to the attachment page instead of the direct download page. For example
[pluginInformation slug="LatinSquares" attachment="true"]

If the homepage attribute is provided on the shortcode, a link to the plugin's homepage will be added to the information panel. For example
[pluginInformation slug="LatinSquares" homepage="true"]

pluginInformationChangeLog

This shortcode provides the change log for the plugin

Example of use
[pluginInformationChangeLog slug="LatinSquares"]

pluginInformationVersion

Provides the version number of this plugin (not the version of the plugin being queried)

  • Version: 3.161.0
  • Author: David Vines
  • Last Updated: 2021-09-09T14:09:19Z
  • Requires WordPress Version: 4.0 or higher
  • License: Although I claim sole ownership of the copyright for this plugin, I hereby grant permission to use this plugin under the terms of the GNU General Public License, version 2 license.

Change Log

3.161.0 - 09 September 2021

Fix update detection logic

3.157.0 - 21 July 2021

Common up duplicated code in the plugin update logic

3.149.0 - 04 June 2021

Add Last as a prefix for weekdays. The ISO time is prefilled into last updated text field in case the javascript is unable (or has not yet) run

3.139.0 - 14 May 2021

Support a more generalised development environment. The plugin now looks for the json information file on the hosting site first rather than to a hardcoded site. The standard fallback is still to blog.tremlas.com, my standard website.

3.138.0 - 03 May 2021

Get yesterday to be displayed only if yesterday actually makes sense 🙂

3.137.0 - 01 May 2021

Bug fix to prevent infinite loop!

3.136.0 - 01 May 2021

Have the last updated field filled in by javascript so that the static version doesn't change so much

3.126.0 - 15 April 2021

Provide option for links to be to the attachment page rather than being a direct download

3.108.0 - 29 March 2021

Update URL of the details page

3.106.0 - 24 March 2021

  • Remove plugin link if it's the same as the current page

3.105.0 - 23 March 2021

  • Add a download link for the current version
  • Improve style of the table a little

3.104.0 - 22 March 2021

  • Initial published version

The information on this page was retrieved by Plugin Information Version 3.161.0.

Yet more wordpress plugins I've uninstalled but want to keep a record of

7th February 2021

I've recently done another audit of the plugins used on this site. This was in response to the Media Library insisting that it couldn't update the metadata for media in the media library because it already existed in the library. To track this down I ended up doing a review of the media related plugins. The ones I've uninstalled are:

Bulk Change Media Author Plugin
Allowed me to fix up the author field on multiple media items. I'm now less concerned about this and hence no longer need this
Enable Media Replace
Having sorted out the correct directory structure for my plugins and themes I no longer need this plugin
Phoenix Media Rename
As with the previous plugin, sorting out the directory structure means I no longer need this plugin

Enabling updates for self-hosted WordPress themes and updates

30th January 2021

I recently experimented with changing my themes and plugins to support self-hosted updates. For plugins this was relatively straight-forward once I'd found two articles, one by Misha Rudrastyh, which got me to adjust the contents of the zip files down one level (which allows WordPress to understand that the new zip file being uploaded is a replacement/update for a plugin that is already installed) and gave the basics of the self-hosted update process1, including hosting a file that describes the update along side the zip file that is the actual update. The second article by Paul Biron showed what the current version of WordPress is expecting in the php code for plugins

However those articles don't talk about themes that much. To be fair the process for themes is very similar2. However the expection of the WordPress code is different to that for plugins, so as a record here's my code:

function ningxia_check_for_update( $slug ) {
 $info = ningxia_get_remote_update_info( $slug );
 if ( false == $info ) {
  return false;
 }
 if ( version_compare( '@@@VERSION@@@', $info['version'], ' $slug,
    'new_version'   => $info['version'],
    'url'           => $info['homepage'],
    'package'       => $info['download_link'],
    'icons'         => array(),
    'banners'       => array(),
    'banners_rtl'   => array(),
    'tested'        => '',
    'requires_php'  => '',
    'compatability' => new StdClass()
  );
  return $update;
 } else {
  return false;
 }
}

function ningxia_pre_set_site_transient_update_themes( $transient ) {
 // Check for update
 $themeslug = 'Ningxia';
 $update = ningxia_check_for_update( $themeslug );
 if ( $update ) {
  $transient->response[$themeslug] = $update;
 }
 return $transient;
}
add_filter( 'pre_set_site_transient_update_themes', 'ningxia_pre_set_site_transient_update_themes' );

My build process modifies the @@@VERSION@@@ string into the current version number for the build being created (for example, 3.80.1) whereas the $info[['version']] comes from the json that been retrieved from the self-hosting site.


Last updated: May 30, 2021 at 9:36 am

Footnotes

  1. Though I did have to adjust the logic slightly - when you detect that the filter call is not for the current plugin you need to return the current value of first parameter and not just return false
  2. Though the articles I've read suggest that there could be differences for multi-site setups - as this site is not a multi-site setup, I've yet to test how well this description works for that kind of setup

Fixing the Simply Static plugin

18th November 2020

After updating my Ubuntu system to 20.04, I discovered that my method for generating the static version of the site no longer works. It turns out that the Simply Static plugin has a hidden dependency on PHP 7.2 (and upgrading Ubuntu from 18.04 to 20.04 incidently updates the PHP level from 7.2 to 7.4).

After doing some digging I discovered that the Simply Static plugin has an included library called PhpSimpleHtmlDom and the version in the plugin (1.5) is the culprit, I downloaded a more recent version of that library from github and replaced the version of the library with that level and (after a minor hack to change the namespace of the library to match the old namespace being used), Simply Static is now working again.

Hopefully, at some point, the author of the plugin will update it and I won't need the hack. That said the plugin has not been updated for a few years so may now be abandoned. If so I'll probably have to change the infrastructure that builds the static version of the website...

My thanks to Github user caophihung94 for providing a newer version of the PhpSimpleHtmlDom library

Legal

21st October 2020

Privacy Policy

This website is intended purely as a Personal web site. As such it does not collect any personal information from any body other than myself.

Cookie Policy

This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better.

On this site, the only cookies are those used by WordPress itself so that it can determine where you are in the site and if, for example, you've logged on or not. There a good write up of this on the cookielawinfo website (note, however that wesbite is trying to get you to sign up for their plugin for wordpress that provides a cookie consent banner among other GDPR features).

However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. I suggest consulting the Help section of your browser or taking a look at the About Cookies website which offers guidance for all modern browsers.

Local Browser Storage

The Sumo Oyakata game provides load and save buttons. The data saved is entirely local to your browser and never leaves it in any form.

Copyright

Unless otherwise noted on the relevant page all text is my own and is thus copyrighted by myself (David Vines). Again unless otherwise noted on the relevant page you may copy and reuse the text as long as you abide by the terms of the Creative Commons License Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The copyright in the images varies by the image. If you click on the image you should be taken to the attachment page for the image where details of the copyright owner will be stated and the license used by this website to the image.

Contact

Should you need to contact me, please send an email to webmaster(at)blog(dot)tremlas(dot)com.


Last updated: July 21, 2021 at 14:45 pm

WordPress plugins I have used but are now uninstalled (but want to keep a record of)

19th May 2020

I have used (indeed am still using) a number of wordpress plugins. I have actually written quite a few myself as well as several others. There are a few I've used in the past and may well use again, but are currently uninstalled.

They are:

Merge + Minify + Refresh
Used to minimise the size of the css and javascript sent out by wordpress when delivering pages. Not currently simply because it seriously interferes with debugging the javascript!
WP Content Security Policy Plugin
Used to play with the content security policy that allows cautious browsers (and the server) to manage the javascript being used. I did use this to clean up the delivery, but couldn't get to a really clean content policy. I'd still like to do that, but it's not so trivial for the this site (from memory it's mostly the theme that causes trouble).
WP Super Cache
used when the site on dreamhost was an actual wordpress installation to reduce the server load. Since the dreamhost is now just a static version of the site I don't need it there and don't use on the version on my local network since the caching gets in the way of my testing.
WP-DBManager
I have used this to explore the wordpress database. I don't currently need to do this, but would use it if I needed to
WP-RSSImport
Used to query RSS feeds - As I described on the affected page I used to follow a bunch of RSS feeds, but no longer do so (and it's less useful for this static version of the site anyway).