Programs used before

This is a note to myself as much as anything; GMvault – used to back up gmail accounts. Very useful Imapsync – used to transfer emails from one gmail account to another. Very handy when closing an account Logstalgia – used to visualise logs. Can install on MacOS and watch logs on other systems

Easiest way of upgrading or updating Mediawiki version on Debian/Ubuntu/etc.

So far this is the easiest way I have found to update Mediawiki. This presumes SSH access.   Back up your database and files first!  
cd
wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.1.tar.gz
(if going for another version, replace with the appropriate link)
tar -xvzf mediawiki-1.31.1.tar.gz
cp -rf mediawiki-1.31.1/* /var/www/YOURSITE
If your sites are stored elsewhere, replaces /var/www/YOURSITE with whatever the path name is. Copy with the rf flags forces over-write and copies recursively.
Visit https://yoursitename/mw-config/ in your browser
Follow the instructions from there – you will need the upgrade key from your existing LocalSettings.php file, which should be found in your existing Wiki directory via:

cat LocalSettings.php | grep -A 2 key

 

Can you make Atom autocomplete or autoclose like Sublime Text does?

I spent a lot of time in text editors and have been using Sublime Text for years; Atom recently caught my attention as a completely free alternative (though Sublime’s trial period is currently unlimited…) that has a huge community behind it and good support.   One of the biggest things that I found off-putting was the lack of autocompletion – or autoclose a tag – via typing a </ – something I had gotten rather used to in Sublime which does that by default.   Turns out that one of the best bits of Atom is the packaging system, and there is a package for that. It’s called Less Than Slash and can be installed from the Atom package manager which comes with it (open it with CMD+, on a Mac).   Ten seconds later the package is installed and I have my autocomplete back! Happy camper.

WHMCS cron job says ioncube not installed despite ioncube being installed

This issue drove me batty for an hour – after installing WHMCS with PHP’s Ioncube extension installed successfully the cronjob required by WHMCS would not run, complaining about Ioncube not being installed. Yet php -v showed that it was in fact installed.   What gives?   Turns out that Ioncube had been enabled for PHP-FPM in the following directory:  
/etc/php/7.0/fpm/conf.d/
  …but had not been enabled in this directory also:  
/etc/php/7.0/cli/conf.d/
  …which is another directory that needs the same config file in. In my server’s case the config file was named 00-ioncube.ini and consisted of the following:  

zend_extension = “/usr/lib/php/20151012/ioncube_loader_lin_7.0.so”

  And with that, voila, cron job works. Can’t get that hour of my life back, though.   Update: For the php7.1 servers the zend_extension line read:  

zend_extension = “/usr/lib/php/20160303/ioncube_loader_lin_7.1.so”

WooCommerce Variable Products all showing out of stock: Sorry, this product is unavailable. Please choose a different combination.

I must have spent hours today trying to fix a problem with Woocommerce – no matter which way I set up a variable product it always showed as out of stock no matter which combination of options I selected. The error message was:  
Sorry, this product is unavailable. Please choose a different combination.
  Very frustrating. The problem in the end? I had not yet set prices for all of the variable products. To resolve this go to Product -> Variations -> click on the dropdown box which defaults to “Add Variation” -> Set Regular Prices -> click Go.   Hopefully that’s all it takes to fix your problem too. I was installing custom PHP snippets to try and resolve this issue and going down all sorts of wrong paths when I had simply neglected to take note of which fields were required.

How do you check website links and jpgs etc. recursively?

LinkChecker is a great way of doing this;   http://wummel.github.io/linkchecker/   Other people’s sites may have robots.txt files that prevent you from using this tool on their sites but it’s darn handy for pulling up broken links on your own sites. This is a valid alternative to the Integrity tool on Mac if you’re comfortable with the command line and piping the output to a CSV file etc.    

Importing a MySQL database with a new name where the original still exists

So you want to export your MySQL database then import it on the same server with a new name.   I tried this several times and using the SOURCE command inside MySQL or just mysql -p < db.sql both resulted in the database re-importing over the original name.   To fix that run:
sed -i 's/OLDDATABASENAME/NEWDBNAME/g' mysqldumpFile.sql
Then run:  
mysql -p

create NEWDBNAME;

use NEWDBNAME;

SOURCE /path/to/sql/file
  No need for a semicolon on the last line.   Then check the success by:  
show tables;
   

PHP contact form returns 504 gateway error after moving to Digital Ocean

This one had me scratching my head for a while – using php7.0-fpm and the latest nginx on Debian 8 Jessie I was seeing our PHP contact form working correctly but returning a Gateway 504 error upon submission, which was resulting in a great deal of resubmitted forms and error notifications from users.   This only started occuring after we moved our site to Digital Ocean – it turns out that it was a IP priority issue and the following resolved it:  
vim /etc/gai.conf
  and uncommenting the following line:  
precedence ::ffff:0:0/96  100

Then a reboot. Voila, the contact form worked properly again.

How to pass through a USB device to a Windows Virtualbox VM

Running a Mac with Windows running in a Virtualbox virtual machine? Here’s how to pass through a USB device so that whenever the VM (Virtual Machine) is running and the USB device is plugged into a USB port it appears in the Windows VM and not in Mac OS X. Open up Virtualbox and make sure that the Windows VM is not running:   screen-shot-2016-09-18-at-10-55-51-pm   Click on “Settings” at the top and you should see this screen:   screen-shot-2016-09-18-at-10-56-07-pm   Click on “Ports” (third from the right hand side in the icon menu at the top):   screen-shot-2016-09-18-at-10-56-19-pm   It defaults to Serial – click on USB:   screen-shot-2016-09-18-at-10-56-26-pm   Nobody wants to be using USB 1.1 (slow) so click on USB 2.0:   screen-shot-2016-09-18-at-11-04-01-pm   Then plug in your USB device that you want to pass through. In a nutshell, we will be setting up the specific USB devices we select on this screen to be passed through to the Windows VM whenever they are plugged in while the VM is powered on. If the virtual machine is closed down when you plug in the USB device the normal Mac OS X system will read the USB device as usual.   Click on the icon on the right that has a little green plus and you should see a listing of USB devices that are eligible for passthrough:   screen-shot-2016-09-18-at-10-59-16-pm   In this instance we are selecting the SanDisk Cruzer Blade. Click on it.   screen-shot-2016-09-18-at-10-59-27-pm   Now you should see it listed under “USB Device Filters”. The USB controller has been moved to USB 3.0 in the above screen shot – ignore that, as USB 3.0 currently does not work on Windows 7 VMs. Click OK, and go back to the main Virtualbox screen. Safely remove the USB device from your computer and then start the Windows virtual machine.   screen-shot-2016-09-18-at-11-04-40-pm   If you have only just selected USB 2.0 for the first time you will probably see the above screen. Otherwise, you can now plug your USB device in:   screen-shot-2016-09-18-at-11-05-12-pm   …and it should be picked up as if it were plugged into a physical Windows computer:   screen-shot-2016-09-18-at-11-05-21-pm   All done. Now, if you look in Finder in Mac OS X you won’t see the drive:   screen-shot-2016-09-18-at-11-05-42-pm   Closing down the VM, though, and unplugging/reinserting the drive will make it show up as normal:   screen-shot-2016-09-18-at-11-06-16-pm   In the above screen shot it is appearing as “NO NAME”.   All done! Incidentally, if you want a USB thumbdrive to work in both Windows and OS X you want it formatted into FAT32 or ExFAT rather than NTFS or Mac OS X Extended.   If you wish to remove the USB device from the passthrough list, click on the USB device in the list and then click on the little red minus sign on the right hand side.

Owncloud Nine: How to reset the admin password

Well, about ten minutes after installing the new Owncloud Nine we found out that we had typo’d the admin password. Fortunately, it’s an easy fix. Run the following (this worked on Debian with a fresh Owncloud 9 install):  
cd /path/to/owncloud sudo -u webserveruser php occ user:resetpassword adminaccountname
  In our case the command was:  
cd /var/www/cloud sudo -u www-data php occ user:resetpassword admin
  It should prompt you for your password twice:  
Owncloud Nine - How to reset the admin password
Owncloud Nine – How to reset the admin password
  Assuming there are no more typos, that’s all done!