Bogiecom.com
  • About
  • Magento
  • Sitecore
  • WordPress

Category Archives: Wordpress

Quick Way to Archive a WordPress Site

Posted on December 16, 2013 by bc-admin

So if you need a quick way to archive your WordPress install and you have shell access through SSH, this script could help you do that quickly.  You will need to make sure that ‘zip’ is installed (of course you could also modify the script below to use something like gzip or bz2 or whatever).

So the steps to getting this to work are:

  1. Upload the script below to the server as “wordpress-arch.sh”
  2. Make it executable by running “chmod +x wordpress-arch.sh”
  3. Execute the script by running “./wordpress-arch.sh” or “/bin/sh /path/to/script/wordpress-arch.sh”
  4. Specify a file name without the zip extension
  5. Then provide the full path to the WordPress root folder

The script will then copy all of the existing files to a directory with the same name as the file name you specified.  Next it will find the wp-config.php and find the database connection info.  Then runs mysqldump and saves a .sql to the root of the copied files. Zips up that directory to a zip archive in the same directory the script was executed from, and deletes the copy of the wordpress installation.

Some assumptions it makes is that you want to put the database dump in the root of the archive, and that you want to clean out your database username and password before passing it to someone else for install.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# !bin/bash
# wordpress-arch.sh
# run 'chmod +x wordpress-arch.sh' to allow for execution
# execute by running './wordpress-arch.sh' or '/bin/sh wordpress-arch.sh'
 
# get unknown info
read -p "Enter final archive file name without the extension (.zip) " archPath
read -e -p "Enter the full path to the root of the wordpress installation " indir
 
# find database information
WPDBNAME=`cat $indir/wp-config.php | grep DB_NAME | cut -d \' -f 4`
WPDBUSER=`cat $indir/wp-config.php | grep DB_USER | cut -d \' -f 4`
WPDBPASS=`cat $indir/wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
 
# echo the Wordpress config info
echo "Found this database information"
echo "DBNAME $WPDBNAME"
echo "DBUSER $WPDBUSER"
echo "DBPASS $WPDBPASS"
 
# make a new directory for the migration
mkdir $archPath
 
# copy all of the files to a new directory
cp -rfv $indir/* $archPath
 
# dump database using the found wordpress database settings
mysqldump -u$WPDBUSER -p$WPDBPASS $WPDBNAME > "$archPath/$WPDBNAME.sql"
 
# get rid of Wordpress Database User & Password before zipping to archive
sed -ie "s/$WPDBUSER//gI" $archPath/wp-config.php
sed -ie "s/$WPDBPASS//gI" $archPath/wp-config.php
 
# zip up all of the files
zip -r "$archPath.zip" $archPath
 
# remove the copied files
rm -rf $archPath

I know, I know… pretty basic. However, it’s something I needed, and maybe just maybe someone else does as well. I might change this up to make it an automated migration script that could deploy to a remote server, install all of the files, import the database, and setup an Apache host. But for now, this is all I need. 🙂

Posted in Bash, Linux, Shell Scripting, Wordpress |

Magento and WordPress Integration – A Couple of Options

Posted on September 8, 2009 by bc-admin

Lately, there certainly has been a lot of buzz around the thought of combining WordPress and Magento.  If you enjoy using WordPress for your CMS, but want to use Magento as your E-Commerce platform here are some options for you.

Lucky for most Magento users, there is an extension that will integrate Magento and WordPress with minimal effort. You may find the extension as well as the installation instructions here: Lazzymonks WordPress Integration 2.61

Personally, the extension did not offer what I was looking for, which was control over the SEO permalinks function in WordPress.  However, in the future the Lazzymonks extension may offer the ability to pick whatever permalinks setting you want in WordPress. 

So, where I started was at the following tutorial: Tutorial: Integrating 3rd Party CMS Content Within Magento. 

The tutorial was originally written for Expression Engine, but could be used for any CMS, including WordPress.  I was able to successfully integrate Magento and WordPress starting with the tutorial above.  However, there were some additional changes that had to be incorporated to meet the needs of my organization.

For one, I needed to make sure the RSS feeds out of WordPress could be easily viewed from the integration.  With the default integration above, this was not necessarily possible depending upon your site’s folder structure.  However, with a few lines of code, I was able to easily navigate from the header links generated by WordPress.

Another issue was the WordPress header information.  This required editing the Magento template to accomodate for the WordPress header information.  Most importantly for me, I wanted the WordPress page title to be the title of the Magento page.  This was possible by altering the Magento page template that would house the WordPress section of the website by excluding the title tags. At this point the WordPress title would begin to show up in the browser.

Then lastly, I had to find a WordPress template to fit the Magento template. Then edit the WordPress template until it looked good inside Magento.

And that was it.  Not so bad.  I’m sure there are some more/better possibilites on how to integrate WordPress and Magento, but for the time being this has worked for me.

Posted in Integration, Magento, Magento Third Party CMS Integration, Wordpress | Leave a comment |

Pages

  • About
  • Magento
  • Sitecore
  • WordPress

Archives

  • January 2017
  • December 2013
  • November 2013
  • February 2013
  • January 2013
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • November 2011
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • September 2009

Categories

  • .NET
  • Air Force
  • Apache Configuration
  • Bash
  • C#
  • Comma-Delimited
  • Custom Field Validator
  • Date Format
  • Dump Files
  • Files
  • Grep
  • Grooveshark
  • HTML
  • Image Resizing
  • Imagick
  • Integration
  • jQuery
  • Konami Code
  • Linux
  • Magento
  • Magento Third Party CMS Integration
  • Mini Shuttle
  • Miva Merchant 5.5
  • MySQL
  • PHP
  • Powershell
  • Regular Expressions
  • Rename-Item
  • Sed
  • Shell Scripting
  • Sitecore
  • Strings
  • Uncategorized
  • Updating Product Attributes
  • Video Games
  • Wordpress
  • X-37
  • XML
  • YUI Konami Event

CyberChimps WordPress Themes

© 2008 - 2016 Bogiecom.com