BackupBuddy Wordfence Conflict

Had a BackupBuddy Wordfence conflict the other day. I noticed in the BackupBuddy logs that BackupBuddy failed to make a backup as it tried to backup the Wordfence tmp file while that was being used by Wordfence. And therefore it failed.

Calling BackupBuddy..

I contacted BackBuddy support. They responded quite quickly as they always do. Love that and love BackupBuddy for making complete backups and taking care of migrations. Just like I love Wordfence for taking care of my sites’ security.

Site to Site Solution

To deal with this you need to excluded the directory for all file and complete backups:

/wp-content/plugins/wordfence/tmp/

in BackupBuddy under general settings > Default excluded files & directories (relative to WordPress root):

BackupBuddy File and Directory Defaults

 

That way that directory will always be ignored / excluded. Did use directory exclusion on BackupBuddy before the exclude certain error logs, backup directories. I also excluded some tables like Slimstat tables as they can get really big if you intend on keeping data for a year or more.

Database Defaults Settings BackupBuddy:

BackupBuddy Database Defaults

This was the first time I bumped into a specific BackupBuddy Wordfence conflict though.

TMP in Plugin Directory?

In my correspondence with BackupBuddy they stated that:

Plugins really should not create temporary directories/data under their own plugin installation directory but Wordfence tends to play by its own rules 🙂

Whether a plugin author should place a tmp folder in the plugin directory or in the webroot is a discussion I would love to have. I think it is OK to have it in the plugin root. I love to keep the webroot clean and avoid conflicts with other plugins. Would love to hear what other people think about this.

Permanent Solution

You would think that BackupBuddy – commercial WordPress plugin for backups – would make sure it would work well with the most populair Freemium Security plugin out there. Even though iThemes have their own commercial Security plugin they should still play nice with others out there, shouldn’t they? Especially if the other party is populair and has a free version.

But that is my opinion. I will not leave either plugin any time soon. Would however love to have this conflict out of the way and not being forced to add this exclusion to every WordPress site I work on.

What do you think?

If you have an opinion on the location of the tmp directory for plugins or have questions on the blog post do let me know. Would love to hear about it all!

 

Update Feedback BackupBuddy

Quite happy to discuss tmp file locations, but under a plugin installation directory is not a location to use as you cannot rely on write access. Here is the code from WF related to this:

private static function getCacheFile(){
    return WORDFENCE_PATH . 'tmp/configCache.php';
}

and this simply will not yield a usable file if there is no write access. WordPress provides a specific function to yield a (base) temporary directory location which also allows the user to set their own temporary directory and a plugin might then create their own subdirectory for their own use – this allows the user to control where theywant temporary files to go and makes it simpler for all such temporary data to be excluded from a backup by simply excluding that directory. Of course a user can define this to be outside the installation directory provided PHP has access to it (it doesn’t need to be externally accessible).

Would be nice though if BB would play nice with Wordfence – very populair security plugin – without using this directory
exclusion solution.

Yes, it certainly would be good if the Wordfence developers gave a little more thought to their design decisions and the impact they are going to have on their users. WordPress is a largely “uncontrolled” ecosystem and it relies upon developers thinking in a wider context than just their product and sadly with Wordfence this is not an isolated case.

WordFence’s Take

I have had no feedback from WordFence yet. Must say that I do feel that BackupBuddy seems to be having a point here..

  1.  BackupBuddy is an awesome WordPress backup plugin
  2. Wordfence is the best freemium security WordPress plugin out there

Trellis and Sequel Pro for OSX

If you are working with Trellis LEMP Stack on a Mac to create beautiful and professional WordPress themes on blazing fast and secure servers you are bound to wind up needing to manipulate the database. Many developers are used to PHPMyAdmin. Well, you should not install it and it has not been installed on Trellis. Install Sequel Pro instead on your Mac instead. With Trellis and Sequel Pro you will manipulate databases with ease.

Sequel Pro

