Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Plugins: A double-edged sword

2 718 vues

Publié le

As most WordPress users know, plugins can be used to enhance WordPress sites in many ways. Unfortunately, they can also easily break your work. From javascript errors to buggy updates, from slow-performing code to stylesheet conflicts, this talk aims to help users identify and troubleshoot problems with plugins as they work on their creations.

Publié dans : Technologie, Art & Photos
  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

Plugins: A double-edged sword

  1. 1. @ylefebvre ylefebvre.ca Plugins A Double-Edged Sword Yannick Lefebvre Plugin Developer Presentation available at: yannickcorner.nayanna.biz/wcmtl2013
  2. 2. @ylefebvre ylefebvre.ca Plugins: A Double-Edged Sword ● About me ● The power of plugins ● The wild nature of plugins ● Site-building strategies ● Troubleshooting plugin issues ● Handling problematic updates ● Avoiding bad plugin breakups ● Conclusions
  3. 3. @ylefebvre ylefebvre.ca About ME ● Using WordPress since 2004 ● Released first plugin (Link Library) in 2005 ● Released 8 Plugins on the official repository
  4. 4. @ylefebvre ylefebvre.ca The Power of Plugins ● Custom code modules that can be downloaded and added to WordPress ● Can change almost any aspect of WordPress – Add extra content / new functionality – Modify / enhance default behavior – Simplify complex tasks
  5. 5. @ylefebvre ylefebvre.ca The Power of Plugins ● Allow integrators to create custom content without modifying core ● Large developer community ● More than 25 000 plugins available, plus premium plugins!
  6. 6. @ylefebvre ylefebvre.ca The Wild Nature of Plugins ● Only available on self-hosted installs ● No enforced coding standard ● Difficult to assess performance and quality ● No code reviews ● No easy way to identify bad updates ● Difficult to predict interaction with site and other plugins
  7. 7. @ylefebvre ylefebvre.ca Building a site with plugins... ...can feel A BIT UNSTABLE
  8. 8. @ylefebvre ylefebvre.ca Site-building strategies ● Perform due diligence on a plugin – Version compatibility – Number of downloads – Positive / Negative ratings – Number of resolved support threads
  9. 9. @ylefebvre ylefebvre.ca Site-building strategies ● Assess plugin functionality through docs and examples ● Create a development site to test before deployment ● Only add one plugin at a time
  10. 10. @ylefebvre ylefebvre.ca Site-building strategies ● Measure site performance before and after plugin installation – Front-end and admin pages – Log out to see regular visitors performance
  11. 11. @ylefebvre ylefebvre.ca Troubleshooting plugin issues ● Deactivate the last plugin installed ● Deactivate all other plugins and bring back one at a time to identify source of conflict ● Visit the official plugin page – Installation procedure – FAQ – Support Forum ● Contact the plugin author
  12. 12. @ylefebvre ylefebvre.ca TROUBLESHOOTING Styling issues ● Many plugins render content on site pages ● Usually provide their own styling for this content ● Stylesheets don't always like to agree with each other
  13. 13. @ylefebvre ylefebvre.ca TROUBLESHOOTING Styling issues
  14. 14. @ylefebvre ylefebvre.ca TROUBLESHOOTING Styling issues ● Theme can be modified – Users don't always know full impact of changes ● Plugin stylesheet can be modified – Avoid changing plugin files (Plugin updates override file changes) – Backup files if no other option – Some plugins have stylesheet editors – The !important CSS keyword is very useful
  15. 15. @ylefebvre ylefebvre.ca Troubleshooting jQuery issues ● Most animated / dynamic site elements today are powered by jQuery ● jQuery conflicts can easily occur when a theme and one or more plugins are mixed ● A conflict usually breaks all jQuery elements on a site
  16. 16. @ylefebvre ylefebvre.ca ● FireBug (getfirebug.com) is the perfect tool to identify jQuery / javascript conflicts Troubleshooting jQuery issues
  17. 17. @ylefebvre ylefebvre.ca TYPICAL JQUERY ISSUES ● More than one copy of jQuery.js is loaded – Verify in page source code – Each additional copy wipes out previous work ● An incompatible version of jQuery is loaded – E.g. Google API version loaded for speed boost
  18. 18. @ylefebvre ylefebvre.ca TYPICAL JQUERY ISSUES ● Multiple versions of javascript/jQuery library are loaded by different plugins ● Theme or plugin jQuery code uses unavailable jQuery shorthand – All jQuery calls should use jQuery long-form instead of $ or re-create the shorthand themselves
  19. 19. @ylefebvre ylefebvre.ca Troubleshooting jQuery issues ● In the previous example, two plugins were loading different versions of the same jQuery library
  20. 20. @ylefebvre ylefebvre.ca Troubleshooting upload issues ● Lack of permissions – Increase write permissions on upload folder ● Exceeding server maximum upload file size – Not controlled by WordPress – Set in server php.ini file (default often 8 MB) – Plugins can display current settings (e.g. WordPress phpinfo) – See with hosting company to change settings
  21. 21. @ylefebvre ylefebvre.ca Troubleshooting upload issues
  22. 22. @ylefebvre ylefebvre.ca Handling problematic updates ● After updating a plugin – Your entire site stopped working – All of your javascript-based code stopped working – The plugin's expected output no longer works
  23. 23. @ylefebvre ylefebvre.ca
  24. 24. @ylefebvre ylefebvre.ca ● Deactivate and reactivate updated plugin(s) – Ensures that activation routines are executed (e.g. Database updates, creation of new option default values) – Essential when uploading plugins via FTP – Plugin reboot Handling problematic updates
  25. 25. @ylefebvre ylefebvre.ca Handling problematic updates ● Identify the problematic plugin through error messages (often contain plugin path) ● Revert to the plugin's previous version from your most recent site backup
  26. 26. @ylefebvre ylefebvre.ca Handling problematic updates ● Check for previous versions
  27. 27. @ylefebvre ylefebvre.ca Handling problematic updates ● Not all plugins list previous versions
  28. 28. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions ● Trac is a web-based interface for the Subversion system where all WordPress.org plugins are stored
  29. 29. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions Current plugin version is usually trunk
  30. 30. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions Viewing the plugin trunk and selecting the Revision Log
  31. 31. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions Select latest version in left column and known working version in right column
  32. 32. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions Click View changes
  33. 33. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions
  34. 34. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions At page bottom, download archive containing old versions of changed files
  35. 35. @ylefebvre ylefebvre.ca FIND previous PLUGIN versions ● Once you have the previous version – Upload to your server via FTP – Stop updating until you see a message indicating that the issue has been resolved
  36. 36. @ylefebvre ylefebvre.ca Avoiding bad plugin breakups ● User-triggered breakup – Better solution available – Extra functionality no longer required ● Plugin-triggered breakup – Plugin converted to paid model – End of development life – Lack of support for new versions
  37. 37. @ylefebvre ylefebvre.ca Avoiding bad plugin breakups ● Many plugins store user information to the database to provide additional capabilities – Custom fields – Custom post types – Custom tables ● Not all developers consider what will happen if users decide to stop using their plugin
  38. 38. @ylefebvre ylefebvre.ca Avoiding bad plugin breakups ● Before deploying plugins, analyze the effects of deactivation to prepare for eventual breakup – Clean removal – Ease or difficulty of accessing custom data – Core data modifications – Broken site
  39. 39. @ylefebvre ylefebvre.ca Conclusions ● Plugins are amazing tools that can greatly enhance your site ● Plugins are potential liabilities that can break your site ● When used with caution, plugins bring limitless possibilities to web site creation
  40. 40. @ylefebvre ylefebvre.caBryanBerg,Architect
  41. 41. @ylefebvre ylefebvre.ca Recommended Readings ● Learn about plugin development – WordPress Plugin Development Cookbook by Yannick Lefebvre, published by Packt Publishing (packtpub.com) – Use code WCMONTREAL13 to get 75% off ebook on packtpub.com (until Aug 1) ● Find help when you run into issues – WordPress Support Forum (wordpress.org/support) ● Today's presentation available at: – http://yannickcorner.nayanna.biz/wcmtl2013
  42. 42. @ylefebvre ylefebvre.ca Thank you for attending this talk on Plugins Questions? Presentation: http://yannickcorner.nayanna.biz/wcmtl2013 ylefebvre@gmail.com profiles.wordpress.org/users/jackdewey Use code WCMONTREAL13 to get 75 off% WordPress Plugin Development Cookbook ebook on packtpub.com (until Aug 1)