Magento upgrade from 1.4, 1.5, 1.6, 1.7, or 1.8 to 1.9

NOTE: this upgrade process works the same way for Magento version 1.4, 1.5, 1.6, 1.7, 1.8, and 1.9

As many magento users will know, Magento is no fun to work with-- mainly due to poor community support (the developers help paying customers; i.e. Magento Enterprise ... Only payed support there... Great for business but bad for the average or beginning user...)

Anyhow...

So here's how we do it.

MAKE A BACKUP!

You can skip this step all together, however, please make a backup of everything prior to beginning the upgrade.

Create a test environment somewhere on your server (preferably away from your production installation)

Tags: how-to magento magento upgrade

How to set max_open_files in MariaDB / MySQL in CentOS 7

Set the system wide open file limit:

vi /etc/security/limits.conf

Change/Add the following:

* soft nofile 1024000
* hard nofile 1024000
* soft nproc 10240
* hard nproc 10240

Now do this for /etc/sysctl

vi /etc/sysctl

Add the following

fs.file-max = 1024000

Set the changes

sysctl -w fs.file-max=1024000
sysctl -p
# check changes
cat /proc/sys/fs/file-max

Set the mysqld.service limit (as settings here will override *.cnf ones)

Set both /etc/systemd/system.conf and /etc/systemd/user.conf

vi /etc/systemd/system.conf
vi /etc/systemd/user.conf

Add the following under [Manager] for both:

Tags: Linux mysql mariadb

How to install an SVN version of Apache using Directadmin Custombuild

This is a quick guide to help out those trying to install an NON-RELEASE version of apache. It was made due to intermittent crashes of apache 2.4.25 with HTTP2 on CentOS with DirectAdmin.

You can see the changelog here:

https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x/CHANGES

Here is the DirectAdmin discussion this was first reported on:

https://forum.directadmin.com/showthread.php?t=52590&page=3

Anyhow...

Here's the fix:

Tags: apache http2 DirectAdmin centos

Pinterest: How to exclude images from being pinned via jQuery.

Say you have Pinterest setup on your site to allow pinning or saving of images. However, you obviously don't want this enabled for all images (ex: menu images, footer images, etc).

Here's how to exclude certain images from being recognized by Pinterest:

In Magento, you would add the following to your local.xml, under <reference name="head">:

Tags: jquery pinterest magento

HOW-TO: create a Drupal views block to display the current node content

In views section, for an existing view or newly created one, do the following:

  1. Click "Add" > "Block"
  2. Fill in whatever you normally would do in views (this is beyond the scope of this tutorial)
  3. Under "Contextual Filters" > click "Add" >  "Content: Nid" > "Provide default value" > "Content ID from URL"

And that's that... 

Tags: Drupal Views

How to install HTTP/2 on DirectAdmin

Install OpenSSL with ALPN support

cd /usr/local/src/
wget ftp://ftp.openssl.org/source/openssl-1.0.2j.tar.gz
tar xzf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install

Install nghttp2 - HTTP/2 Library

cd /usr/local/directadmin/custombuild
./build update
./build nghttp2

​Install HTTP/2 for Apache 2.x

cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp -p configure/ap2/configure.apache custom/ap2/configure.apache
vi custom/ap2/configure.apache

### REPLACE "--with-ssl=/usr" \
### WITH:

        "--enable-http2" \
        "--enable-ssl-staticlib-deps" \
        "--with-ssl=/usr/local/lib_http2" \


### Rebuild apache

./build apache

### Add HTTP/2 settings to httpd-includes.conf
Tags: DirectAdmin Linux http2 http/2

MariaDb/MySQL how to fix Unknown/unsupported storage engine: InnoDB

If you changed /etc/my.cnf "innodb_log_file_size" setting, then may get this error:

 [ERROR] InnoDB: Unrecognized value JO_DIRECT for innodb_flush_method
 [ERROR] Plugin 'InnoDB' init function returned error.
 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

