2014 DevOps Day – Philippines
February 22, 2014

Microsoft Philippines

8th Floor, 6750 Ayala Ave., Makati City
{ Drupal } : Being a Rockstar

Gerald Z. Villorente

DevOps Engineer | Drupal Developer | Open-Source Enthusiast
Agenda:
Agenda:
 Community
 Code
 Deployment
 Security
 Performance
 Flexibility
 Documentation
 Drush
 Content M...
Community

Drupal is one of the largest open-source community in the planet.
April 2013
April 2013
31,721
Developers
1,034,669
Active Users
Medium
IRC, Stackoverflow, D.O forum, ...
Code

Drupal is one of the largest open-source community in the planet.
PHP
Community
Contributions
25,585 Modules
1,941 Themes
765 Distributions
2,540
Code commits
Just this week.
5,420
Issue Comments
Just this week.
Coding Standard
The Drupal Coding Standards apply to code within Drupal and its
contributed modules.
Indenting and
Whitespace
Use an indent of 2 spaces, with no tabs.
Operators

All binary operators (operators that come between two values), such
as +, -, =, !=, ==, >, etc. should have a s...
Casting

Put a space between the (type) and the $variable in a cast:
(int) $mynumber.
Control
Structures

Control structures include if, for, while, switch, etc.
Note: Don't use "else if" -- always use elseif...
Alternate control
statement
syntax for templates

In templates, the alternate control statement syntax using : instead
of ...
Line length
and wrapping

 In general, all lines of code should not be longer than 80 chars.
 Lines containing longer fu...
Function Calls

Functions should be called with no spaces between the function
name, the opening parenthesis, and the firs...
Function
Declarations

Arguments with default values go at the end of the argument list.
Class
Constructor Calls
When calling class constructors with no arguments, always include
parentheses. This is to maintain...
Arrays

Arrays should be formatted with a space separating each element
(after the comma), and spaces around the => key as...
String
Concatenations

Always use a space between the dot and the concatenated parts to
improve readability.
PHP Code Tags

Always use <?php to delimit PHP code, not the shorthand, <? .
Semicolons

The PHP language requires semicolons at the end of most lines, but
allows them to be omitted at the end of cod...
Example URLs
Use "example.com" for all example URLs, per RFC 2606.
Naming
Conventions
Naming Conventions:
Naming Conventions:

Functions
and variables

Functions and variables should be named using lowercase,...
Naming Conventions:
Naming Conventions:

Persistent
Variables

