 All right everyone my clock says 215. So let's do this. This is the Drupal site tune-up talk and hopefully in your right place or if not there's the door. Before we start this is not a performance tuning talk. Okay I am doing vroom vroom but so if you're looking for varnish and caching and all that stuff you're in the wrong place. There are other sessions so there's the door if you need to go. My name is Kristen and I've been I've been doing Drupal for 10 years. It's my 10-year anniversary this year so pretty exciting and I work at Hook 42. We're a small shop in the Bay Area of California. All right go team. So before we start I wanted to get a quick pulse on who you guys are. So how many of you would consider yourself a newbie? Nice. All right so I had labeled this as intermediate because you know we're gonna talk about some things that maybe some of the newbies don't know anything about but welcome. I'm very happy to have some newbies in the house and who considers themselves a veteran. You've been doing Drupal for a long time. Okay you guys can leave their doors right there. No. So I'm a veteran but I learned some things while I was you know doing some tune-up recently that you know I didn't know about so welcome as well. Who considers themselves more of a site builder? Okay fair number. How about a femur? A few of you. All right. Project manager. Actually more project managers than femurs for some reason. And what about the ones that do everything? Oh yeah that's what I'm talking about. All right awesome. So yeah that was me for a long time. I did everything and that was a lot of fun. I am so happy that I have femurs to work with and other things now. So I tend to focus on big architecture and back end coding stuff now. Okay so first we're going to talk a little bit about just a strategy and some things to think about and before I do just so you know we're in the kind of food coma slot here. We've had lunch and everybody's a little sleepy so if you stay awake and you can read then there'll be some slides for you for your entertainment so just so you know. Okay so why this tune-up thing? I'm not talking about performance so what am I talking about? Why am I talking about tune-up? So some of the things that might happen if you do some cleanup on your site. Maybe you'll get have less errors on your site. Maybe there's some module that you don't really need and it's got errors and you're filling up your logs and you just don't need it and you can just get rid of it. You might improve performance so maybe you have a content type and a bunch of nodes but you don't really use that stuff anymore. Maybe you can get rid of it and then you have less content in your your site and overall you get a benefit from that. But in general the main things are just easier maintenance easier to get people on board because you have less things going on less moving parts and just better experience overall especially for the developer experience but maybe also for editors or end users so they're not just seeing a bunch of stuff that you don't need. So that's kind of why. The types of things that you're gonna want to think about when you're cleaning up things on your site. You know Drupal is big, there's a lot of stuff going on so some of the things that you're going to think about cleaning up and you don't have to do all these at once and you're not gonna want to do all of these things at once but you know your content types of things, the content types themselves, the code, the modules and views and we'll talk about a bit of each one of these. So you know make a plan. You need to decide what are your priorities you know after you look at kind of what the different things are what your options are you know maybe you're gonna tackle getting rid of some content types you don't care you know need anymore maybe you're gonna focus on users you're gonna have to see what what where you want to spend your time. A lot of this stuff you need to just be very methodical a lot of it's kind of tedious kind of boring just put your OCD hat and just you know slow and steady and of course we're still adding features and doing you know module updates and we're doing the things that we have to do day to day so it's kind of tricky sometimes to do some cleanup while you're still doing what you're normally doing so you have to balance that out and I recommend very very small measured changes so that you're because you can really go you can really kind of dig your grave if you're not careful here document what you're doing so as far as making it happen track it with something you know whatever you're the tool of choice if you use something at JIRA using a spreadsheet a word doc it doesn't really matter just make sure you're keeping track of what you're doing if you're using the features module then you need to be a little which most people probably are you need to be that much more careful about things because the way that you end up storing configuration in there you need to make sure that things get extracted in a way that is sane with your development process lots of testing and more testing and even more testing so something I really recommend if you can swing it some of you actually there were almost all of you do everything so this is kind of hard but if you can if you have someone that that knows what you're working on and can do some peer review it's really good because you're you know it's it's good to have that sending you checks we're going to be doing a lot of cleanup and sometimes you accidentally do things that you don't mean to you're doing that so you know just the same development process you know if you're if possible you know you're doing your stuff locally you're testing it there before you push it up to dev and hopefully other eyes are on it when it's there and going through the the full development cycle and the main thing here is we're talking about a lot of deleting so that's you just need to be really really careful because you know it's hard to recover from deleting you know so just think about that all right so the first tune-up area we're going to talk about are cleaning up users all right everyone has sex to read that so why might you get cruft with your users what's that all about well those lovely spam bots there's lots of code out there and it wants to spam your site and they know you're a Drupal site and they know to go to users last register and they know to fill it in and press return and create all these crazy accounts so that's one thing you actually have actual paid people they're paid really really really really small amounts of money pennies usually to create accounts so they're actually real people out in the world that do that and then you know maybe you've just got people looking around maybe it's competitors or just people just messing around or nothing or maybe it's you maybe you went and you made a test account and you did some stuff and then you forgot and whatever and you're testing every release and then all of sudden you've got like you know 50 test accounts and you forgot all about them so what some of the ways to identify user cruft on your site and not all of these apply to everyone but in for some sites there might be certain countries you just don't care about like they shouldn't you know those people from wherever from Germany know like they shouldn't be on our site and we don't want them and now there's their accounts are just horrible you know those Germans so so you know that might make sense for you sorry if there's any Germans in the house I love Germany so you know again that might make sense it might not maybe you're just you're a US company or you're maybe you're just a German company and it doesn't make sense to have these accounts from other places and you just like you just don't want them so that's one thing another thing is you can always check the last access time so you could see oh this user hasn't been on the site for two years or whatever right or never actually logged into the site so there's that information something that we use a lot we require that to the user actually go and click on their email link to you know validate their account well if they never if the email bounced that's a very easy way to say oh this this account is probably not any good now sometimes people mistype the email address so you have to take that into account another thing that we use a lot is we use roles to really get a sense of you know did they activate so when in our case if someone activates their account they actually get a different role and then we know okay if there's this kind of no man's role then you know that accounts not really valid and then the test emails use a lot of stuff I have a Kristen org account or domain that I use for test emails and sometimes it's just obvious you look at it and it's obvious spam and the thing with all of these is you're going to want to block any users that you want to eventually delete so you're going to go in and say yeah yeah that one's no good no one's no good so that's a nice thing in Drupal is there's this block it's really easy just go in and you could say I'm gonna block this user now how do so then okay now so you've identified a bunch of users that you don't like now what do you do to remove them so there's some you know there's always a module for that there's lots of modules too many modules so here are some that you could go and you can install and use them you know like administration views is nice it's pretty much like if you go to admin content but it you know lets you have a little more control over searching and things like that and then you can just grab all of the blocked ones and delete and one go and you're happy so so here are some options for deleting these kind of crafty users or you know it might make sense that you need a little more logic you need to make sure that you know what's going on so you know you can have your own custom solution with PHP code and Krons and or rules and that sort of thing so one thing to keep in mind when you're deleting users is they might have made it content at some point so maybe you're deleting users that they were actually active on the site at some time at some point in the past but you decide now anyone older than two years old they haven't been on the site I'm just gonna get rid of them I don't care anymore there might be content associated with them so you know what are you gonna do with that you're gonna delete it are you gonna you know put it as anonymous gonna unpublish it what are you gonna do so you have to think about those kind of things so so it's fine that you've gone in and if you looked at stuff and you're you know identified bad users and you've you know you've removed a bunch but what are some ways to not get them in the site in the first place because obviously great I can do clean up but you know preventative maintenance is always a good thing right so some options are not letting them actually even get to your website in the first place that is one option and ways of doing that IP blocking you know it's sometimes helpful especially if you're getting attacked right away unless they're switching their IPs really fast but that is you know that is a kind of quick and dirty option to be able to prevent people to get to your site cloudflare is a third-party service that we've used on some sites where it checks the user and tries to see if it's a spam bot so it has some it's basically like a web application firewall and that's kind of interesting there's a free free option if you want to try it out and then the bad behavior modules also tries to see if maybe this is some sort of bot coming in then there's the typical and I think probably you know 99% of you have used some sort of CAPTCHA, BOTCHA, something right so you can use one or more of these things you know I've used mallum in the past BOTCHA, honeypot you know there's just like a gazillion options there you know feel free to put more than one you're getting more spam try you know have three see if you can you know prevent them from coming in so so that's a good way to go some people like to have the CAPTCHA on the forum some people don't so your options there the BOTCHA and the honeypot don't have the actual physical CAPTCHA there so another option which is kind of interesting and only works for some sites but I've done this is you actually hide the user registration page because the spam bots know it's slash user slash register so if you hide it because you have you want to have full control over who goes to that then you give it a different name and then you know only those in the know will be able to go to that and use the new page that has that URL that requires a little bit of coding so you know it's not it's just a few lines it's not a big deal but just that is an option doesn't work if you're just a site that you want them to go click on the user register and and that because then they'll then the bots can find what that link is and another thing that I've used a fair amount is this idea of role promotion so if someone does you know they they register but they don't click the link they're a certain role maybe they're just authenticated user or maybe you have some some other role that that that state is in and then they go and they activate their summit you know then they've been promoted to another role you might have promotions depending on all sorts of things on maybe if they you know contribute some content they get you know promoted to another role and maybe you have kind of permissions based on that so really it just depends on your site how you're going to do that okay so that was users and focusing a lot on you know on spam prevention and next we'll talk more about content give you that one so you guys still wake all right okay so so something so we had spammy users right so well we can have spammy content too right and the idea is pretty much the same with users on kinds of things that you can do in order to deal with them you know you can prevent them from coming to the site you might have a form that's not a user form but you know some sort of content form on your site and you're exposing that and you you want to be able to you know try to prevent people to come in that or have the captions and things so all those things that we talked about with users so supplies here but the one interesting difference is there's no block on content and there's an unpublished but actually that might not be that's not a great way to tag something is that you're going to want to delete it at some point right so you know you could unpublish it but that doesn't necessarily mean I want to delete this so you need another way of tagging content that says this is targeted for deletion at some point because it's spam or whatever you can have you can do it as you know use taxonomy or a flag or however you'd like to do that in order to mark these for deletion but something interesting with content getting creft in your content is actually duplicate content and so we'll talk a little bit about that again you might have spammers that are Nike Nike Nike Nike by Nike you know again and again and again you might get something like that one that is really interesting which I'm surprised is not actually fixed in core because I've run into it many times is people double-click on things right so you have a node add form double click double click oh it's slow why is it you know and or triple it you know like if they're click click click click you're like oh and so you know I had this one project and one of the admins was like I got five reviews but they're all exactly the same I don't understand and I looked in the timestamps were like all right in a row and obviously either the browser went wacky or they were really anxious to get this review in that you know you know you have that so that's kind of an interesting one that you would think was kind of you wouldn't happen out of and just you know out of the box but it does you know you got you know people are managing their content in word yeah so we did we fix well go the next slide but we fix it with some jQuery just it is a little snippet and it's actually you could just Google it it's like you know submit button multiple you prevent multiple clicks jQuery and boom you know you're gonna have some code that you can suck in we use sometimes the node clone module because it's handy and you know sometimes the editors kind of have they want some of the same maybe tagging or things like that and they can clone they might get a little crazy there sometimes another interesting one is you might they might just insert the you know upload the same module or a file again and again and again they might be using that particularly for me sending message to people or something and saying oh go look at this file and you might end up with a bunch of the same files and these are all things that I've encountered so okay how do you identify these things if it's public published content then Google Webmaster Tools has a way of identifying these because this is actually for SEO you don't want to have duplicate content so it's kind of an SEO thing but you could actually use this also for this particular purpose of using the you check for the duplicate title tags but most of this content if you know it's probably not published you're posting a bunch of stuff and you haven't looked at it and you know it's duplicated or maybe it's the admins accidentally did it that kind of thing so you can actually use the unique uniqueness module in order to be able to check for duplicates there's also an audit files module I believe you have to actually look in the issue queue I think there's a patch for Drupal 7 but there is some way of using that to look for duplicate files and you know if you're if you're a coder you could go and just do some queries now so the thing here is like I said you're gonna have to be able to just like with spam you'd have to identify that these are things that you want to delete at some point so you're gonna have to tag them or flag them or something some way of identifying that this is cruf that needs to go away so as far as removing them so views bulk operations great module you just make a little view that you know you're gonna grab all nodes with tag you know crufty or whatever and then say delete okay all all good bye bye you can you know use rules for that or use some custom code something that we're working on now is we have this one huge website that's got literally like a hundred gigs of files or something insane and a lot of them are do our duplicates because it's a bunch of people messaging each other and it's like agents messaging travelers and it they're always like look at this beautiful picture from Hawaii look at this beautiful picture from Hawaii look at all these different people and you're like I'll stop because then we have you know the same thing like 500 times so we're actually working on this right now is to have some code that's smart and says oh this is exactly the same file we're just gonna point them all over and start using the media module for that so how do you okay so you know there's ways of identifying clean it up but then how about not getting these in the first place so you know think about who you want to access this these forms in the first place you know prevention is great right so if if you don't really don't want you know anonymous to hit these forms then don't let them hit the form and then you're gonna get less stuff right so be just very mindful about restricting access to your stuff and then we talked a little bit about using the jQuery to prevent that multiple button click and and there probably is a module for that but we just grabbed some jQuery and pasted in it was good then there actually two modules is the uniqueness one there's also one called unique field which is kind of interesting it can it can be handy where you say that I want all titles for my content type article to be unique which is a good rule to have you don't want to be having the same blog posts with you know the same title across your site whatever so that one you can do individual fields have to be unique per content type or globally or some combination of fields have to be unique and probably a lot of you have heard of and or probably of all use the media module so that one's useful for trying to reuse these files so you're not going and uploading that file the 500th time you're going and saying oh it's in my library here it is and I'm going to use that one and then as far as trying to get less craft in your site you know if you have some sort of moderation process workbench moderation is great but some way that's like there's some sanity check before things are published to say okay is this really stuff that we want to get out on the site okay so we talked about users we talked about content now we'll talk a bit about content types I don't see any snoring yet all right okay so why content type cruft things change right you know all the time all the time everyone's learned to validate droopalate now and tomorrow we'll be learning Drupal 9 and it's all good so yeah things change all the time you know just stuff might not be needed anymore maybe a field isn't needed maybe the content type is fine but you don't want to use that field anymore or you maybe you've replaced it maybe you had some custom content types but then you're like oh I can totally use you know private message module to do my messaging I don't need to use my content type to do that I can it's all baked in I can use that instead and then something that we've been looking at is you know doing a lot of performance profiling and saying okay you know what are the things that are slow can we you know consolidate can we clean up and so you might be doing some performance evaluation and find that you may be a particular field is taking a lot of space in your database for example okay so as far as identifying these things one really simple ways there's a fields page under admin reports fields and you can go and see maybe that field you know isn't even you know needed anymore you can go do a evaluation there a lot of this one really is just about thinking right talking and thinking you have to look at each thing and say do I really need this do I really need this do you really you know really really like now I'm getting really good we have this one site we keep trying to do get it faster and faster and faster and then the client's like oh I want to add blah blah blah I'm like do you really need it you know like would they use it you know like really like three times you know well no actually I guess we could not and like yes that's the answer I wanted to hear right I mean sure I get many if they we build stuff but I'd love to just you know try not to make the thing break so so the other thing is you know you're here obviously keeping up to date with the technology and there's always new modules and things and you know maybe there's a better way to do it maybe it's more efficient you can get rid of some of the stuff that you've built custom alright so removing a content type this is very very surgical particularly if you're using features so obviously any nodes that were of that content type you need to get rid of them there are ways of converting the node type if you want to preserve that content and there's a sane mapping to another content type there are ways of doing that but generally you probably just like I don't need this kind of content anymore I'm gonna get rid of it then you know if you have custom code then you need to make sure that you go and look at all that code and make sure you're not actually referring to that content type or any nodes of that type then there's all these things that could be referring to it right it might be in all these things views context rules so forth so you know you just need to do an inventory see is it there or not and if so remove them and then at that point once it's removed from it all the other stuff then you can say okay I'm gonna remove this from my features I've included in this particular feature so I'm gonna remove it from there and once all that's done then you can do if you can do some code you can add a hook update in into a custom module in order to delete it that way that's kind of the preferred sane way to do it because that way when you're pushing it from environment to environment running update HP it's gonna delete it for you or if you know you just can't code or that's not an option then you could just go to the UI and remove it that way so that's how you would remove a content type removing a field is very very similar so you know get make sure that none of the code is ref referencing it make sure that none of these other Drupal modules are referencing it and then remove it from features so features a little interesting with fields because in features 2.0 they introduced this idea of a base and instance so they split it up the the configuration and so you just have to make sure that you know you're removing it both the instance all instances and also the field base from features and then again you're gonna do either the hook update and if you can do a little bit of code and if not then you actually in this case have a drush option and also you can delete it from the UI so again you know it's not rocket science but you just need to be very methodical very surgical lots of backups very careful so how do you reduce this kind of cruft in the first place this is a lot of just careful planning thinking thoughtfulness you know so not a lot of technology just a lot of brainpower so you know documenting Palantir actually has a really awesome spreadsheet for content type definitions where you can just put things in different tabs and you know build out your fields and everything and have it all nicely documented you could use us that spreadsheet or use a word doc or whatever and just you know think it through first you know and then reuse when it makes sense you know if you don't need 50 content types don't you know you you know if you can consolidate then great because you have to maintain this stuff right so if you can get you go from 50 to 25 then boom you know I mean that helps the database it helps your life right to keep things simpler all right so now we will talk a bit about cleaning up your reviews people are still awake I hate snakes just so you know it took a lot for me to put that in there I really really really hate snakes so you guys are really important to me for me to put that in there all right okay so for views we kind of craft you know it's kind of the same ideas that others you know you might have changed things you don't need any more you replaced it maybe you had a custom view but you decided to use some other module to do it and you know it has views already made for you or whatever so or you might have made a view and it was dog slow and this is something that I ran into I was like oh yeah we'll use private message it's great oh there's a patch for doing views integration awesome yeah you know I try to use views when I can because you know I like to try to be you know have make things in a way that other people that are non coders can also interact with so you know didn't use awesome then we stick the four hundred thousand you know entity messages in there and it's like oh no that wasn't good okay so you like you go the view and you're like yeah come on so we ended up rewriting it and doing it from from straight code and had to be really particular about our queries so you know there are very valid reasons why you might not want to use views okay so identifying them there's awesome module views usage us audit module and that one's interesting because you need to run it on your live site okay normally you know if you're auditing of things you know you try not to do that on your live site but you do have to run it on your live site because it has to see if the view is used and the only way it can see that is by people hitting your site and going to all your pages and if it's on your test site people aren't hitting all the pages right so it makes sense so you just you know enable it let it run for a week or two or however make sense however long make sense for your site and then you can turn it off and and look at you know which ones that you need to get rid of so yeah just perform it we use New Relic a lot like them a lot so just seeing you know which which of these views are slow you know do we have to replace them with code or we've done a lot of tweaks just in views just making sure that you know things are you know cached and that kind of thing you know just manually looking around and again this is one where you can just do we really need this do I need this page can I get rid of it I don't think anybody's using it and just making doing a sanity check so removing them so removing views is similar to removing other things remove the references remove it you can have views reference views right it's always fun viewception I think there was actually a session right today about viewception and then then remove it from your features modules and then again you've got your option of doing the hook update and or removing it from the UI so not all of these all of these have drush options of deleting okay so let's not get these crafty views in there in the first place when possible so again a lot of this is thinking right lots of thinking something that I am a strong proponent of and anyone that does a lot of views is a strong proponent use good machine names if you're going to go and try to delete things and it's everything's called block underscore one page underscore one you just like I don't know which one it is it's just irritating right so unfortunately it's always you know it's collapsed by default you can change that but lost by default it's in the advanced tab and it's like really it should be at front and center but always use a really good whatever naming convention you want doesn't really matter just use the some consistent same naming convention we like to use view modes to try to reuse things we find that pretty handy and you know reuse okay so that was views and now we're going to talk a bit about tuning up code and module see who's so late some people are still checking email all right yeah that much cuter than snake huh all right oh he would eat that oh no that's okay okay so why would you get cruft in your code and modules um number one this number one reason modules were not in well maybe number two it yeah too many modules out there right to use but not uninstall properly so this is you know even those of us with the best intentions it just happens right so that's you'll get cruft that way you know things change I don't need it anymore or you know you're doing custom code instead of a contrib module that kind of thing replaced it and you might identify code that you need to get rid of because things are slow now so this one is actually you might have patched the module so there was a oh we needed views integration and there's the patch and applied the patch and then you want to upgrade the module and then oh now it has that patch in there so I don't need the patch anymore and you still have that patch lying around you don't need it and just kind of file cruft and the code has been hacked so sad I started in Drupal 4 and I hacked core sorry it was back in 2004 I didn't know any better so probably you know if you've been around long enough you probably made that mistake but and then sometimes you know you have to make changes and but then you make them as patches then you're not hacking your your patching so that's okay that is a lot so you're gonna identify the stuff all right so there's a page for that of course so there's an uninstall page those are all the modules that are on your site that have not been uninstalled properly you haven't pressed the install button so there's that page there's a awesome site audit module John Peck is at the conference in fact he might even be in the room or he's lurking so awesome he's got an awesome beard so if you see that man shake his hand got that module you can use there's a variable cleanup module which is handy and the hack module is really good is this is an awesome module if you are inheriting a site right someone's like I lost my developer I need you and you're like okay and then you get some site and you're like I have no idea what these other people did install that module and then you'll know if they've hacked core they hacked contrived whatever and it's really good so that was yeah we use that on a big project we did a big D5 to D7 migration and we installed that and found that about 80% of the code had been hacked like okay yeah that's fun all right and then just you know keeping keeping up with the issue queues and you know seeing if patches have been you know if there are patches you can use checking performance and then just you know using your head okay so removing a module you need to make sure that you're not referring to that module elsewhere in the code any of the clued files or things like that root from features as all the dependencies and things have lots of backups in fact there should be all those other ones where I said to delete stuff back everything up first and then you have that hook update an option that you can do do it that way or just through the UI or through Drush then okay so the big picture the big thing to take away here is you need to make sure that the module is uninstalled before the code is gone because you can't install it otherwise so a typical thing that will happen is people will they'll they're like oh I don't use that module anymore it was enabled at one point I don't use that money to remove it from git and then push it out whatever and then they didn't realize oh it was enabled and there was stuff right there was a database table with it or there were variables in the variables table and it was never uninstalled properly but once you remove the code it's not going to show up on that list of modules anymore of things uninstall so it's just you got to remember always do the uninstall before you delete the code so that's a big takeaway here and then just do your normal dev cycle so and then for patches so inevitably any struple site of any size has some number of patches sometimes a lot of patches especially if you're doing multilingual triple seven a lot of patches okay so with patches you know you go to the issue queue oh they they say they committed it did it make it into the latest release you go check the dates oh yeah it's there great awesome so then you're just gonna update the module like you would normally then you know I always usually try to do any check did it really get in there run your update PHP lots of testing and then I like to and I recommend this for everybody if you're not doing it already is I have a patches directory in that patches directory I have a readme file and I a lot of people will just have the readme file and they'll just have the list in there of all their patches I I don't know why but I like to have the physical file the patch file I get that from Drupal.org I don't know something OCD I have that file I have it in the readme file and it points off to the issue queue and it says why we applied the patch the date we applied the patch who applied the patch blah blah blah all this stuff in there and I find that's a very sane way of dealing with patches and then you do your normal death cycle all right so reducing cruft so you know a lot of this is just thinking you know reusing thinking carefully you know we've got the whole open buffet syndrome right there's so many modules and you just want that one thing and you're like but there's a module for that okay there's another and you know it is so easy to get above 100 modules above 150 modules I mean at some point if you've got a complex enough site there's something I mean if you use a distribution oh forget about it you're like you're over 200 modules right it's just it's kind of out of control so just be mindful you know just like you would ask the client do you really need that you need to ask yourself do you really need that and you know if you can get away with not doing it don't do it but you know if you have to go for it yeah so using so you know might be something that's just the you have a full module and really it's doing like it's doing that button click you know preventing that button click and you're like I could just so stick that in my own thing that I already have a module a custom module it's doing some other stuff I just throw it in there and then you have one less module right and it's just a bit of code so you know don't feel like you you know and obviously need to be feel comfortable enough to do some copy paste and stuff but just think about it and then I already talked about keeping that patches directory and always uninstall that module before deleting the code okay so we're gonna talk a little bit about the takeaways here some people are still awake all right good okay so number one cruft happens don't feel bad I make mistakes everyone makes mistakes right and you know we're working hard we're going fast we're working on too many projects we have kids we have friends whatever you know so don't feel like oh I totally yeah you know just just get over it you know it happens so I'm not gonna read all these but you know then hindsight is 2020 so just you're fine so you need you know try to plan you know try to take this step back and say okay I know this stuff's gonna happen but let's try to minimize it and we're gonna try to plan as best we can so you know the great one measure twice cut once so for Drupal you know plan you know just like document you know think about it think about do I really need this do I really need this you know think about document it read it throw it by someone else as a sanity check you know just really you know try not to get it in there in the first place if you can right so yeah actually that's a little more on the simplify but you know so you know if you don't need it don't use it really you know try to I had had this one contractor on a project he's like oh no you want to add another module and at first I was like well yeah but you know this one's good and he's like but you got somebody much like yeah and towards the end of the project as we you know the site got more complex I'm like yeah I get it I get it okay all right and so I was the one that was like oh no no no you you want to add something no way we're not gonna add anything else so you know there's but there's a balance right you know still have to have functionality all right and be careful right so again your delete this is all about getting rid of stuff so you're deleting be very careful okay but you need to do it right there's a bunch of stuff in there you know I mean maybe you don't you know you have to decide you decide but you probably should do it so get get started and why not yesterday right why not today all right so with that we went through our site to nap and we went for I don't know if you notice the clunker that we had before but we did pretty good huh awesome what do you think that'll go vroom vroom I think so yeah that's looking pretty pretty sweet I don't even know what kind of car that is looks good okay so at this point I will turn it over to questions and they would like you to use the mic if you don't mind stretch your legs I just had a quick question about keeping up on modules you mentioned that early on about you know making sure you're staying on top of best practices and the best modules and yeah you know we build some sites not a ton and that's always a continual challenge trying to find the best modules I wonder if you had any suggestions on maybe better searching tools or sites that use if there's any aggregators that are no it's tough it's tough um obviously there's the standard places Drupal planet to keep up on things you know their podcasts that you know keep up on like modules unraveled or you know they're definitely there's certain blogs that are they're good at you know keeping up with that kind of stuff but there's so many and there's a lot of duplicates and there's a lot of you not so great ones right so it's hard there are some good distributions you can look at to see what I'm actually demo frame it framework is a distribution that is fairly new that's kind of a fun one to see what Drupal can do that's a it's from aquia came out recently and they're working on it for Drupal 8 as well it's kind of heavy and bloated but has a lot of modules so it's actually kind of a fun one because you can go in and and see like oh how they use that how they use that and it has some best practices and things so there yeah I would go and you look at you know module usage you know look at well you'll probably see some of them at the at the camps and the cons and stuff of you know what are the main ones people you know there's obvious ones you know views everyone uses views everybody uses features you know whatever but you know then you've got that next layer of like I don't know do I really want to use whatever like yeah so it's it's tough it's not even you know and so what I'll do is all decide if I want to try it and I'll test it and you know test the sandbox area try it out look at the issue queue check the usage check the code you know I could look at the code I don't know if you can but you know just try to get a sense of you know is it safe to use and sometimes you just have to try it so you mentioned some instances where requirements change or you you change how you're doing things and if you're somebody who learns while doing you know you might make a change to where you store things like for example files like when you attach a file to something you might have not realized that you left at default and later you know after the site's been live for a while go change where those files are put in a specific directory I mean not me I'm asking for a friend yeah sure in there so let's so let's say I wanted to help my friend and you know unify those files into one place is there a better way to do it than going through and having to manually move the files are not the right place and then re-associate that link yeah I believe the source what's it called the file source the module where you can do the file source path anyway the one where you can specify the directory with like tokens and things file file field path I think we'll make sure but I'm pretty sure with that one if you change the the directory name doesn't it just automatically move them over for you the other ones or no they're just keep so you did it manually okay yeah yeah all right so yeah so we're doing a lot of man yet it's code and it's moving things and it's so I don't have a great answer for that I think that we need a module for that right so actually I was thinking for the because we're doing all this file cleanup and this consolidation we kind of need a file consolidation module and I don't know if we'll write that but maybe similar question we have a lot of basically nodes keep getting deleted and a lot of just leftover files and duplicates of files we're wondering if you had any strategies for you know cleaning up a huge file directory that just has a bunch of unused files yeah so yeah I feel your pain that's exactly what we're going through right now so there's the file audit module help identify some of that stuff or audit audit files we what we're doing is we're actually we had did some queries and stuff and we built our own database table and we're going to write some code that doesn't the consolidation yeah so actually yeah since that since you're not on mic so I'll just reiterate so yeah so the thing about files is someone might upload the same file but call it something different well actually it's gonna even if they don't it's gonna be underscore one two three right when you upload the same file again and again and again so yeah you can do an MD5 check some to make sure is this file really the same file on the tricky bit though if you're using media or you know you're the file entity module you're able to associate metadata with the files you need to be careful because actually we're we have some instances where we're actually using the file metadata the Alton title in a way that exposes some content on the page so even though the file is actually the same for two different nodes we have different metadata or the you know they're equivalent files it's not the same exact file but you know they're equivalent files we have different metadata so we don't actually want to consolidate those because we have to worry about that metadata so it's not a certainly not an easy and the other one is you might end up with files and then there's no maybe you know there's managed files right that has an entry in the database and there's unmanaged files well if you have managed managed files in your site and like are they supposed to be there like sometimes people actually have unmanaged files so you know you you have to be careful like well just because it's not referenced from the database is you know maybe it's actually supposed to be there so I mean we don't do unmanaged files but you know depends on you especially if you inherited the site from someone else it's like oh okay well it's not I don't know right so you do a lot of grepping and things I guess and see where it's referenced sure apologize because I think you weren't going to cover this but I was hoping you might talk about content type consolidation yeah I think that was a bullet point at some point and yeah that one that one's kind of tricky I mean it goes down to you know content architecture and you know making sense and a lot of it is the way you think right the way your client or whoever the who's going to be using the site thinks and sometimes actually I had this one of the Santa Cruz Drupal user group guys you know he was showing me a site he did and he has one content type to rule them all and I was like wow that's pretty amazing and he was using all of these conditional fields and he just had all sorts of stuff in there but you just in depending on what you were doing you were adding stuff you just didn't you know you saw the things that made sense I was like well that's actually pretty kind of awesome but kind of weird and I you know so I mean it really and it was working great for him and I know someone who you know worked with him who did started doing that and it was like okay I kind of get it so it's it's hard because I don't know I come from object-oriented Java background and for me you know I try to have the different objects but you don't want to you know you need them similar enough but not too crazy so an example might be landing pages those are those are tricky because a lot of times with landing pages you might have them focused you know on a certain thing but you know see if you can try to find some commonality between them and you know maybe they always have a summary and they always have the body and they always have an image maybe the image is used in different ways for the different for the different landing pages but that's okay the fact that you're just collecting an image or maybe they can add the image or not right maybe it's an optional thing so yeah it it's it's a little tricky but as far as like if you had already had the separate content types and you're trying to merge them and say okay I just want one that's when you have to do the that requires a little bit of care a lot of care actually if if there yeah you probably have to do some custom code in order to do that if you just happen if exactly the same fields though you can totally do the change the content it's not that hard to change the content type of one to another again it's there's a little bit of code but it's it's really it's like a few lines it's really not that crazy sounds a little crazy but it's not that bad so it totally depends on the different types so I've inherited aside from someone else and so short of just opening up the database and looking through is there a good way to see if there are modules that were not properly uninstalled that do you have leftover stuff and yeah so the the variable cleanup one that's a good one because most modules have some variables that they've created and that's usually the top that's the telltale sign that someone didn't didn't uninstall it properly so the thing is if they if the code's not there but you can see that it's there that it was probably there at one point you just to stick them the code back right and then you can then you can uninstall it you have to know what version but sometimes it's still it's still in there so you can look in the systems table and sometimes that the information is still kind of round in this kind of zombie state or certainly in the variables table the variable cleanup modules should help point at some of that stuff or yeah sometimes you just have to look at the database tables and go you know private message blah blah blah I'm not using private message why why do I have two tables called private message that doesn't make any sense so it's a little bit of investigation sometimes oh no okay I thought oh it unplugged itself all right well we're we're I unless I think we're good night no more questions all right then oh well you're not gonna see my cute little guy all right there's a there's a cute oh hold on there's a cute puppy you're gonna go away okay so you're good to go um if you have more questions answers a hook 42 and then I'd appreciate it you know people speakers I don't get paid right the speakers here don't get paid but you know if you can just leave a comment if you hated it you loved it as a matter just leave a comment say what what you liked you didn't like whatever but they use that information to select speakers so it's very valuable to the Drupal Association and that's it and these will be posted in the recording I'll probably be up like in an hour or something I don't know it's crazy so thank you very much