Sequel Pro is a great GUI program that you can use to connect to your local and remote server’s database server. It is very versatile. You can use it to connect to database servers anywhere instead of just locally on one box. And as Trellis is a smart LEMP stack they decided they did not need PHPMyAdmin as they could approach any box using Sequel Pro.

Let’s discuss here how you can make a connection locally.

Trellis and Sequel Pro

As you know Trellis runs on a custom Vagrant box, preferably on VirtualBox. And so you can access the box using ssh vagrant. It will then allow you to access the box with your own ssh key. When you want to connect to the database using SSH tunneling you need to add several details.

Click the ssh tab after you clicked to add another favorite or chose another connection from the menu. Then add the following details. You can leave open the others:

  • mysql host: 127.0.0.1
  • username: root
  • password: password as entered in vault.yml
  • ssh host: 127.0.0.1
  • ssh user: vagrant
  • ssh key: under yoursite.com > .vagrant > machines > default > virtualbox > private_key
  • ssh port: 2222

The port is here not 22, but 2222 and you should locate the key clicking the blue key at the path I indicated above. Other details are not to hard to understand though you may pick the local network ip on your box instead of the localhost 127.0.0.1 . And well, that would not work either as you SSH tunnel your way in in this case.

You should now be able to connect. See here screenshot below:

Sequel Pro

You can do a test or save and connect right away. It will not load the database right away. You will need to choose it from the top left dropdown menu stating choose “Choose Database..” I did test and then saved and then connected. That is the best way really.

And then you will be connected. Trellis and Sequel Pro are working hand it hand as they should be. You can then start adjusting database data, import, export and so on.

Known Hosts Issues

Sometimes your known hosts setup has changed and then you won’t be able to connect. Sequel Pro error message may not be clear in console as you need to scroll to see it. Do scroll. It will tell you if that is the case or not. Make sure to edit the known hosts file and to remove the offending line using nano or another editing tool. For OSX users:

nano /Users/your-user/.ssh/known_hosts

Once opened remove the line and then try again.

NBB For Windows users I refer to MySQL Workbench

 

WordPress Site Migration – Case study

I have taken care of a lot of WordPress site migrations or movals over the years. A WordPress Site Migration is therefore nothing new to me. People move their website because they get more traffic, need more flexibility or because they are unhappy with their hosting provider. Or all of the above of course. I thought it would be interesting to tell the story of one of the latest ones as a case study. I recently took care of  migration of the Bakfiets en Meer WordPress website. Let me tell you how such a migration or moval takes place. You will see it does not have to be a scary of frustrating thing like the folks in the image seems to have deal with.

Client Case – Bakfiets en Meer Cycling Blog

 

Bakfiets en Meer

Bakfiets en Meer is a blog run by Henry Cutler, the owner of WorkCycles. He mainly writes about City Cycling, Amsterdam and WorkCycles or other bikes. Alle the things he is passionate about. It had been running pretty well the last couple of years with Webreus.nl in the Netherlands and had been getting a decent amount of traffic too. Many people love reading Henry’s personal blogs on cargo bikes or bakfietsen and everything surrounding it.

Reasons for Migration

For the last couple of months we have been having too many server issues. This due to issues with traffic and attacks on the shared server . But also due to issues with the site being to big for the package we were paying for. We wound up having not enough space to add more files and uploading even caused  certain files to disappear on us on an attempt to overwrite them as we were already over our limit! And when we realized the Antagonist (Dutch hoster) offered a better and cheaper package including great service we decided to move the site.

Preparation

First we made a backup of all the files and the database. This can be done with a plugin like Backup Buddy which is one of our favorite tools for backing up and migrating sites. However my partner Doede and I decided to do it all the old fashioned way this time using PHPMyAdmin and FTP.

When you do backup with FTP do make sure that all files are backed up and uploaded to the new location. Sometimes some files do not come along the first time around. We highly recommend the open source FTP program Filezilla to do all the heavy lifting.