Persistent variables (variables/settings defined using Drup...
Naming Conventions:
Naming Conventions:

Constants

 Constants should always be all-uppercase, with underscores to
separa...
Naming Conventions:
Naming Conventions:

Global Variables

If you need to define global variables, their name should start...
Naming Conventions:
Naming Conventions:

Classes

See - https://drupal.org/node/608152
Naming Conventions:
Naming Conventions:

File names

All documentation files should have the file name extension ".txt"
to...
Helper Modules
Helper Modules:
Helper Modules:

Coder

Using PHP_Codesniffer, Coder includes “Coder Review” module that
can be use to che...
Helper Modules:
Helper Modules:

Dreditor

A browser plug-in for reviewing patches and more.
Helper Modules:
Helper Modules:

PAReview

A set of scripts for reviewing project applications, which runs some
coding tes...
Helper Modules:
Helper Modules:

PAReview

A set of scripts for reviewing project applications, which runs some
coding tes...
Helper Modules:
Helper Modules:

Grammar Parser
Provides an automated way of rewriting code files in compliance
with code ...
I hate doing
manual code
review!
Can I automate it? DLA!
DevOps
Loves
Automation

If you're using version control, you can take advantage the “ hook”
feature in automating all rev...
Deployment
Deployment:
Deployment:

Features

Enables the capture and management of features in Drupal. A feature
is a collection of ...
Deployment:
Deployment:

Configuration
Management

Enables the ability to keep track of specific configurations on a
Drupa...
Deployment:
Deployment:

hook_update_N()
Perform a single update. Called by update.php or drush updb.
Security

Drupal is one of the most secure open-source CMS/CMF project on
the planet. Don't argue with me!
Security:
Security:

Roles
and Permissions
Security:
Security:

Security Team

 Perform analysis of core or contributed project code.
 Resolve reported security is...
Performance

Good integration with Varnish, NginX, Memcache, etc
Caching
Caching:
Caching:

Memcache

Git /ɡɪt/ is a distributed revision control and source code
management (SCM) system with an e...
Caching:
Caching:

Varnish

Varnish is an HTTP accelerator designed for content-heavy dynamic
web sites.
Caching:
Caching:

Boost

Boost provides static page caching for Drupal enabling a very
significant performance and scalab...
Caching:
Caching:

APC

Opcode cache for PHP.
Flexibility
Flexibility:
Flexibility:

Hooks

Internal Drupal callbacks.
Flexibility:
Flexibility:

API

Application Programming Interface, a particular set of code and
specs that software progra...
Flexibility:
Flexibility:

Plethora of
Contributed Modules
and Themes
Documentation
Drush

The coolest CLI tool to manage your Drupal site.
Drush:
Drush:

Use in
Deployment
Drush:
Drush:

Remote
Management
Site alias.
Ex: drush @[SITE].[ENV] vset maintenance_mode 0 -y
Drush:
Drush:

Module
Management
Drush:
Drush:

User
Management
Drush:
Drush:

Role
Management
Drush:
Drush:

DB Management
Drush:
Drush:

Backup
Drush:
Drush:

Clearing of Cache
Drush:
Drush:

Site
Maintenance
Content
Management
Content Management:
Content Management:

Taxonomy

A powerful category system (taxonomy) that allows you to organize
and t...
Content Management:
Content Management:

Content Types
Article, News, Events, Listings, etc ...
Questions?
Thank You!
References:
References:
1. http://drupal.org
2. http://drupal.stackexchange.com
3. https://drupal.org/community
4. https:/...
Upcoming SlideShare
Loading in …5
×

Why Drupal is Rockstar?

786 views
636 views

Published on

This slide is focusing on the strength of Drupal and why it is suited for enterprise solution.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
786
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Why Drupal is Rockstar?

  1. 1. 2014 DevOps Day – Philippines February 22, 2014 Microsoft Philippines 8th Floor, 6750 Ayala Ave., Makati City
  2. 2. { Drupal } : Being a Rockstar Gerald Z. Villorente DevOps Engineer | Drupal Developer | Open-Source Enthusiast
  3. 3. Agenda: Agenda:  Community  Code  Deployment  Security  Performance  Flexibility  Documentation  Drush  Content Management
  4. 4. Community Drupal is one of the largest open-source community in the planet.
  5. 5. April 2013 April 2013
  6. 6. 31,721 Developers
  7. 7. 1,034,669 Active Users
  8. 8. Medium IRC, Stackoverflow, D.O forum, ...
  9. 9. Code Drupal is one of the largest open-source community in the planet.
  10. 10. PHP
  11. 11. Community Contributions
  12. 12. 25,585 Modules
  13. 13. 1,941 Themes
  14. 14. 765 Distributions
  15. 15. 2,540 Code commits Just this week.
  16. 16. 5,420 Issue Comments Just this week.
  17. 17. Coding Standard The Drupal Coding Standards apply to code within Drupal and its contributed modules.
  18. 18. Indenting and Whitespace Use an indent of 2 spaces, with no tabs.
  19. 19. Operators All binary operators (operators that come between two values), such as +, -, =, !=, ==, >, etc. should have a space before and after the operator, for readability.
  20. 20. Casting Put a space between the (type) and the $variable in a cast: (int) $mynumber.
  21. 21. Control Structures Control structures include if, for, while, switch, etc. Note: Don't use "else if" -- always use elseif.
  22. 22. Alternate control statement syntax for templates In templates, the alternate control statement syntax using : instead of brackets is allowed.
  23. 23. Line length and wrapping  In general, all lines of code should not be longer than 80 chars.  Lines containing longer function names, function/class definitions, variable declarations, etc are allowed to exceed 80 chars.  Control structure conditions may exceed 80 chars, if they are simple to read and understand.  Conditions should not be wrapped into multiple lines.
  24. 24. Function Calls Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon.
  25. 25. Function Declarations Arguments with default values go at the end of the argument list.
  26. 26. Class Constructor Calls When calling class constructors with no arguments, always include parentheses. This is to maintain consistency with constructors that have arguments.
  27. 27. Arrays Arrays should be formatted with a space separating each element (after the comma), and spaces around the => key association operator.
  28. 28. String Concatenations Always use a space between the dot and the concatenated parts to improve readability.
  29. 29. PHP Code Tags Always use <?php to delimit PHP code, not the shorthand, <? .
  30. 30. Semicolons The PHP language requires semicolons at the end of most lines, but allows them to be omitted at the end of code blocks. Drupal coding standards require them, even at the end of code blocks.
  31. 31. Example URLs Use "example.com" for all example URLs, per RFC 2606.
  32. 32. Naming Conventions
  33. 33. Naming Conventions: Naming Conventions: Functions and variables Functions and variables should be named using lowercase, and words should be separated with an underscore. Functions should in addition have the grouping/module name as a prefix, to avoid name collisions between modules.
  34. 34. Naming Conventions: Naming Conventions: Persistent Variables Persistent variables (variables/settings defined using Drupal's variable_get()/variable_set() functions) should be named using all lowercase letters, and words should be separated with an underscore. They should use the grouping/module name as a prefix, to avoid name collisions between modules.
  35. 35. Naming Conventions: Naming Conventions: Constants  Constants should always be all-uppercase, with underscores to separate words. (This includes pre-defined PHP constants like TRUE, FALSE, and NULL.)  Module-defined constant names should also be prefixed by an uppercase spelling of the module that defines them.  In Drupal 8 and later, constants should be defined using the const PHP language keyword (instead of define()), because it is better for performance. Ex: <?php const CACHE_TEMPORARY = -1; ?>
  36. 36. Naming Conventions: Naming Conventions: Global Variables If you need to define global variables, their name should start with a single underscore followed by the module/theme name and another underscore.
  37. 37. Naming Conventions: Naming Conventions: Classes See - https://drupal.org/node/608152
  38. 38. Naming Conventions: Naming Conventions: File names All documentation files should have the file name extension ".txt" to make viewing them on Windows systems easier. Also, the file names for such files should be all-caps (e.g. README.txt instead of readme.txt) while the extension itself is all-lowercase (i.e. txt instead of TXT).
  39. 39. Helper Modules
  40. 40. Helper Modules: Helper Modules: Coder Using PHP_Codesniffer, Coder includes “Coder Review” module that can be use to check the Drupal coding standard of your custom modules, themes, css, and javascript.
  41. 41. Helper Modules: Helper Modules: Dreditor A browser plug-in for reviewing patches and more.
  42. 42. Helper Modules: Helper Modules: PAReview A set of scripts for reviewing project applications, which runs some coding tests.
  43. 43. Helper Modules: Helper Modules: PAReview A set of scripts for reviewing project applications, which runs some coding tests.
  44. 44. Helper Modules: Helper Modules: Grammar Parser Provides an automated way of rewriting code files in compliance with code standards.
  45. 45. I hate doing manual code review! Can I automate it? DLA!
  46. 46. DevOps Loves Automation If you're using version control, you can take advantage the “ hook” feature in automating all reviews. You can combine Bash/PHP/Perl/Python script, Drush, and Coder to do the job.
  47. 47. Deployment
  48. 48. Deployment: Deployment: Features Enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.
  49. 49. Deployment: Deployment: Configuration Management Enables the ability to keep track of specific configurations on a Drupal site, provides the ability to move these configurations between different environments (local, dev, qa, prod), and also move configurations between completely different sites (migrate configurations) without the use of modules with all configuration being owned by the site.
  50. 50. Deployment: Deployment: hook_update_N() Perform a single update. Called by update.php or drush updb.
  51. 51. Security Drupal is one of the most secure open-source CMS/CMF project on the planet. Don't argue with me!
  52. 52. Security: Security: Roles and Permissions
  53. 53. Security: Security: Security Team  Perform analysis of core or contributed project code.  Resolve reported security issues in a Security Advisory.  Provide assistance for contributed module maintainers in resolving security issues.  Provide documentation on how to write secure code.  Provide documentation on securing your site.
  54. 54. Performance Good integration with Varnish, NginX, Memcache, etc
  55. 55. Caching
  56. 56. Caching: Caching: Memcache Git /ɡɪt/ is a distributed revision control and source code management (SCM) system with an emphasis on speed. - Wikipedia
  57. 57. Caching: Caching: Varnish Varnish is an HTTP accelerator designed for content-heavy dynamic web sites.
  58. 58. Caching: Caching: Boost Boost provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic. For shared hosting this is your best option in terms of improving performance.
  59. 59. Caching: Caching: APC Opcode cache for PHP.
  60. 60. Flexibility
  61. 61. Flexibility: Flexibility: Hooks Internal Drupal callbacks.
  62. 62. Flexibility: Flexibility: API Application Programming Interface, a particular set of code and specs that software programs can follow to communicate with each other.
  63. 63. Flexibility: Flexibility: Plethora of Contributed Modules and Themes
  64. 64. Documentation
  65. 65. Drush The coolest CLI tool to manage your Drupal site.
  66. 66. Drush: Drush: Use in Deployment
  67. 67. Drush: Drush: Remote Management Site alias. Ex: drush @[SITE].[ENV] vset maintenance_mode 0 -y
  68. 68. Drush: Drush: Module Management
  69. 69. Drush: Drush: User Management
  70. 70. Drush: Drush: Role Management
  71. 71. Drush: Drush: DB Management
  72. 72. Drush: Drush: Backup
  73. 73. Drush: Drush: Clearing of Cache
  74. 74. Drush: Drush: Site Maintenance
  75. 75. Content Management
  76. 76. Content Management: Content Management: Taxonomy A powerful category system (taxonomy) that allows you to organize and tag content.
  77. 77. Content Management: Content Management: Content Types Article, News, Events, Listings, etc ...
  78. 78. Questions?
  79. 79. Thank You!
  80. 80. References: References: 1. http://drupal.org 2. http://drupal.stackexchange.com 3. https://drupal.org/community 4. https://drupal.org/coding-standards 5. https://drupal.org/developing/best-practices 6. http://stauffer.com/blog/2013/03/22/why-drupal-greatest-cms-earth 7. http://drush.ws 8. https://github.com/drush-ops/drush

×