You probably tried the following fix:

rm /var/lib/mysql/ib_logfile0  
rm /var/lib/mysql/ib_logfile1

However, if you set innodb_log_file_size to something large like 2G,  and tried restarting mysqld, the startup will seem like it's taking FOREVER (and it does, compared to regular startup)... and you probably force quit the restart, thinking something is wrong.

htaccess redirect specific domains to https

Here's how to redirect ONLY specific domains to HTTPS with .htaccess.

RewriteEngine on

# Redirect all domains to use 'www.'

​RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect ONLY specific domains to HTTPS

RewriteCond %{HTTP_HOST} ^(www\.)?(domain1.com|domain2.com|domain3.net)$
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

What the above does is:

How to add Google Fonts to Drupal 8 theme, the PROPER way

Here's the proper way to add external google fonts.

NOTE: Important parts here are YOURTHEMENAME.info.yml and YOURTHEMENAME.libraries.yml

YOURTHEMENAME.info.yml


libraries:
- 'YOURTHEMENAME/fonts'

YOURTHEMENAME.libraries.yml


fonts:
css:
theme:
'//fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400,300,700|Open+Sans:300italic,400,300': { type: external, minified: true }

YOURTHEMENAME.info.yml

core: 8.x
type: theme
base theme: bootstrap

Drupal 8 drush critical update commands

There are some new drush Drupal 8 commands that are critical to updating your site. The big new one here, is "drush entitity-updates".  Which should be initiated AFTER "drush updb".

Otherwise, if you check your Drupal 8 "Status Report" you may get an error showing "Entity/field definitions: Mismatched entity and/or field definitions"--which won't be apparent, unless you check the Status Report.

So here goes... 

Clear all cashes (no longer "drush cc all"):

drush cr 

or 

drush cache-rebuild

Update the database (this is still the same, however, you won't be done here):

drush updb

After running "drush updb", you should next run entity updates command:

drush entup

or

Tags: Drupal drupal 8 drush

How to install OPCache using DirectAdmin custombuild

If you used custombuild to install opcache, then you will need to set the opcache settings there.

cd /usr/local/directadmin/custombuild
 vi options.conf

Change opcache=no to opcache=yes

opcache=yes

Set your opache settings here:

vi custom/opcache/opcache.ini

Here are my settings (This is for a fast server, with 128GB RAM):

Tags: Linux DirectAdmin custombuild opcache

Fix magento 1.9 price rules "Stop Further Rules Processing"

There's a bug affecting all magento 1.9 versions, that prevents users from applying multiple coupons to their order--even if "Stop further rules processing" is NOT selected.

Basically, a customer can only apply a single coupon to their order--no stacking of coupons works in Magento 1.9.

Here's the fix, you'll need modman and generate-modman installed:

Tags: magento

Easily manage magento extension installations with modman and generate-modman

Modman lets you install/uninstall magento extensions without the use of Magento Connect.

Why would you use modman?

Say you have an extension that doesn't use Magento Connect--where you upload it's contents manually. When you want to uninstall that extension, you have to tediously/manually search the installation files/folders and remove them by hand.

With modman, this is done for you perfectly--no more tedious labor.

Install modman

Let's first install modman.

1. Enable symlink support in magento: System > Configuration > Advanced > Developer , Under "Template Settings" > "Allow Symlinks" select "Yes"

2. Download and run the installer.

Tags: magento modman

Tighten SSL security: SSL certificate chain and SSLCipherSuite

Update SSLCipherSuite

Issue

Clicking the certificate info in chrome, you'll see a message:

"Your connection is encrypted using an obsolete cipher suite."

Solution

vi /etc/httpd/conf/extra/httpd-ssl.conf

Replace SSLCipherSuite with the following:

SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+AESGCM EECDH EDH+AESGCM EDH+aRSA HIGH !MEDIUM !LOW !aNULL !eNULL !LOW !RC4 !MD5 !EXP !PSK !SRP !DSS"

Restart Apache.

service httpd restart

Optional: Update ssl_cipher in directadmin.conf

vi /usr/local/directadmin/conf/directadmin.conf

Replace or add:

Tags: Server admin SSL DirectAdmin

Enable WHM SSH safemode if you lock yourself out

If you locked yourself out of SSH in WHM/Cpanel for whatever reason--e.g. you specified an invalid AllowUsers in /etc/ssh/sshd_config--you can reload SSH service in safemode, by pasting this into your browser's address bar:

https://YOURSERVER:2087/scripts2/doautofixer?autofix=safesshrestart

Then login with your root credentials, and sshd will be restarted in safemode, allowing you to login and fix your /etc/ssh/sshd_config.

Once done, restart ssh:

service sshd restart
Tags: Linux ssh

How to install Apache Solr 5.x for use with Drupal

Here's the updated version on how-to install Apache Solr 5.x and get it running with Drupal (WITHOUT Apache Tomcat; as Solr 5.x doesn't support Tomcat anymore).

