Topic Map Exporter is a configurable exporter for Drupal 7 that generates a topic map out of Drupal content. The format of the exported topic map is XTM 2.0. XTM files can be used in many topic map applications, such as Wandora (http://www.wandora.org). No similar projects exists.

Features

  • Exports different content types like nodes, users, comment and etc.
  • Exports associations between content types
  • Exporter can be configured to export specific content types and associations

Project page: http://drupal.org/sandbox/gripster/1189182
Git repo: git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/gripster/1189182.git topic_map_export

Comments

tim.plunkett’s picture

Status: Needs review » Needs work
StatusFileSize
new94.5 KB

I haven't tested the module yet, just pure code review.

Attached is a patch for mostly coding standards fixes.
You should likely also run it through coder module and see what I missed.

The biggest problem is the tpl.php files, they are full of PHP logic that should be in a template_preprocess function, and are also very confusingly indented.

Thanks!

gripster’s picture

Status: Needs work » Needs review

Hi,

I applied the patch you attached. Based on your comment I also did the following fixes:

* Fixed the indentations of the template files.
* Moved some of the programming logic away from template files into template_preprocess functions.
* Checked the Topic Map Export code trough the Coder module with minor severity selected. Only few fixable things were found.

Sorry for so late reply. I haven't been checking this issue so often. I thought that when someone would make a comment on this issue, I would receive automatic notice trough mail.

Thanks for the patch and also for the comment!

klausi’s picture

Status: Needs review » Needs work
  • check your email notifications at http://drupal.org/project/issues/subscribe-mail/projectapplications
  • It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
  • topic_map_export.module: @file doc block missing, see http://drupal.org/node/1354#files
  • Have you thought about supporting non-core entities as well? You can use entity_get_info() to retrieve info about all registered entities. But as I see you do very entity-specific things in export_batch.inc, so maybe this is not an option.
  • Add doc blocks to all your functions. Makes it also easier to identify single function blocks.
  • topic_map_export_process_associations(): do not use "/** ... */" style comments in function bodies, use "//" there.
  • class EntityEnum, class DrupalTopic: all classes need to be prefixed with your module name to avoid name clashes. Also for class DrupalAssociation
  • DrupalTopic tries to handle all entity types and is therefore quite bloated. Have you considered using inheritance and one class per entity type to simplify things?
gripster’s picture

Hi klausi,

Thanks for the feed back. I checked out suggestions that you made and here are my thoughts about them.

  • Moving from master branch to a more Drupal version spefic branch seems quite logical.
  • I'll add the missing @file and doc blocks.
  • I'll Remove the /** */ from inline comments.
  • About supporting other entities, yes I indeed have to do some pretty entity-spesific stuff, but I have planned that it should be made easy to add support for none-core entities and fields by implementing some kind of plugin architecture. For example I'm already supporting Node Refence module, but this feature is pretty much hard coded. Implementing these kind of changes will require lot of work and refactoring, so i'll won't be doing these in any near future.
  • Are you sure about adding prefixed module name to my classes? I read the coding standards documentation (http://drupal.org/coding-standards) and there wasn't any requirement todo so, I also checked some other module's code how generally classes are named. Yes the module functions have to be prefixed with module's name, but I'm not sure about classes name. Of course if required, I can add prefixed name, although class name TopicMapExportDrupalAssociation seems pretty long. Would it be okay to somekind of acronym instead of full camel-cased module name?
  • I could break DrupalTopic topic class into one BaseTopic class and into multiple subclasses that are specfic entity based classes. It would work better considering future develpment.

I'll implement these changes as soon I can find the time to do so.

misc’s picture

@gripster has been contacted to ask if the application is abandoned.

After ten weeks with a status of needs work: the applicant may be contacted by a reviewer to determine whether the application was indeed abandoned. The action taken by the reviewer should be documented in the project application issue.

http://drupal.org/node/894256

misc’s picture

Status: Needs work » Closed (won't fix)

The application has been closed. If you would like to reopen it, you are free to do so.
See http://drupal.org/node/894256#abandonedtwoweekscontact

gripster’s picture

Status: Closed (won't fix) » Needs review

I'm reopening this issue because I have made all the changes I mentioned on my previous comment and much more.

Here's the list of changes:

  • Missing @file and doc blocks have been added. As required by code review module.
  • Supported entities has been expanded to every entity type.
  • A lot of hard coded stuff has been removed.
  • Association architecture is now expandable trough use of hooks. Needs more documenting though.
  • Most of the issues brought by Code Review module have been fixed.
  • Changes made to code base have made the class definitions of DrupalTopic and DrupalAssociation obsolete. Class definitions have been removed from the module.
  • 7.x-1.x branch has been added.

All problems mentioned on previous comments should now have been fixed.

scotthorn’s picture

Status: Needs review » Needs work

This looks like a really nifty module! I have been trying to test it again a large site I manage, and had some success but noticed a few problems.

  • First, you should update your code to reflect Drupal coding standards. The pareview tool online is really handy, and there are several issues it brings up for your module. http://ventral.org/pareview/httpgitdrupalorgsandboxgripster1189182git
  • It seems the taxonomy term plugin isn't working correctly. Both times I tried to make topic maps using term references, I got this error: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=3207&op=do StatusText: Service unavailable (with message) ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7501 of /var/www/includes/common.inc).
  • It's good that you are using the 7.x-1.x branch, but you should remove all files from the Master branch except for the readme.

Keep up the great work! I look forward to making some nice graphs of the larger sites that I manage.

gripster’s picture

Status: Needs work » Needs review

Hi scottho,

Thanks for showing interest in my module. I checked and fixed the issues you mentioned in your comment:

  • Module code should now follow Drupal coding standards. Well, at least pareview sees no issues in the module.
  • Files from master branch have been removed expect for the readme.
  • I could not reproduce the same error you are having, but I made some modifications that might have fixed the problem. If you still can reproduce the error, then could you send me more data about of the error, like for example a stack trace.

Thanks again for your valuable input!

prashantgoel’s picture

patrickd’s picture

Status: Needs review » Needs work

Sorry for the long delay here :(

Your project page looks a little short, you may have a look at the tips for a great project page.

  1. .module, _permission: The permission description is not very informative, either find a more useful one or you should remove the description completely.
  2. 'restrict access' => TRUE,: This should only be used for permissions with high security impact(=: only admin should have it), is it really needed here?
  3. If you think your module provides administrative functionality, you may move it's path from topic_map/export to eg. admin/reports/topic-map/export
  4. You can also add this path as config-link by using "configure = " in your .info
  5. Your invoking hooks, you got to document them in a api.php file (have a look at core on how to do it).
  6. .module, _create_topic(): Seems to me like you're working around the entity_extract_ids() function
  7. Globals should be defined in the beginning of the file, also you should document them with /**/ not //
  8. Your switching between "" and '' very often and kind of unsystematic, maybe you could concentrate on one? Please prefer '' and use "" only when you had to escape chars otherwise.
  9. Wouldn't it make sense to put strings in your module/*.inc files into t() to make them translatable ?
  10. module_invoke_all('topic_map_export_association_info_alter', $associations);: If you want to invoke a hook that enables others to actually being able to alter the data you pass; you got to use drupal_alter() instead.
  11. Please do your function documentation this way:
    /**
     * Short function description. / Implements ... ().
     *
     * Long function description giving information about eg. what,
     * why and how something is done.
     */

As pointed out, some of these are only suggestions, apply them if you feel comfortable with them ;)

We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.

regards

gripster’s picture

Status: Needs work » Needs review

Hi,

I have gone trough issues brought up by patrickd and all of them are now fixed:

  1. Permission description has been removed.
  2. Removed the restrict access => TRUE definition. Permissions alone should be enough.
  3. Moved configuration page from topic_map/export to admin/reports/topic-map/export.
  4. Added the configuration link to the .info file. Never knew that such option even existed. :)
  5. Invokable hooks provided by the Exporter have been documented to *.api.php file.
  6. Replaced entity_get_info() with entity_extract_ids(). I was also able to remove some excess code because of this change.
  7. Moved globals to the beginning of file and changed comment markup from // to /**/.
  8. All string escapes are now in '' and in future I'll stick with the '' escaping.
  9. All module/*.inc strings are know passed trough t() function.
  10. Data alterations are now done with the drupal_alter() function.
  11. I'm not sure if I have done the function documentation as you described, but I cleaned up most the function commenting in the module.

I beefed up the project page a little bit. It now has some additional information.

Thanks for reviewing Patrick.

caiovlp’s picture

Status: Needs review » Needs work

Hello,

I strongly advise you to use the link below to review your application. There are a few coding standard errors and using the tool below you will be able to make changes and verify them by yourself before submitting to the review process.

http://ventral.org/pareview

And please create a new branch and set it as the default:
http://drupal.org/node/1127732
http://drupal.org/node/1659588

Let me know if you need help with anything.

Regards,
Caio

gripster’s picture

Hi,

Thanks for the input. I set the 7.x-1.x as my default branch and deleted the master branch. I also fixed few of the white space and commenting issues brought up by pareview.

The function naming issues brought up by the pareview can be ignored. Issues are about the submodules extending my module hook_topic_map_export_association_info().

gripster’s picture

Status: Needs work » Needs review
miksan’s picture

Without having tested the module I think the code looks pretty good/complete.
I have however a few remarks:

  1. In general I miss documentation for @param(s) and @return in documentation blocks throughout the code.
  2. The different types of 'export types' are defined in .inc files in a directory called: 'modules'. To avoid confusion about the meaning of the directory I think would be a better call it: 'plugins' or something similar. Otherwise one might think that it contains Drupal submodules.
  3. export_batch.inc, line 168: You are encouraged to make use of the Drupal API as much as possible. Is there any particular reason why you make use of fwrite instead of for instance file_save_data (http://api.drupal.org/api/drupal/includes!file.inc/group/file/7)?
a_thakur’s picture

Looks good to me, a quick feedback, please include decription in the implementation of hook_permission(Line#49 of .module file). Would revert back after testing the functionality of the module.

gripster’s picture

Hi miksan,

In the response to your suggestions I made the following changes:

  1. I applied some more doxygen style commenting to some functions.
  2. 'Modules' directory has been renamed as 'plugins'.
  3. I'm using fwrite because I need to write the exported file sequentially. None of drupal's file api functions would not allow me to this. However, previously there was no entry made of exported file to Drupal's file table. Now exported file is saved as a temporary file by using the file_save function.

Thanks for review.

gripster’s picture

Hi a_thakur,

I added an additional description to hook_permission.

Thanks for the input!

killerpoke’s picture

Assigned: Unassigned » killerpoke
killerpoke’s picture

Status: Needs review » Reviewed & tested by the community

It looks good to me.

Some issues I found:

Automated test & general stuff
--------------------------------------------
> I added the url to your git repo
> Automated testing found one error: http://ventral.org/pareview/httpgitdrupalorgsandboxgripster1189182git (you should fix it, but that's not super important I guess)
> Your code does not seem very well commented, please make sure it´s clearly understandable by other developers. Please have a look at the module documentation guidelines and the Doxygen and comment formatting conventions. I think your function and general comments are really ok, however there aren't much comments inside functions, so it's really hard to read your code.

Line by line coding review
--------------------------------------------
> In your README.txt there is a wrong link on line 16
> I couldn't really check the functionality because I don't want to download 180MB wandora…, however the export-functionality and the XML-output looks fine.

I haven't found any big issues, and think your code is well written.
I'm going to change the status to RTBC

killerpoke’s picture

Assigned: killerpoke » Unassigned
patrickd’s picture

Assigned: Unassigned » patrickd
patrickd’s picture

Status: Reviewed & tested by the community » Fixed
  • If your including files of your own module you don't have to use drupal_get_path(); dirname(_FILE_) would do the same with less impact
  • in api.php, line 90, there's the hook_ missing
  • Never use 1 or 0 for boolean values -> always use TRUE or FALSE
  • catch (Exception $e) { watchdog_exception('topic_map_export', $e);I don't think PHP exception strings will already be encoded properly. Maybe you better make use of check_plain() here because the $message will not be filtered before it will be displayed on the logs.
  • You don't have to tunnel a variable through check_plain() or filter_xss() if you already filtered it correctly by t(). (I know automated reviews complain about this, but this one is a false positive). I highly recommend you to read the documentation about how to write secure code: http://drupal.org/writing-secure-code

But I couldn't find any major issues

Thanks for your contribution!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Adding direct git repo url