Comments were one of the more basic features in Drupal 7. There was only type of comment and you had very limited modification and moderation options.
In Drupal 8, comments are vastly better. Here are 5 ways that comments have changed and improved:
Drupal relies on pluggable cache backends to store cache data such as Memcache, Wincache, Database, etc. The default storage backend is the Database, but Drupal being a very cache intensive application (even more in Drupal 8) you want to get better performance by using faster backends that will yield lower latency and scale better.
Moving caching away from the database is done by replacing the caching services by ones that do not rely on the database. You define the services in your services.yml file and the binaries routing in settings.php:
- How to use NetPhp
- Drupal on IIS or Apache
- Setting up Code Syntax Higlighting with Drupal
- Fixing slow queries and database deadlocks in Drupal without PHP profiling tools
- Making namespaced callbacks work in Drupal 7 (without hacking core and with bound parameters)
- Deploying changing module dependencies with Drupal
- Bypassing Form Validations and Required Fields in Drupal: the BFV module.
- Adding native JSON storage support in Drupal 7 or how to mix RDBM with NoSQL
- PDF Generation in PHP
- Database Transactions in Drupal
The neat thing is, if the developers that worked on GitHub use the same email address in GitHub and Drupal.org, Drupal will credit them with all the commits as if they originally made their commits in Drupal.org!Tags:
When managing a whole government platform, as we do in Australia with govCMS, there need to be layers of testing, staging, and assurance before you push code to production.Tags: acquia drupal planet
The core Drupal community is notorious for obsessing over every little detail that is submitted as code. Single issues can have hundreds of comments and, at its very worst, can take years to be resolved.
As a community, though, we know that this obsession results in a much better product. Code quality comes at a cost: time. It is nearly impossible to both comprehensively review code and commit code quickly. But the upfront time costs for peer review will save you time down the line. Teams I've worked with have caught typos, security vulnerabilities, broken styles… you name it, we've caught it before it was deployed, thanks to the peer review process.
The remainder of this article outlines the step-by-step process needed to conduct a peer code review.Working on New Code
Each time you start new work, make sure your local environment is as pristine as possible. Ideally, this would also include downloading a fresh copy of the database from your production server to ensure there are no half-baked Feature settings which could dirty your export.
With the build environment as clean as possible, you're ready to start.
One of the big trends during the Drupal 8 creation has been the replacement of info hooks by two main mechanisms: annotations, and YAML files. In that light, hook_drush_command(), as the CLI equivalent of the late hook_menu, replaced by various YAML files, looks just like a perfect candidate for replacement by a commands section in some mymodule.drush.yml configuration file. Turns out it is incredibly easy to achieve. Let's see how to kill some hundred lines of code real fast !
Stephanie Daniels sums it up well, "Optimized sites are better for the environment. That’s because they’re significantly faster, more usable, with content that’s optimized for SEO and user experience. It’s my belief that Drupal has all of the tools in place to create sustainable websites…if you just know where to look.".
If only I had Drupal back in 1995. That was the year I built my first website for a Fair Trade Retailer called Bridgehead. Back at this time, the Internet was a very different place. People were using the web at that point, but it wasn't embeded in our lives like it is now.
Even the ecological footprint of the Internet 20 years ago was pretty small. Sure, there was already a network of computers that spanned the globe, but there weren't the giant data centres that there are now.
There are over 1 million sites running Drupal right now, representing about 3% of the Internet. The Information and Communication Technology (ICT) sector is estimated to contributed around 2 to 2.5 per cent of global greenhouse gas (GHG) emissions according to the International Telecommunication Union. There is a nice breakdown of this energy consumption in the world's ICT. This is only growing as we find more ways to use the Internet to make our lives more convenient.
There are a few people in the web industry who are aware of this and are working to raise awareness of others. I've been inspired by both Mightybytes and Manoverboard who have been leading this discussion within the BCorporation community. This article is going to extend the work of Mightybytes in their 15 Ways to Optimize Drupal for Sustainable Web Design article as well as the post by Manoverboard in Creating a Responsible, Earth-Friendly Website. I don't want to repeat their work, but saw an opportunity to update a few things, particularly in line with Drupal 7 & 8.
Certainly with Google prioritizing speedy pages in their search rank many sites have started making performance a higher priority. The rise in mobile usage also is driving performance, as usually mobile devices have lower bandwidth than desktop devices.
In Drupal there is a lot that can be done on the front-end, the back-end, and on the server. With a good content strategy we can ensure that the content is easy to find, and simple to use. All of this will help reduce the time that a user needs to spend using your site, which will reduce it's total carbon emmissions.Drupal Optimization
Here are some helpful tips to optimize your overall Drupal experience:
Remove unnecessary HTML to help the page load faster using the Fences module (7/8-dev). To change the to the lighter markup, make a copy of any tpl file that ships with the Fences module and add it to your custom theme. You can also make your own Fences-styled tpl files and place them in your theme by using the fences naming convention. Fences will automatically find them, and add them to the list available in the dropdown for field configuration.
Make sure you are delivering smaller images to your visitors using the Drupal Core's ImageCache module (7/8). This is especially important for mobile devices where the browser is rendering much smaller images. Page speed can be dramatically reduced by using big images that aren't optimized. Tools like TinyPNG can be useful to reduce image size before uploading them to your site.
There are so many reasons to design Mobile First, and using semantic HTML5 and modern CSS3. With Drupal we've been suggesting starting with a good base theme like Zen (7/8-patch) or Adaptive Theme (7/8-dev) for accessibility for years, but they also are great responsive platforms. Designing for a mobile device first forces organizations to prioritize what is most important to them and simplify their site. This can then be added to when a user is browsing your site with a big monitor and high bandwidth.
Use Scalor Vector Graphics (SVG) rather than PNGs or GIFs where possible. SVG files are usually very small, they can be written inline in HTML5 & CSS files, and they they scale without loosing clarity. This allows you to use the same image on your phone as you do on your desktop. Drupal 8 is replacing many of it's PNG files with SVG files for this purpose.
Today, LCD screens use the lest energy using a lighter colour palette. Of note, an old Cathode Ray Tube monitor will use about 200% more energy than a comparable LCD screen. So when designing your site, more than ever think about the advantages of a bit more white space.
Disable unnecessary and unused modules. There are modules like Devel (7/8-dev) that shouldn't be enabled on production site anyways for performance reasons. Drupal's statistics module can also slow down a page since it needs to write to the database for every page load. There are also modules like Views UI that are only needed when you are editing a View, so why not disable it by default. Some code from the enabled modules will be loaded with every page view, thus slowing down your site.
Many people visiting your site are probably skipping the home page and going directly to the content that the search engine sends them to. This is great for the user and also great for the environment. Make sure you've enabled the SEO Checklist module and follow the advice within it to ensure that search engines send visitors directly to the information they want.Server-Level Optimization
For those more savvy with server maintenance:
Enable page and block cache (Administer > Configuration > Performance) in Drupal 7. There are a great many improvements in caching in Drupal 8 and sites with changing content will perform much better. Page caching and CSS/JS aggregation is enabled by default, so hopefully it will be employed by default by more sites in the future. There have also been huge page improvements in the dynamic page cache for all users which should help interactive sites and improvements for administrators.
You may also choose to compress the cached pages using here. This can also be done in Apache, so it really depends on how you configure your server, no point to compress them twice. Make sure to increase the cache lifetime in Drupal so that you are not having to regenerate the pages unless needed. If you want to go even farther, install Varnish and set up the Varnish module (7/8-dev). Varnish is a very powerful page caching tool that is very configurable. For some sites we recommend setting up a seperate Varnish server devoted to serving cached pages.
Memcached is a high-performance, distributed memory object caching system that can be used to speed up your Drupal site by alleviating database load. The Memcache module (7/8-dev) or Memcache Storage module is required to take full advantage of this, and Memcached can be run alongside Apache or on it's own server, depending on expected demands.
You should also look at optimizing your database on a regular basis. The DB Maintenace module (7/8-dev) uses cron to run MySQL's OPTIMIZE TABLE on a regular basis. Ideally you could do this with a cron script using MySQL commands in off-peak hours too.
echo "OPTIMIZE TABLE accesslog,cache,comments,node,users,watchdog;FLUSH TABLES;" |mysql -u user -ppasswd
There are a great many other suggestions from the community on how you can tune your server. There is an active community of Drupal developers interested in high performance configurations, it's worth checking out their ideas. There are also videos on MySQL performance improvements for Drupal.
In Drupal 7, install Alternative PHP Cache (APC) to and the APC module (7) to cache PHP code. For Drupal 8, look forward to using PHP7, which runs way faster, than earlier versions of PHP. Drupal 8 runs much faster in PHP7, but unfortunately, APC is not yet available in PHP7.
Think of using a Content Delivery Network (CDN) to deliver some of your content. A CDN serves content from a location that will be optimized for the visitor's location. Wim Leers has written a series of great posts on setting up the CDN module (7) to optimize your site.
Look into adopting HTTP/2 on your server because it offers performance improvements and may negate the advantages of aggregating CSS/JS files. At the moment there is great browser support for HTTP/2, but less than 2% of sites support this new protocol. Regardless, it is usually best to assume that less HTTP requests = faster page loading.
Sometimes though you just need to spend a bit more on faster hardware, more RAM and solid state drives. Having multiple servers can really help deal with busy sites.
Think about switching to a green hosting company. Look for a host that is using green energy and has a strong environmental policy. Your servers are running 24/7, so having a green host can have a significant impact on your CO2 output. Mightybytes has a blog and Manoverboard a White Paper about green hosting that are worth checking out.Content Optimization
If your job is more catered towards the material shown on the site:
Think about your content. Could meaning be clearly conveyed with fewer images? Are the images optimized? Is content created using proper semantic markup that is styled using centralized (and cached) CSS files?
Andrew Boardman's blog on Manoverboard is great in encouraging us to keep it simple. Steve Krug's book Don’t Make Me Think contains principles that are "highly relevant to all digital interfaces not only for ease of use and human engagement but also in determining energy consumption that powers our online behaviours."
He also argues for archiving unused content. Users expect websites to contain fresh content and not to contain an active history of all pages that have ever been published. Fewer pages mean that there are more quality pages for search engines to index and that it takes less energy to maintain them.
Content should be findable. Users will benefit from sites that have a well considered navigational structure. Using structured taxonomies can also allow visitors to find related content. Enable Drupal's core search, or better yet set up Apache Solr and use the Apache Solr module to provide an amazing faceted search experience.
Don't use Flash. Aside from not working on many mobile devices, Flash is known to consume a lot of energy, which was one of the reasons that Apple used to not support Flash on iPhones. Use HTML5's <video> format which has huge accessibility advantages as well as it's environmental impact. There are of course other reasons not to rely on flash because of security or accessibility problems.Evaluate Performance
Finally, when you've done all of your changes:
Don't trust that enabling these tools will work. Page optimization needs to be evaluated to determine that you are actually delivering faster pages. Yahoo's YSlow, Google's Insights & WebPageTest all offer means to evaluate web pages. Note that your performance on various pages may vary. Yahoo! also has a list of best practices that are worth considering.
Page speed will always vary based on load. Consider using the Apache HTTP server benchmarking tool to simulate how your website performs with a heavy page load. The Performance Logging and Monitoring module can help you track your performance over time as well.
It's also really worth taking a look at Mightybyte's EcoGrader tool to get a quick evaluation of some of these improvements on your site.
In the end, it isn't difficult to take the time to look over the suggestions in this post and make a difference for the sustainability of your website(s) and the environment. Regardless of your technical expertise, there are improvements to be made at any level of website development. All you need to do is use the tool's at your disposal.Topic:
OpenXML is an open source specification that is used to build all Office 2007 and beyond document formats including Word and Excel. SpreadsheetLight builds on top of the standard OpenXML library to make Excel manipulation a piece of cake.More articles...
- Setting up Code Syntax Higlighting with Drupal
- ChainedFastBackend in Drupal 7
- Making namespaced callbacks work in Drupal 7 (without hacking core and with bound parameters)
- Decent PDF generation in Drupal
- Distinct options in a views exposed filter: The Views Selective Filters Module
- Bypassing Form Validations and Required Fields in Drupal: the BFV module.
- Using LINQ (Language Integrated Queries) in Drupal or how to write queries x5 faster
- Deploying Drupal Like a Pro
- Getting #2,000 requests per second without varnish
- Deploying changing module dependencies with Drupal
It's important to check links on your site to make sure they're working. Sometimes when URLs get updated, some links are forgotten. Manually checking a site for all links can be labor intensive and time consuming.
That's where Drupal's Link Checker module comes in. It's an excellent module that saves you a lot of time. This tutorial will help you to get started with it.
One reason WordPress has been gaining exponentially on Drupal over the past few years has partly been because of the massive amount of premium themes and plugins available. Slick themes with easy admin UIs and plenty of options, they are mobile responsive and have slick JQuery/Ajax integration using some of the best plugins. Drupal simply does not have this industry that has grown up around WordPress theming. Though Drupal is catching up and there are plenty of themes available for now at least WordPress has won the hearts and minds of the majority, particularly those without much technical expertise and it has proved the clear winner for small businesses and those who really do not want to get their hands dirty. Drupal 8 has done a lot to cater more to the end user but we will have to see how that plays out.
The dark of all these theming and plugin options is separating the wheat from the chaff so to speak. This is also the case with the myriad of plugins available. While drupal.org, has a peer reviewal system similar to those of scientific journals which vets every piece of code before it makes it onto Drupal.org, WordPress does not have this, and finding trusted code is about as easy as navigating the wild west. There are plenty of good resources out there but it is easy to get lost in sea of for profit plugins and themes available out there, recently I have been helping out at Themeshift.com a different way to think about the theming marketplace. Rather than display every single theme that has ever been made and make the user sort through endless options, Themeshift has a few carefully selected and curated premium themes chosen by expert WordPress developers. I have been in the position where I was waiting on clients to choose a theme, and they spend hours wading through Google, when they eventually do settle on one they like they end up purchasing one or too more until they find something they actually want to use. Themeshift takes a different view with a “curated” approach. Here the developers behind the site have taken the time to develop and choose themes that are AAA and that fit a wide variety of needs. A developer curated theming website which provides exceptional support and it is easy to reach actual humans if you have questions. It is in effect a premium segment of the “premium WordPress theme” demographic. For those that want the best and don’t want to be dealing with agents who often experience communication or cultural issues. With teams based out of both NYC and Germany Themeshift caters to a high end cleintele of developers and end users who want to buy themes from individuals they know are available and are up to date with the latest technology and design trends. Check it out and let me know what you think of my new venture, all feedback is taken into consideration!
If you are already using hook_update_N() in your custom deploy module or within a Feature to make related database changes across your development and production environments, it is an easy step to just use variable_set() to make settings changes without locking them into a Feature with strongarm. The problem is, variable_set() runs silent.
Do you use Drupal, WordPress, Joomla, Magento or other PHP software?
If you answered "yes", then you use MySQL.
MySQL is the world's most popular database program and if you build websites, you'll benefit from an understanding of MySQL.
Today, we're really happy to launch our first self-published book, MySQL Explained.
MySQL Explained is a clear, step-by-step guide that will enable you to understand how your data is being stored and give you the ability to design your own custom applications!
Add to your developer toolkit with these best 8 free, lightweight web apps and tools to improve effectiveness in your Drupal development workflow.
In our last post, we looked at why Manhattan Associates was happy with Drupal 8 from a front-end perspective. What sealed the deal for them, though, were the powerful ways they could extend and develop Drupal 8 with improved configuration management, a new Web services API, and easy internationalization.Tags: acquia drupal planet
DrupalCon Asia 2016 is shaping up to be an amazing event with participation from all of the major system integrators and the Indian Drupal community.
Did you know that companies such as TCS, Sapient, Accenture, Cap Gemini, Infosys, Cognizant, Wipro and Mindtree all have 40+ member Drupal teams? Some of these firms have 300 or 400 people working in Drupal - making them the largest employers of Drupal talent in the world.
An open-source community is also open-heart! ;) Drupalers are one of the most friendly people on Earth and they need to stick together. Knowing that, every autumn InternetDevels Drupal development company organizes a cool IT hangout called Lviv Euro DrupalCamp.
Dear drupalers, we’ve done it! :) This year’s camp has surpassed our expectations and exceeded a milestone of 200 participants. Let’s keep rocking!Read more
Unless you live under a rock you’ve likely heard that Drupal 8 has a release candidate. This means that a stable release is not far away, and now much more complex sites can be built with Drupal 8 core alone.
For a while we’ll invariably still come up against projects that we have to use Drupal 7 for because you need certain contributed modules that don’t have a Drupal 8 release yet. Here are 7 things that will help allow you to build everything in Drupal 8 faster.Help maintainers in their issue queues
When building Drupal 7 sites, take a few minutes to to look at the issue queue of the contribs you are using and help progress or close 2 to 3 of the open issues.
This is also a good way to get up to speed with a module before you use it, and looking at the issue queue is one of the ways we grade modules before using them. So it’s not a stretch to do it again for a few minutes after you have implemented the module.
For a more in depth list of things you can do to help in issue queues see:
Whenever we build a site we’ll almost always find some modules that need patches applied, often we’ll have to create these patches ourselves. Rather than store these patches in our own private project repositories we always contribute them back to the issue queue of the project.
Uploading patches to issues queues has a twofold benefit, firstly it saves the maintainer from writing this code allowing them to perhaps focus on another issue instead, and secondly it allows others to make use of the fix up until the maintainer has time to incorporate it in a release.
If you find an existing patch that no longer applies, re-roll it against the latest development branch and upload the new patch to the issue.
Also remember to upload any partial fixes or findings you turn up when investigating a problem this can potentially save the maintainer or another user you investigative time allowing them to progress the issue further.Mark issues as “Reviewed and tested by the community”
If you find an issue with a patch and successfully use the patch don’t just add a comment saying it worked for me, mark the issue status as RTBC, and comment about how the patch worked for you.
When marking an issue as RTBC you should provide some before and after information to show how the patch resolved your issue, screenshots or videos are often really helpful.
RTBC is relative. Effectively, it means "Ready to be reviewed by committers", with the assumption that enough non-committers have reviewed, tested, audited, etc, to catch the obvious problems. Different people set an issue to RTBC with various levels of effort. Some will RTBC just on a visual inspection of a patch. Others will only do so if they've reviewed, audited, applied, tested, etc, etc. Basically, you build up a reputation for how much your RTBC "counts" based on how thorough your reviews are when you mark issues that
If you work at a company with module contributors, request that they be allowed to allocate some of their time to work on their contribs. If you are in charge of developers give them time to work on contributed modules.
This has numerous benefits:
- This can allow your developers to grow their expertise while working on a project they are passionate about
- It’s now possible for developers to flag that development time was was provided by your company
- Not only is your developer giving back to the community, your company is as well
- Potential clients are likely looking for a team that is involved in the community
- Your developer will become known as contributors and will be able to make connections with other contributed module developers that may benefit you in future projects
- Drupal marketplace company listings are now weighted by community contribution
A lot of module maintainers don’t have a lot of time to spare between work and family, especially when they have multiple contributed modules. They may find it hard to allocate as much time as they like to their projects. If you are in a position to help fund some development time then you can use the contact form on the maintainers profile to get in touch.Offer to co-maintain a module
If you're doing PHP based development at all, consider looking for a module you like that is seeking co-maintainers and offer to get involved.
Some potential benefits of this:
- You may find a mentor to help you improve your coding ability
- Your giving back to the community (good karma)
- You will make connections and friendships with other developers around the world
Organise an event where people come to help upgrade modules to Drupal 8. This is possibly one of the hardest things to co-ordinate so I’m going to write a whole post about it in three weeks time.Why did I write this?
The Realityloop team are involved with a substantial amount of contributed modules, many of which we no longer actively use. Our availability to work on these ebbs and flows and we’re sure there are other developers with modules that fit this pattern.
Not all of our modules need to exist in Drupal 8, but there are several really awesome ones Stuart (Deciphered) has written that we would really like to get ported as soon as possible.
I believe that as we are working with open source we have an obligation to help sustain its ongoing development this is the reason that Realityloop:
- is a supporting partner of the Drupal Association
- organises our local meetups and camps
- share the modules we develop back to the community
- mentors at DrupalCon’s
- gives back to the community in many other ways
In many ways the power of Drupal is it’s contributed modules, it is this that allows us to build such a wide variety of sites. I’m sending a call to everyone that builds sites using Drupal to help get that power to Drupal 8 as soon as possible!drupal planet
In my last post I was giving a high level overview of why we were looking at Elm in Gizra. Since that post, we've almost completed the demo app, and we've changed our status from "Looking at Elm" to "Choosing Elm".
The reason? In short - I believe it will save us money.
(Oh, and it's fun)