WordPress FTP prompt for Upgrade or Update

There are a lot of posts around about the FTP prompt when preparing an upgrade and all (almost all) reference the same information which is to enter specific settings in the wp-config.php file for the FTP site, username, & password.

Alternatively, I prefer this option which allows the admin user with the correct permissions to avoid the FTP aspect altogether.

In the same wp-config.php file in the WordPress root, around line 10 it will look like this:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/

// ** MySQL settings – You can get this info from your web host ** //
[/php]

Just insert a few lines and add the 3 DEFINE lines as per the example below:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
define(‘FS_METHOD’, ‘direct’);
define( ‘FS_CHMOD_DIR’, 0775 ); // change these settings to match your apache account
define( ‘FS_CHMOD_FILE’, 0664 ); // change these settings to match your apache account

// ** MySQL settings – You can get this info from your web host ** //
[/php]

The key is the CHMOD entries. In my case the cpanel / WHM server is configured for the apache account to act as the group controller of the files. So to upload and modify files in the Worpress directory it needs write permissions as group not owner.

osCmax 2.5 thumbnail images not showing after upload case sensitive on Linux

The issue here was that loading some images as extra’s were not appearing as thumbnails in the product display. At least some of them were not. The key was that the ones that worked had a lower case file extension and the ones that did not had upper letters. i.e. .jpg and .JPG

I tracked this to being that the Dynamic Mopics for extra product images is case sensitive. Loading an image from another system (Windows perhaps?) with an upper case .JPG extension will not display the thumbnail without specifying the upper case extension in the admin settings for Dynamic Mopics which has all lower case extensions by default.

Using the default installation admin settings. Load a main product image and an extra jpg type file image with the extension as uppercase .JPG
Using the catalog user view inspect the product and there are no thumbnails displayed.
Modify the admin setting to include JPG (as distinct from jpg) in the viewable formats and the images display.

A simple fix is to force lower case extensions for all image uploads. This is a simple change.

Edit the file catalogadminincludesmodulesproduct_image_upload.php

line 23
[text] $ext = substr(strrchr($main_image, ‘.’), 0);[/text]
becomes
[text] $ext = strtolower(substr(strrchr($main_image, ‘.’), 0));[/text]
(adding the additional function as a wrapper, do not forget the closing parenthesis)

Updating an existing database is also relatively simple in phpMyAdmin or similar select the products table and run the following:
[text]UPDATE products SET products_image = REPLACE(products_image, ‘.JPG’,’.jpg’);[/text]

if the user wants to test the impact of this first display the table with the changes with:
[text]SELECT `products_id`, REPLACE(products_image, ‘.JPG’,’.jpg’) AS ‘products_image’ FROM products;[/text]

Rsync and SSH connections

I’ve been annoyed by a message when scripting my rsync backups for some time now.

“stdin: is not a tty”

which I spent a while trying to sort out today.

Turns out that it is associated with the setup of the shell on the servers where I manage some hosted sites.

In my rsync commands I have embedded the ssh commands and adding -q(quiet) to make the messages go away makes no difference. Adding a -t for tty setting makes no difference and adding -T is ineffective as well.

Hmm, according to the SSH syntax, repeating the -t may work.  Yep, it does.

ssh -qtt will suppress the message about the tty!

Except, that I now get an error “tcgetattr: Invalid argument” which is triggered apparently by the second ‘t’.

I’ve left it. I now get my logs of the rsync transactions that I was not getting with the tty error message and the other error does not impact anything that I can see.

WordPress and child page listing

Sometimes I want a listing of the child pages to be embedded in the text of a page. This could be done manually but then maintenance of the site is a nightmare (unless it is a really static site!)

So adding the following code into the relevant page template for the WordPress site works a treat.

[php]
<?php
$children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&echo=0′);
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
[/php]

While it is not a rule, this related page listing is probably going to appear underneath any of the page text content, so look for the following in the page template and place the child page code below this line.

[php]
<?php the_content(); ?>
[/php]