Posts tagged WordPress
I’m currently trying to develop my own WordPress theme from scratch (called “Tengu” but be warned: at time of writing it’s nowhere near usable yet). And I encountered a rather odd bug: part of the
style.css file would get corrupted when viewing through the browser.
I am using PhpStorm on Windows and for live testing I use a virtual machine using Vagrant. On it I was using a plain, hardly modified installation of nginx to serve a WordPress test blog. As it turns out, by default nginx configuration turns the “sendfile” option on which usually makes sense, but sendfile apparently is extremely unreliable when used with remote file systems (in my case, VirtualBox extensions).
The quick solution: turn sendfile off during development (look for the appropriate line in
/etc/nginx/nginx.conf). Supposedly this also applies to Apache btw. The problem went away immediately when I did that.
A few years ago I wrote about keeping WordPress & phpMyAdmin up-to-date with a single command. While those methods still work it is time to make a few changes (and revive this blog while I’m at it, it has been too long).
First off, using Subversion to track stable versions might keep WordPress itself up-to-date (unless something breaks due to subtle changes in the repository as I found out with WordPress 4.1), it won’t do anything for your themes or plugins.
If you like to keep everything in WordPress up-to-date through the command line (instead of FTP, which I don’t even have installed) there now fortunately is a tool called wp-cli. Updating all plugins for example is as simple as:
wp plugin --all update
There is loads more it can do, see the wp-cli site for documentation of all commands and features.
Second, while the method of using git to update phpMyAdmin in my previous article wasn’t inaccurate, it was highly inefficient. The commands would first download the whole phpMyAdmin repository (including all branches and commit history) and then switch to tracking the stable branch. This was slow and wasted a lot of space.
So here are the updated commands:
git clone --depth=1 -b STABLE https://github.com/phpmyadmin/phpmyadmin.git git pull -q origin STABLE composer update --no-dev
With this we tell git that we want only the latest commit (depth flag) in the stable branch (b flag). This executes must faster and occupies only about 70 MB of space instead of nearly 500 MB. I recommend calling the git pull command from a cron job every day, so that your phpMyAdmin is always up-to-date.
Notice: see this follow-up post for better ways of keeping WordPress & phpMyAdmin up-to-date.
Keeping up-to-date with the latest versions of commonly used web software such as WordPress and phpMyAdmin can be a bit of a drag if you would have to manually download, unzip and upload new files through FTP each time a new version is released.
But keeping WordPress and phpMyAdmin up-to-date can be as simple as logging into your server with SSH and executing just a single command. The key to this is that these software are being developed using version control software like Subversion and Git. Not only developers can take advantage of this however; you as end-user can use them as well.
First you’ll need to install Subversion and/or Git of course. On Debian (and Ubuntu presumably) you can do this by simply running the following command (as root):
aptitude install subversion git-core
Once either or both have been installed, I can simply recommend the excellent Installing/Updating WordPress with Subversion article in the case of WordPress.
For phpMyAdmin you will need to following commands from the root directory where you would want to install phpMyAdmin in:
git clone https://github.com/phpmyadmin/phpmyadmin.git cd phpmyadmin/ git branch --track STABLE origin/STABLE git checkout STABLE git pull
In case of a new install don’t forget to copy “config.sample.inc.php” to “config.inc.php” and editing it where applicable (see the phpMyAdmin documentation for more info). To keep it up-to-date, then simply run the following command from the “phpmyadmin” folder whenever a new version is released:
This command should not overwrite custom files like the configuration file.
Update April 2012: it would appear phpMyAdmin has moved to GitHub, so the URL above has been updated.