The current code base does not have a proper API to deal with comment revisions. Functions that should be API functions display forms instead. Please start with a bunch of API functions for CRUD actions and to list all available revisions for a certain comment. Build the interface on top of that.

I am not sure I want to integrate my code with Comment Revisions if there is no real API to work with. See #1036484: Comment Revision integration and #1033290: Port Comment Revisions to D7.

Also, pretty please don't set useless messages in hook_install() that say the module is being installed or that the installation succeeded. The user hit the button on purpose, so he knows stuff is going to be installed. Check out Coder to make your code compliant with the coding standards.

Comments

thinkyhead’s picture

6.x-2.x branch isn't being updated at this time. The 6.x-1.x branch has been incorporating cleanups begun by the original author in the 2.x branch, but no major changes. I'd like to retire 6.x-2.x but the version may need bumped up to 2.x at some point, such as when that proper API has been added.

In that regard are you looking for hooks and actions, or just standardized public function calls? Edumacate me.

xano’s picture

A good start would be a full CRUD API. Hooks could be useful. I'd make something similar to node revision and comment hooks then. If you decide to write these changes for a D7 version only, you can look into entity API.

thinkyhead’s picture

Ok. I've never heard of CRUD before - though apparently it's been a hot topic for 2 years - but I've just looked at it the initial proposal and some threads on the topic. It definitely neatens up database code a lot. Probably all modules that create database entities should use it. But how is it supported in D6 right now? And does comment.module implement it? Would I need to do this on behalf of comment.module?

At the moment I'm clearing up the remaining issues with 1.x and integrating the diff.patch, which adds some theming wrappers to the module. I'll release 6.x-1.2 as soon as that's ready, and then look at CRUD more closely.

thinkyhead’s picture

Title: There is no proper API » Add support for CRUD API
Version: 6.x-2.x-dev » 6.x-1.1
Assigned: Unassigned » thinkyhead
Category: bug » feature
xano’s picture

CRUD is just an acronym for CReate, Update and Delete. This idea has been existing from before Drupal was born. Entities are new in Drupal 7, but you have nothing to worry about for the Drupal 6 version of Comment Revisions (if you want to release a new version for D6, that is).

It might be a good idea to list all the features and design flaws in the current version and decide whether you want to (and can) support a completely new Drupal 6 version, or that the new version will be for Drupal 7 only (considering entity API *is* very cool).

thinkyhead’s picture

I certainly love the concept, and I'm definitely on course to do at least one or two more D5+D6 releases to fix all remaining issues. I already have the new permissions and simplified options done, just going over the Diff patch today.

Do you know offhand any examples of modules implementing CRUD in D6 - and of course in D7? I've seen some chat about copying 'crud.inc' into a module and using it in D6 but haven't found specifics. I'll keep poking around. I saw that Webchick started CRUD stuff for D6 a couple years ago but apparently it never got integrated.

UPDATE: Aha! The D6 version of Backup and Migrate module has a crud.inc.

UPDATE: Ah, okay, so the gist seems to be - there's no such thing as a "CRUD standard," you just provide C, R, U, & D functions however it's logical. But D7 has facilities that generalize the idea. Am I getting warm? :-)

xano’s picture

CRUD is just a concept, nothing more. It means that you have an API (a set of functions) for create, update and delete actions. Most of it already exists in the current code, but it's messy and inconsistent.

xano’s picture

Stop editing your post :-P

There is no CRUD standard, a library or anything of the kind. It's just a couple of functions. I must admit that I haven't explained the acronym quite well. It's not CReate, Update and Delete, but Create, Read, Update and Delete.

In Drupal, create and update are usually merged in one save function, and read is called load. For Comment Revisions this means we'd get commentrevisions_load(), commentrevisions_save() and commentrevisions_delete().

Note that I removed the underscore from comment_revisions. Underscores in project names are bad. I know you're not the original maintainer, but you might want to consider removing it from the next major version. When editing the project page, you can add an alias to it, so that http://drupal.org/project/comment_revisions and http://drupal.org/project/commentrevisions both point to the same project.

xano’s picture

Title: Add support for CRUD API » CRUD API
Version: 6.x-1.1 » 6.x-2.x-dev

Updated title and version. It's not a good idea to introduce this kind of changes to an existing branch.

thinkyhead’s picture

Version: 6.x-2.x-dev » 6.x-1.2
Status: Active » Needs review

Added the appropriate CRUD-esque operations to version 1.3. Mixed items will take a single vid or an array of vids.

  • comment_revisions_create_revision(array $info)
  • comment_revisions_load_revision(mixed $vid)
  • comment_revisions_revert_revision(mixed $vid)
  • comment_revisions_delete_revision(mixed $vid)
  • comment_revisions_purge_revision(int $cid)
thinkyhead’s picture

Status: Needs review » Closed (fixed)