Install Java 1.8

yum install java-1.8.0-openjdk.x86_64
# or
aptitude install java8-jdk

Create a symlink to wherever your /etc/bashrc or ~/.bashrc has

export JAVA_HOME=/usr/local/jdk

set to.

  
Tags: apache apache solr Drupal Server admin

HOW TO create a Gmail filter to automatically delete emails Older than X amount of days

Let's say you want to AUTOMATICALLY delete all "Promotional" emails from your Gmail after 90 days.

Step 1:

Go to Settings -> Filters -> Create a new filter

Step 2:

Type the following into "Has the words" field:

category:promotions older_than:90d

Step 3:

Click "Create filter with this search"

Step 4:

Select "Delete it" and finally click "Create filter" button... 

And... we're done!

The key here is older_than:90d, you can just as easily create whatever time-based filter you want with that.

Tags: gmail email

How to move an account from DirectAdmin to WHM/cPanel

If you tried using WHM's Transfer Tool on very large sites, you've probably got a timeout error.

To fix this, we'll need to do this through SSH (via root) what the Transfer Tools wasn't able to do itself.

STEP 1.

The Transfer Tool will create a /scripts directory--with all required scripts--at the base of your server, which we will use to create WHM/cPanel compatible backups.

The name of the script will look like the following: /scripts/pkgacct.YOUR_CPANEL_SERVER_NAME

Type the following to get the exact name:

ls -la /scripts/

STEP 2.
Next, go into your /home directory to get a listing of the account names.

Tags: Server Linux cpanel DirectAdmin transfer

How to mass delete ALL twitter users you are following via Google Chrome

Step 1.

In Google Chrome, go to https://twitter.com/following

Step 2.

For PC hit Ctrl + Shift + J 
For Mac hit Cmd + Opt + J

Step 3.

Paste this code into the chrome console, hit enter, and wait for it to finish:

setInterval(
function()
{
	t=$(".Grid .Grid--withGutter").find(".user-actions-follow-button");
	for(i=0;true;i++)
	{
		if(i>=t.length)
		    {
			window.scrollTo(0,$(document).height());
			return
			}
			$(t[i]).trigger("click").remove()
	}
}
,2000
)
Tags: twitter

Drupal remove deleted fields from database

Install and enable Field SQL norevisions, and use it to delete any revisions you don't need. Also set it to disable revisions for content/entity types that you don't want revisions being made.

Note: For entity content types, drupal will automatically make revisions for each update, but won't allow you to revert to any of these revisions, so this is pretty pointless; plus for very large databases this can degrade performance.

Tags: Drupal drush

How to diagnose slow mysql performance

If you're experiencing slow mysql performance--top showing mysqld high cpu usage. This command will help you track down what's going on at that specific time.

mysql -e "show processlist"

