How to? Drupal developer toolkit. Dennis Povshedny.

26
How to? Drupal developer toolkit Dennis Povshedny http://donetsk.drupal.ua

Transcript of How to? Drupal developer toolkit. Dennis Povshedny.

Page 1: How to? Drupal developer toolkit. Dennis Povshedny.

How to? Drupal developer toolkit

Dennis Povshedny

http://donetsk.drupal.ua

Page 2: How to? Drupal developer toolkit. Dennis Povshedny.

How to? Drupal developer toolkit

Drupal Camp Donetsk

November 2011

Dennis Povshedny

Page 3: How to? Drupal developer toolkit. Dennis Povshedny.

Drupal developer toolkit

Two major areas to discuss:

Technical tools Organizational hints

80% is a 'should' not a 'must'

Page 4: How to? Drupal developer toolkit. Dennis Povshedny.

Technical tools

The platform: *AMP Developer sofware toolkit

Page 5: How to? Drupal developer toolkit. Dennis Povshedny.

LAMP / WAMP

OS Linux / Windows / Virtual Machine

Page 6: How to? Drupal developer toolkit. Dennis Povshedny.

LAMP / WAMP

Webserver Apache / nginx / Microsoft IIS

Any Apache version is fine (1.3, 2.0, 2.2) . Enable mod_rewrite .

Page 7: How to? Drupal developer toolkit. Dennis Povshedny.

LAMP / WAMP

Database MySQL / Postgres / SQLite

SQLite implementation is still weak; Postgres users may have problem with some

modules

Page 8: How to? Drupal developer toolkit. Dennis Povshedny.

Tune MySQL

Adjust default MySQL 5.x settings

innodb_buffer_pool_size = 256M innodb_flush_log_at_trx_commit=2 innodb_flush_method=O_DIRECT innodb_log_file_size = 128M innodb_log_buffer_size= 4M

Page 9: How to? Drupal developer toolkit. Dennis Povshedny.

LAMP / WAMP

Page 10: How to? Drupal developer toolkit. Dennis Povshedny.

Tune PHP

Tune PHP modules / settingsphp5-gd, php5-xdebug, php5-pdo,

php5-mysql(i), php5-xml

memory_limit 128M (check)

register_global off

max_execution_time 30

sendmail or module SMTP

Page 11: How to? Drupal developer toolkit. Dennis Povshedny.

Development tools: debugging

Use xdebug (default port: 9000) Use the 'watchdog' function watchdog( 'Apache Solr',

'Adding @count documents.',

array('@count' => count($documents))

);

Page 12: How to? Drupal developer toolkit. Dennis Povshedny.

'watchdog' function result

http://example/admin/reports/dblog

Page 13: How to? Drupal developer toolkit. Dennis Povshedny.

● Arrays, arrays, more arrays, nested arrays, ...

object(stdClass)[57]…public 'rdf_mapping' => array 'rdftype' => array 0 => string 'sioc:UserAccount' (length=16) 'name' => array 'predicates' => array … 'homepage' => array 'predicates' => array … 'type' => string 'rel' (length=3)

Use dpm() function from the module 'devel'

Page 14: How to? Drupal developer toolkit. Dennis Povshedny.

Need to run quick PHP snippet?

Such things are nice: http://ideone.com (no Drupal there)

However this is better:

http://example.local/devel/php

(by devel module, with Drupal stuff)

Page 15: How to? Drupal developer toolkit. Dennis Povshedny.

Environment tools

Version control system Integrated development environment Drupal ecosystem

We're at 50% of slides!

Page 16: How to? Drupal developer toolkit. Dennis Povshedny.

Version control system

Git / SVN / Mercurial

SVN – simple, centralized Git – complicated, native for Drupal,

powerful Mercurial – in between CVS – outdated! Other: Bazaar, MS TFS (former VSS)

Page 17: How to? Drupal developer toolkit. Dennis Povshedny.

Use IDE

IDE NetBeans / Eclipse / CodeLobster

Provides syntax highlighting, autocompletion, integration with debugging and VCS.

Page 18: How to? Drupal developer toolkit. Dennis Povshedny.

Environment tools

Install several browsers for different user roles

or use Masquerade module

Often you'll need to see the site by different groups of users – administrators, anonymous users, registered users, etc . Several browsers is more preferable – this have other usage as well.

Page 19: How to? Drupal developer toolkit. Dennis Povshedny.

Respect Drupal ecosystem

Drupal directory structure PHP/Drupal coding style Doxygen

Page 20: How to? Drupal developer toolkit. Dennis Povshedny.

Location of custom code / themes

Place all downloaded and handmade packages under

sites/all/modules/ , sites/all/themes/

Even better is to split sites/all/modules/contrib/ sites/all/modules/custom/

Page 21: How to? Drupal developer toolkit. Dennis Povshedny.

Drupal ecosystem

Follow the coding style.

Use correct variable_names, ClassNames,tab settings, comments. see

http://drupal.org/coding-standards

Page 22: How to? Drupal developer toolkit. Dennis Povshedny.

Respect Doxygen headers.

That is the reason why do we have nice documentation out-of-box at http://api.drupal.org .

/** * Fetches a user object based on * an external authentication source. * * @param string $authname * The external authentication username. * * @return * A fully-loaded user object if the user * is found or FALSE if not found. */function user_external_load($authname) {

Page 23: How to? Drupal developer toolkit. Dennis Povshedny.

BONUS TRACK: I NEED MORE!!

Page 24: How to? Drupal developer toolkit. Dennis Povshedny.

What's next?

Nice FF plugins like Poster https://addons.mozilla.org/en-US/firefox/addon/poster/

Firebug, extended integration http://drupal.org/project/drupalforfirebug

Drush – DRUpal Shell TRAC/RedMine PHP 5.2/PHP 5.3 on the same machine APC/xCache/eAccelerator Contribute! Make session

Page 25: How to? Drupal developer toolkit. Dennis Povshedny.

Useful links http://drupal.org/requirements

http://www.denwer.ru

http://drupal.org/requirements

http://drupal.org/project/smtp

http://localhost/phpinfo.php :)

http://drupal.org/project/devel

http://drupal.org/project/coder

http://git-scm.com/

http://drupal.org/project/masquerade

http://ideone.com

http://example.local/devel/php

http://drupal.org/coding-standards

http://api.drupal.org

http://drupal.org/project/drupalforfirebug

Page 26: How to? Drupal developer toolkit. Dennis Povshedny.

Thank you!

Dennis Povshedny

Freelance IT expert

+38 096 2323346

Skype: djdenikin

http://drupal.org/user/117896