I'm having a little issue with a Wordpress site. What I want to do is to migrate all the posts/news from one installation to a new one, including it's images.
So what I did, apart from reading a lot of tutorials, was.
First Download the XML that contains all the info from the posts,
Second Uploaded the XML to the new site, it imported the posts, categories and authors with no problems, but with no images.
Third I transferred the images via FTP, to the same location, with no change in the names or anything. Also, the folder has all the permissions.
Fourth I read that after all this is done, it's necessary to do a MySQL change, related to the "post_content" where you should change the old domain, for the new. The change is made, but nothing happens, the images are still not visible.
So.. What could be the step that can be missing? Or did I made something wrong?
This post has the information related to the MySQL sentence to replace the "post_content" field.
Thanks in advance.
Related
I apologise in advance for I know that this question has been asked several times already, but being a complete beginner at wordpress coding and database handling, I am still not sure about what those answers really meant.
So having just coded a website and converted it into WordPress, I now find myself having to change all of the localhost strings to the accurate ones, but with hundreds to go through, I just wanted to know if any of you were able to recommend a program or technique within PHPMyAdmin (that I may not be aware of) to avoid having to change them one at a time.
Thank you all in advance for your time and attention.
First, let me start by saying this is very dangerous, especially for an absolute beginner such as yourself. Please use this with extreme caution as you can potentially bring the entire site down by replacing values in your database with the wrong data.
With that said, there is a script specifically designed for doing search and replace on the WordPress MySQL database. http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Here's the direct download link: https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
You will extract the folder from the donwloaded zip, then upload the folder to the root of your WordPress install. Once its uploaded just reference the folder in the browser. I always rename the folder to sr (shorthand for search and replace) so its easier to write out the full URL. So as an example, once its in the root of the WordPress install you'd access it like www.example.com/sr/.
After you access the script in the browser, you'll have a GUI with two boxes at the top. The first you'll enter the string you're searching for, and the replace string goes in the second box. Your MySQL details/login should already be populated. After entering your S&R terms scroll down and click "Update Details", then do the "Dry Run" option first. It'll run through the database and show you the values that will be changed. If you are satisfied with the changes, click "Live Run".
Depending on the database size it'll take just a short time to complete. This is the easiest way to S&R the WordPress database.
Important: for security reasons you'll want to delete this folder from your server after you have finished using it. You don't want a database S&R utility just lingering around for no reason.
Another possible option if you're familiar with WP-CLI is to use the wp search-replace command: https://developer.wordpress.org/cli/commands/search-replace/ This would be done through Terminal or another command line utility.
In phpMyAdmin open your table, choose Search > Find and replace. Then specify in which column you want to find and replace, and the original and replacement texts.
Without any doubt I would use http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
This tool is especially designed for the situation you describe.
You upload the code to your server and then enter the "find" and "replace"
You can then do a dry run and the system will show you all the replaces that will be made across every single table in your Wordpress database.
Once you're happy then you can do a live run and the changes are made.
I have used this on probably one hundred Wordpress sites and it works a charm.
I am trying to solve a problem for one of my clients webshops using magento v1.x, which was hacked a couple of days ago. They have removed all original payment options, and replaced it with their own credit card form. I have tried setting everything back trough the Magento webshop manager, but there all options are correct with the correct payment settings (we had a simular attack a long time ago, but then they simply changed the settings via the Magento Manager, so that was an easy fix back then).
I have tried recovering a backup of the webshop, loosing all items added after that (aprox 7k items, all with hand placed pictures, 3 per item), but even then only the credit card checkout remains on the website. After that I have tried copying the entire public_html folder from a working backup, direclty into the server, and again, only the credit card chechout remains.
Where can I start searching next if even replacing the entire public_html folder doesnt solve this problem? Can they be redirecting a part of the Magento code to their own?
All help is welcome!
First of all apply all Magento security patches. After that, check Payment options page in System >> Configuration. There is probably some extra payment method added there. If not, you should check the checkout url is it the default one (there might be some redirect added from your old site to hackers site. If it is the correct url, inspect element for credit card part, to find a piece of code that you could search for in the codebase or in database.
After that you should search all tables in the database for that string (that you inspected) - you can do that using search functionality in PhpMyAdmin easily.
After that search through the whole codebase for that string, to see where it is injected.
Hope that this will help you!
I had to make some changes on a Gambio shopsystem.
All changes I made were tested on a local server first and then pushed to the live server.
The problem now is, that most of the changes are applied correctly but one file really does not.
The one that does not work is in the path ./templates/shopname/module/product_listing/product_listing_v1.html
I only changed one html-tag in there.
Now to the things I have tried.
I uploaded it several times, so there is no chance at all, that it is not really there.
I cleared the folder ./cache/
I cleared the folder ./templates_c
I disabled the cache for the whole system
I made sure there is no fallback, so it is really only one file that should work
On the local server the changes I made worked immediately. On the live server, it did not work and the original html-tag is still there on the live server.
For some files in Gambio the software takes template files out of one table. In the backend of the shop it is possible to select the specific file from the folder
If there is more than one file which can be selected and there is no selected file, the system automaticly takes the last one by default.
There are 2 ways to solve the problem:
Delete all other possible duplicate files, like copys or other unused files.
This is the one I recommend.
You can select the template file you need for every product or category. That can be a real pain.
I know the "merge tables" question has already been asked in a variety of ways, but I can't seem to find an answer to my specific question.
Here's my deal: I've been designing a WordPress site for an organization for four weeks. When I began designing I took an export of the database and imported into my local development site. In the meantime, this organization has naturally continued to post things and receive/approve comments on their live site. On the local side, I have also created posts, edited pages, changed widgets, etc during development. So now that we're ready to launch the new site, I need to figure out how to merge these last four weeks of database changes from both the live site and the local site without losing anything on either side. How is this done?
If there have been inserts to both databases, then unfortunately there isn't a good way to merge. If your database contains the latest edits for the Post IDs that are shared then you can export them to XML and then import them into the other site.
This is done with the WordPress Importer plugin which can also be installed by visiting /wp-admin/import.php, the export can be done on /wp-admin/export.php. You can also remove any conflicts from the XML file manually, but make sure that you keep it well-formed.
I have seen many questions related to database migration, but none which clearly state: When editing a database which of the tables do I actually need to edit?
As a force of habit I edit the entire mySQL database, and usually that works out. (However on occasion this can mess up URL left in user comments for instance.) However it would be good to know specifically which tables I actually need to edit in order to complete a migration correctly.
EDIT: I already understand how a migration works and which tool to use, and I have read the codex entry on migration. I am not having a specific problem migrating.
This is really more of a best practices question.
What I am looking for is a definitive list of what tables I can exclude from my search and replace. For instance I know that the basic URL info is in wp_options, I know that (some) image paths are stored in wp_postmeta. Basically I want to exclude every table I possibly can, while still preserving the site's widgets, images, settings, etc.
The only references that HAVE to change are in the wp_options table. One is the home url and the other is the siteurl. These will allow you to log into the admin and view the frontend. However, you will still have to update your permalinks and rewrite rules using the admin.
I would still suggest an automated solution, however. I use this tool to find and replace database references. It is specifically made for wordpress, but it will work for any database. It also will allow you to select which tables to update and will work with serialized strings so you should be able to avoid errors in the comments section.
Simply drop the file on the root of your wordpress install and run through the prompts. Make sure to deselect the wp_comments and wp_commentmeta tables. Also, make sure you remove the file on production as it presents a potential security threat.
UPDATE BASED ON COMMENTS
Other than the two spots above, there are several places in the database that URLs are stored. Most plugins will store their options in the wp_options table. Typically, plugins will also serialize the data to avoid a ton of queries. You can't simply change the URL in the serialized data however, because there are length references in the serialized string. So if your current URL is 15 characters long and the new one is 20, you need to update the URL and the string length too. If you don't, PHP will just ignore the value. I believe this is a security measure to avoid code injection.
For assets in the media section the URLs are stored in the wp_posts under the post type attachment. If you are hardcoding absolute links in your posts, you may need to parse those as well (if this is the case, you can probably just parse the entire table). If you are using any sort of custom field plugin or doing anything with post meta for URLs you are also going to want to go through wp_postmeta.
One other thing to mention is that some plugins will add their own database tables. These are obviously on a per case basis, but a good rule of thumb is to try running a query for "%http%" in any string columns to see if there are hardcoded URLs. Here is the query I will use:
SELECT * FROM `table` WHERE `column` LIKE '%http%'
Download the file from the following link http://interconnectit.com/products/search-and-replace-for-wordpress-databases/.
Put it in the root folder and access the file and follow the steps and replace the urls.
I have been using it for quite a long time without any issues.
Hope it helps!
Thanks