CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Visualising Extensions
Pages: [1]

Author Topic: Visualising Extensions  (Read 468 times)

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Visualising Extensions
October 16, 2013, 09:16:49 am
This might sound like a merging of my two Dalesbridge CiviSprint passions, but who else would be interested in an extension that produces a visualisation of the code of other extensions or drupal modules? This would ideally show function call trees and dependencies, etc.

Does anyone know of any PHP script that could be adapted for this purpose? Or does anyone know of a drupal module that does this anyway? I saw Visualization Backtrace, but that's more on a page by page basis, I just want an overview of the whole module/extension.

Thanks in advance.


If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: Visualising Extensions
October 16, 2013, 09:59:08 am
Just a guess, but you might want to look through open source projects that handle code coverage. And given the domain, you might want to expand to look at non-PHP languages as well. For this specialized audience, I think you could put an onus on the users/developers to install other language packages if necessary.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Visualising Extensions
October 16, 2013, 11:24:59 am
To get the call trees and dependencies, you'd have to decide whether to do a static analysis or dynamic analysis. I haven't personally done much with this but feel there are some well-known tradeoffs:

 * For static analysis, you need the source-code files and something like https://github.com/nikic/PHP-Parser to parse the code. This is probably faster and doesn't require you to predefine the "representative use-case", but it suffers a key limitation: really dynamic code (like the hook system used in Drupal/Civi) is difficult to analyze. (With PHP code like "call_user_func($f)" or "$f()", you need to know the value of $f, and that's Hard to foresee without executing the code.)
 * For dynamic analysis, you need to define some real use-cases; execute the software with those use-cases; and collect data based on what happens. Xdebug is often used to collect this kind of trace. You need to define good/representative use-cases for this to work, but dynamic code doesn't pose such a challenge (eg "call_user_func($f)" is executed for real, so there's no mystery about what it does).

It looks like Visualize Backtrace aims to support dynamic analysis based on xdebug. However, they don't seem to define the "representative use-cases" -- you need to come up with your own use-cases and generate the XDebug data. One possibility is to collect XDebug traces while running each the test-suite for each component/extension/module.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Visualising Extensions

This forum was archived on 2017-11-26.