Of course you should also check your log files:

/var/lib/mysql/mysql-slow.log
/var/lib/mysql/mysql-error.log

You'll also want to optimize your /etc/my.cnf: For a pretty good quick start, you can use this tool, Percona Configuration Wizard for MySQL

Tags: mysql Server Linux

How to install drush on Godaddy cPanel hosting

If you're using godaddy cpanel hosting, you have 2 options of installing drush

1. drush version from drupal (which is NOT being updated anymore--unlike the latest github version).

or 2. (Preferred) Install the latest github version:

Go here to view instructions on how to install the latest version of drush from github.

cd ~
wget http://ftp.drupal.org/files/projects/drush-7.x-5.9.tar.gz
tar xvf drush-7.x-5.9.tar.gz 

Now we add the drush paths to our .bash_profile.

vi .bash_profile 

Paste the following in toward the top:

Tags: cpanel godaddy drush Linux

How to convert database from innodb to InnoDB in phpMyAdmin?

In phpMyAdmin, click the "SQL" tab and paste the following in there--changing your_database to the actual database you want to change.

SET @DATABASE_NAME = 'your_database';

SELECT  CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM    information_schema.tables AS tb
WHERE   table_schema = @DATABASE_NAME
AND     `ENGINE` = 'innodb'
AND     `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;

Or if that doesn't work, do the following under SSH (change your_database to your actual database name)

Tags: mysql Server admin

How to check if your drupal site was hacked (and how to fix it)

Install drupalgeddon on your server:

drush dl drupalgeddon

Install Site Audit:

drush dl site_audit --dev

Install Hacked:

drush dl hacked --dev; drush en hacked -y

Install Security Review:

drush en security_review -y

OPTIONAL: run all the above in a single line.

drush dl drupalgeddon -y; drush dl site_audit --dev -y; drush dl hacked --dev -y; drush en hacked -y; drush en security_review -y

Run the drupalgeddon site audit--this will also run the above modules--this will create a file called 'report.html'. Open it up and see what's up.

Tags: Drupal hack security drupalgeddon

How to install and use Malware Linux Detect (Maldet)

How to install Maldet

cd /usr/local/src/
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -xzf maldetect-current.tar.gz
cd maldetect-*
sh ./install.sh or sudo sh ./install.sh 

Now enable email_alert and add your email address to email_addr /usr/local/maldetect/conf.maldet

vi /usr/local/maldetect/conf.maldet 
#change to the following:
email_alert=1
email_addr="[email protected]"

How to update maldet

maldet --update-ver
maldet --update

How to manually scan with maldet:

maldet -a /home

Or:

maldet /home?/?/domains/?/public_html

Or in background:

Tags: maldet Linux malware

Drupal Drealty How to fix Active Properties Set to 'active=0'

Sometimes drealty doesn't properly set RETS status properties marked as "Active", "Pending Sale", or "Backup Offer" as 'active=1'. Any property marked as 'active=0' will NOT display, no matter what 'rets_status' is marked as.

We can fix that by running this SQL query in phpMyAdmin:

UPDATE `drealty_listing` SET `active`='1'
WHERE `rets_status`='Active' or `rets_status`='Pending Sale' or `rets_status`='Backup Offer' ;
Tags: Drupal drealty

Magento Mega Menu: Responsive Custom Menu MOD

Magento Mega Menu : Responsive Custom Menu MOD

Here is a modded Responsive Custom Menu I just did, adding named menu classes and positioning the custom block element above the menu items.

Why?

Original menu didn't have any unique class identifiers for menu items--it was partially unique, but nothing you can actually use to style any individual menu item.  Also I thought it made sense to have the custom block ABOVE the menu listing. After all, any custom element you want to show is likely going to be more important than the regular menu listing.

If you're interested in this, then simply download the attached Navigation.php or copy/paste over the following app/code/commmunity/WP/CustomMenu/Block/Navigation.php: