Export Drupal Content? - drupal

I want to know what is the easiest way to export ALL content of a specific user in Drupal, by only making use of the database. Is this even possible?
Reason being, I moved a site, and now clients created content on the old server, unknowingly, and I need to move it to the new server. Unfortunately, the site can't be accessed anymore (due to the move) so I only have access to the database.
Should I perhaps look at finding a way to maket the isntallation accessible and then using an export mdoule, or is there an easy way to export using PHPMyAdmin?

Ouch
You could take the db and set it up on a sandbox somewhere, which would give you access to see what changed. Genrally if you have access to a DB (and know which version of drupal and modules you had), you can run a drupal site from it.
In an earlier question I suggested the migrate module for getting content from one drupal db to another, I think that appies here. If you can't get another code base to look at the old DB.

Instead of trying to pinpoint the content that a specific user has created, it will probably be a lot easier to get the stuff you need based on the datetime. But it really depends what kind of content that have been created. If it's just nodes, it should be fairly simple to load the nodes from the one database and save it to the other.
Another thing worth mentioning is that Drupal support having more than one database in your settings. You can relatively change the db connection if they are of the same type (e.g. MYSQL). See the db_set_active function.
You can also try to make use of the migrate modules like Jeremy suggested, which way to go depends a bit on how well your Drupal/PHP/SQL skills are and how tricky it is to get the data you need.

I think this module will help you
data_export_import

I know you already fixed this, but what about the backup_migrate module?

Related

Drupal 7 nodes slowing website down

I have a content type in Drupal 7 that consists of 95% of the nodes on my site. I have no use for them now and they have been unpublished.
My question is if those unpublished nodes could be slowing my site down? Would it the site run faster if they were all deleted? I have no use for them at all now but there are over 100000+ pieces of content and I don't know how to delete them except 50 at a time. Thanks.
well yes, they probably can slow down your site. it depends on mysql queries which are you using. if you are really sure you will not need them, than use this module: https://drupal.org/project/delete_all, it will delete nodes by content type "drupal way" = correctly
if you dont want to delete them, you should optimize all of your queries. so try to log slowqueries for a few hours/days and work with them later. this can slow down every page by more than one second if queries are not optimized correctly.
Not necessarily it is slowing down. If there are no views or custom code looking for these nodes, and they are not showing up anywhere, probably they are not causing this problem. In a simple comparison, it's like saying your computer is slow because you have a lot of files in a folder.
But, if you aren't using them and aren't planning to do so, you should probably delete them.
To discover what may be slowing down your site you can use xprof and Drupal Devel module and/or any mysql profiling tool.

How to create a page which executes some php code in Drupal?

I am new to Drupal, i have installed drupal and playing around its functionalities.
I am wondering about how to create a page in drupal and write my php code to fetch some data from Drupal db.
Could anyone give me an idea about this or any example links would be helpful. In mean time, i am searching through the web to find a simple example which could help me to learn this.
FYI : I am using Drupal 7.7
Thanks
Nikit's answer of writing a custom module or using PHP filter is correct in that it will let you pull data from the Drupal database to manipulate it, but you should be sure that there is not a more correct "Drupal way" of doing what you need to do.
I know when I started with Drupal my main concern was finding out how to execute SQL queries, but Drupal provides a number of abstractions that let you perform many queries without needing to write any custom code.
Views, for example, lets you create very complex dynamic SQL queries to list data in various formats (HTML, XML, JSON, etc) and add-ons like Views Calc let you run dynamic transformations on this data.
Write custom module
Enable PHP Filter module and create node with PHP Filter.
And more and more...
That would depend on the kind of data you would like to retrieve but the whole idea behind Drupal is actually to reduce writing any php.
You generally add functionality by using modules, if a module doesn't exist then you could write one, in this way you not only solve a problem but also participate to the development & the community behind Drupal.

Drupal - clean database

Is there a way to clear or clean the database of all the unnessecary entries that was added by amodules that have since been uninstalled. Ive created my site but have added alot of modules to ploay around with, I have no removed all of those I dont use, but just wondering if there is a way top clear the database etc.. to ensure nothing unused was left behind ?
thanks
If you have your own content that you would want to keep AND you have used the uninstall feature for all the modules that you have installed, then the only route is to manually check. if you don't have much content you could export it and replace the db with a clean one, then put your content back into it.
You can use the Schema module for discovering the remaining tables from not properly uninstalled modules.
You can also use DEVEL modules reinstall feature if you only want to clean the database but don't want remove the module.

How to change "site_name" in Drupal 6

This is probably a really obvious question, but it's driving me nuts.
We have a drupal installation and we need to change the site_name and site_slogan variables. It sounds like it should be easy, but I just can't find an option anywhere in the admin panels to do it. The only place I can find is in the initial installation script
I know I can write some code to call variable_set('site_name',...) to do it, but that seems like a last-ditch solution; I'd rather do it the correct way.
Can anyone point me in the right direction?
Thanks.
The form to change it is at site information: admin/settings/site-information.
If you want to do it directly in the Database there is a table called variable. You can change it in there. In Drupal 6 this value is of type longtext, but in Drupal 7 this value is of type blob. It is serialized so you cannot simply write to it with an update query, and expect it to work.
I have some code here that shows how to write to it.
http://www.siteconsortium.com/h/p1.php?id=drpl001
Also, if you are using Drupal 7 it shows how to go to the configuration settings and modify the site_name and site_mail variables.
Don't forget to clear the caches if you have caching setup.
It seems that you have to edit sites/default/settings.php:
http://mblog.lib.umich.edu/DataDiscussions/archives/2009/10/change_the_site.html
It answers the slogan thingy also.
Since I'm not using drupal anymore, you have to verify it by yourself :-)
Greetings

Integrating AspDotNetStorefront and Sitecore

Has anyone ever tried to integrate AspDotNetStorefront and Sitecore? I've been trying for the past couple of days to come up with a way to get the two systems to play nicely together, but it doesn't seem feasible from what I can tell. A couple issues I've run across so far:
Authentication between the two (AspDotNetStorefront has its own implementation, Sitecore just uses/extends .NET Membership)
The main DLL for AspDotNetStorefront is what pops up in the stack trace when I get yellow-screened, but that DLL is obfuscated so I can't figure out what the problem is.
The biggest issue is that we need to keep our existing AspDotNetStorefront application as an e-commerce backend and use Sitecore to do everything else. AspDotNetStorefront has a CMS as part of it, but it's really not an acceptable solution for anything but really basic content pages.
Any thoughts on how I might go about this?
EDIT:
I've decided to break this whole thing down into the different problems that I am facing at the moment and solve each one as efficiently as I know how. I'll detail the ones I have here and then update when I run into new ones.
Problem 1: Authentication between the two systems.
This one isn't too bad actually if you're knowledgeable about forms authentication tickets, which I wasn't at the time but am learning quickly enough. As long as the two systems share the same encryption info, it's easy enough to pass information back and forth between them using cookies as stated below in the accepted answer. The other kicker is that I needed to set the CustomerGUID in the AspDotNetStorefront Customer table to be the user ID from the Sitecore user tables (standard ASP.NET membership). So far this approach seems to work pretty well (I'm still in the proof of concept stage at the moment.
Another thing to keep in mind if you ever need to attempt this is that AspDotNetStorefront comes with a web service that you can use to basically do anything you need. Since they use the same encryption keys, I am able to log in on the storefront side using this service more securely than just passing over clear text passwords (I had to write the method myself, I don't believe it comes standard, if I am mistaken please let me know). Although I doubt it's a huge deal since it all happens server side anyways.
Problem 2: Getting at the product data
This one was a little more troublesome. The aforementioned web service has a few issues I've had difficulty working around. However, since the databases are going to be on the same server, I simply decided that since all I really need is the price and ID I would go ahead and set the ProductGUID column of each product in the Storefront database to match the Sitecore item ID of the corresponding item in the Sitecore database. This way I just need a quick query to grab the ProductID and price information which is only used in a few places. Everything else is going to be housed in Sitecore.
If anyone has anything to add feel free, as far as I can tell from Google, no one has actually done this before, so I'm having a lot of trouble finding resources on this particular topic.
UPDATE:
The integration is in fact possible and our site has been up for a week and a half now with very few integration related problems. This isn't something I recommend doing really on a personal level, but it is in fact possible to pull off.
I know ASPDotNetStorefront and other CMS systems (but not Sitecore). If I was approaching this, I would probably start simple and create a custom URL structure for sitecore 'content' pages that ASPDNSF would direct to Sitecore to handle. [possibly replacing the existing topics system in ASPDNSF]. So, for example: a URL such as www.domain.com/p-1234-aproductpage.aspx would be handled by ASPDNSF whereas www.domain.com/content/123/a-content-page would get sent to Sitecore to render. This is a straightforward web.config edit.
Security sharing across the systems should be possible across the same domain as the cookie information will be available (you should be able to create some code in Sitecore using the ASPDNSFCommon.dll and a cast of HttpContext.Current.User into a AspDotNetStorefrontPrincipal class to detect if a customer is logged in)
Another way to approach the problem would be to write a function that retrieved Sitecore content from the database based on a URL id and then write an ASPDNSF XML template to use the function to retrieve this content based on the URL. For example, you could create a custom URL structure in ASPDNSF such as www.domain.com/sc-1234-sitecore-content-item.aspx which is sent to your custom code; 1234 is used as the sitecore content id and the XML template retrieves the content and renders it on screen.
This second approach has the advantage of using Sitecore for all non-product content management while keeping the live application in ASPDNSF. Also one set of design templates and all your security issues go.

Resources