As for PHPMyAdmin, well most hosters have it installed for you and is basically a GUI to manipulate your database:import data, export data, remove data, add tables, optimize data and so on. Normally the hoster allows you to access it from their control panel. This is the case in CPanel and Plesk as it is in most control panels.

Files and Database Migration

Once you have all the files on your PC you can start moving them to the new server. If the domain name has not been migrated yet, and as we of course want the site to work before we do that is the case, you need to upload all the files and import the database.  Uploading via FTP can be done using the username and password and ip address you have been given by the hoster. this way you can still upload without having the option to use the domain name.

NB If you do change domain names there will be database changes that need to be made as well as possible .htaccess changes. For database changes in case you moved without using a plugin like BackupBuddy, use Search and Replace by Interconnect/it

Local Testing

If the moval is not too complicated you can do it all on the remote server or final destination. But if more work is to be done it is always quicker to work locally. This can be done using a VirtualBox with Vagrant or a Trellis package or using more automated packages such  MAMP or WAMP . There is of course DIY using the built in tools on your box. I find Trellis to work well.

In this case a direct migration to the new server was an OK option so we went for that. This as nothing changed, but the hoster. No domain name changes, no webserver or database changes. Just a bare bone migration.

Remote Testing

Most hosters offer an option to test the site before you migrate the domain. Sometimes it means changing the Hosts file on your own PC or Mac to access it via IP.

Hosters File Change

For unix systems like my Mac the file is under /etc/hosts. For Windows 7+ is is under %systemroot%\system32\drivers\etc\ . See Helpdeskgeek article on Windows hosts file. In the past moving the same site from Villa to Webreus I had to use this trick by adding the new ip with domain name to this hosts file:

xxx.xxx.xxx.xxx bakfiets-en-meer.nl www.bakfiets-en-meer.nl

Domain name x-ed out here for security reasons.

This will load the site from the new location using the domain. And this will then of course only be the case for you. If your client wants to see changes this way as well you will have to ask him to make the same changes on his computer.

Once you have moved the actual domain you can comment out the line or remove it.

Site Testing Service

Sometimes the hoster has a domain service for it. The Antagonist does.  Using their alvast online (online beforehand) service you can preview the site before you move the domain.  And then you do not need to use the above mentioned trick, which is a nice service on the part of the hoster!

It is really vital to test using the domain on the final destination, especially when you have to make database changes due to domain name changes. Then you can test whether all pages and posts load well after you saved or made the new changes

Maintenance Mode

Also when you do do all the testing online, do remember all can access the site unless you use maintenance mode to give only a limited amount of people access.

Domain Name Migration

To move the domain to the new hoster, which we wanted in this case, you need the authorization token or epp code ( transfer secret) from the old hoster to authorize the new hoster’s DNS server to take over this responsibility. This is at least the case for most TLDs. See this extensive NameCheap article What is an Auth/EPP code? for more information on epp. I quote:

You’ll need an Auth Code to transfer a domain from one registrar to another. Specifically, Auth/EPP codes are required for .com, .net, .org, .us, .biz, .info, .me, .co, .io, .ca, .tv, .in, .mobi, .cc, .pe, .com.pe, .net.pe, .org.pe, and.tech domain transfers.

NB For Dutch .nl domains you need the authorization code or verhuistoken too. See SIDN article Domeinnaam verhuizen

DNS Propagation

Once we had taken care of this all we only had to wait a little while for the domain name transfer to propagate. That means it takes time before all or most domain name servers or DNS servers worldwide know about the moval of the site. So some servers might send visitors to the old server or old site location. This can take up to 24 hours, but in most cases it is a done deal within 4-6 hrs.

WordPress Site Migration : Finito!

So there you have it, a standard WordPress Site Migration taken care off. As you can see not too hard. But if you do run into issues, as we did as you can see in the following chapter, and you cannot solve them, do not hesitate to contact me!

Issues

Most migrations have some issues:

  • sometimes there are small problems due to domain name changes,
  • or hosting size constraints,
  • sometimes the database import is tough due to table size or database size ,
  • PHP or MySQL version changes and causes issues,
  • Moval to new web server with different configuration rules like an Apache > NGINX switch
  • and sometimes the character settings of the server are different.

The main issues we had in during this WordPress Site Migration case was access issues to both core accounts for domain transfer and the display of Flickr photos in the sidebar.

Domain Transfer issues

The new hosting account was set up quickly, but the project delayed and email with access details to Antagonist core account not sent through properly. The other issue was access to the old hoster’s account. These issues caused a delay as we could not pass on the authorization code. That is why it is always important to keep a project up and running and avoid delays as much as possible. But well, sometimes they cannot be avoided.

Flickr Widget Issues

Quick Flickr Widget was no longer working so moved onto Slickr Flickr and needed the ID of my client’s Flickr account, which I was able to get at IDgettr . Do display more than 20 images you need an API key was well though so I got that through his account as well. Finally there were display issues as the flickr gallery widget did not display the images as they had been before. So had to add some CSS voodoo as well.

However, due to the limited functionality display wise of the plugins and Flickr plugins in general out there we decided to leave it out for now. Just could not display images of a decent size, all cropped to the same dimensions opening the photo in a new tab at Flickr when clicked on.

What we did in the end was adding a catchy title followed by the Flickr log. On clicking the logo you will go to the client’s Flickr page to see more great bike stuff!

[gravityform id=”9″ title=”true” description=”true”]

Jetpack and WPML Do not Play Well Together

There are some nagging Jetpack WPML issues, really. Been using Jetpack for many things, but stats and auto posting to social media are one of my favorites. For translating and managing my bilingual site I have been using WPML. The best one of its kind. Unfortunately the two do not work well together.  This in the field of displaying statistics and the translation of Jetpack elements anyways.

Allow me to briefly introduce the two plugins and then get to the issues at hand.

Jetpack

Jetpack is a great free plugin created by Automattic and used at WordPress.com where it is integrated and on WordPress.org sites with the help of a plugin. You can upgrade to a paid version to add additional features like Akismet anti-spam plus and things like backups, but the free version does take care of most of the needs I and my clients have.

Jetpack

It is great for:

  • checking for site uptime,
  • automattic posting to social media,
  • basic statistics using Jetpack
  • protection against brute force attacks
  • collecting subscriptions

to name a few of the free features.

One of my favorites, Jetpack Stats, is a great way to have a snapshot overview of how your WordPress site is doing. Not too bloated.

Jetpack Stats by day

Just a clean way to see what pages and posts have been visited, how many unique visitors and views, where the visitors are from, what referral links were used. Just the basics.

WPML

WPML

WPML is a state of the art language management tool for WordPress sites. It allows you to manage bilingual or multilingual sites with ease. Whether you work alone or with a team, it is an outstanding tool to translate content, create multilingual content and manage it all from one location using multiple domain names, subdomains or a separate directory for the secondary language(s). Here features as listed by them:

  • It’s complete – With WPML you can translate pages, posts, custom types, taxonomy, menus and even the theme’s texts.
  • It’s compatible – Every theme or plugin that uses WordPress API runs multilingual with WPML.
  • It’s dependable – We provide full support for WPML, helping you deliver perfect websites on time.

Jetpack Stats issues with WMPL

The issue I have been having is that every time I post a blog in Dutch Jetpack does not show it under insights though it does show as a square under posting activity. Therefore I cannot see how blog posts posted in Dutch fair once they have been published. As no ticket for this specific issues seems to have been filed except for not showing all post in secondary languages at Jetpack Stats I added a new one here.

Jetpack Subscription Translation Issues

Other issue, reported at WPML way back, is that Jetpack Subscriptions does not get translated well. The ticket is quite old now and has not been attended to. It is still not possible to translate the translation widget for display in other languages using WPML.

This is really the reason why I decided to write this blog posts on Jetpack and WPML. Seems the folks at WPML are really busy so perhaps keeping tabs on these issues here will help speed things up. Great products, Jetpack and WPML, so would love them to play well together again. Comments are welcome!