Description:
-----------
Faq_Ask is a companion module to FAQ, which has already been ported to D6. The Faq_Ask module allows the user to implement an "Ask the Expert" or advice feature that then feeds the site's FAQs. This module's owner is very busy with several other modules and customers. It would be nice to not only have this module done, but also a handbook page created that can serve as a case study providing concrete examples of upgrade tasks for other module developers.

Deliverables:
------------
1) An upgrade patch to the latest -dev version of Faq_Ask module that is ready to be committed.
2) One or more handbook page(s) that are ready to be published describing the steps and tasks required to convert the module.

Resources:
---------
Project page: http://drupal.org/project/faq_ask
Documentation page: http://drupal.org/node/192806
D5->D6 Conversion page: http://drupal.org/node/114774
Coder module: http://drupal.org/project/coder (may be very useful in identifying the tasks).
FAQ project page: http://drupal.org/project/faq

Primary contact:
---------------
Nancy Wichmann: http://drupal.org/user/101412
Email: nan_wich@bellsouth.net

Comments

nancydru’s picture

Title: GHOP #xxx - Convert Faq_Ask to D6 and Document Steps » GHOP #160 - Convert Faq_Ask to D6 and Document Steps
aclight’s picture

The official task associated with this issue is at:
http://code.google.com/p/google-highly-open-participation-drupal/issues/...

nancydru’s picture

Claimed by Corsix.

corsix’s picture

Status: Active » Needs work
StatusFileSize
new16.23 KB

Basic functionality is converted, needs more work though.

nancydru’s picture

Wow that was fast. How is the documentation going?

corsix’s picture

Status: Needs work » Needs review
StatusFileSize
new21.53 KB

First draft of handbook page: http://drupal.org/node/212702
Also attached updated patch.

nancydru’s picture

Looking good.

A large number of fixes to coding style were made during the porting process. Updating to the new standards is a perfect time to get a refresher on all the standards which didn't change!

This is interesting since the Coder module shows no standards violations.

corsix’s picture

It is odd that coder didn't pick up on them, however some excerpts from the patch file to show what I mean:

-  if ($user->uid == 0) { return null; }
-  
+  if ($user->uid == 0) {
+    return null;
+  }
+

Control strucutres shouldn't be all on one line, trailing spaces should be removed (personally I find it very odd that that trailing spaces is mentioned on http://drupal.org/node/539 and not on http://drupal.org/coding-standards, but that's another matter).

-      $result = db_query("SELECT u.mail FROM {faq_expert} e JOIN {users} u USING (uid) WHERE e.tid=%d", $category);
+      $result = db_query('SELECT u.mail FROM {faq_expert} e JOIN {users} u USING (uid) WHERE e.tid=%d', $category);

Single quotes strings are prefereable to double quoted, where possible.

+  if (count($result) > 0) {
+    drupal_set_message(t('faq_ask module installed.'));
+  }
+  else {
+    drupal_set_message(t('faq_ask table creation failed. Please "uninstall" the module and retry.'));
   }
-
-  if ($result) { drupal_set_message(t('faq_ask module installed.')); }
-  else { drupal_set_message(t('faq_ask table creation failed. Please "uninstall" the module and retry.')); }

Again, control structures.

-        $left = null;  
+        $left = null;

Again, trailing spaces.

nancydru’s picture

Hmm... Maybe I should let the Coder maintainers know.

Thanks again for doing this.

BTW, you probably should assign this to yourself.

webchick’s picture

There are under 3 hours for students to claim tasks. I assume since Corsix is in Germany, he's sleeping since it's like 3am there. ;)

However, it'd really help nancy, if you could post a summary of what's left to be done on this task on the off-chance he gets up early enough to finish it off so he can claim another. Alternately, if you feel it's working, please say so and we can mark it fixed so he can claim is 15th (and final) task.

nancydru’s picture

I sent him an email with a screenshot of a failed patch run. The patch looks good to me, but failed. The documentation is pretty good.

BTW, he's listed as UK.

nancydru’s picture

@corsix: It looks like you might have started with the beta4 official release rather than the more current -dev release which has had several more commits made to it.

corsix’s picture

StatusFileSize
new21.52 KB
corsix’s picture

StatusFileSize
new21.71 KB

Made some changes needed from moving D6RC2 -> D6CVS

corsix’s picture

http://img102.imageshack.us/my.php?image=image1wy8.png is a screenshot of some of my testing, but will continue working on this until it's finished.

webchick’s picture

I gave this a run-through tonight before the task deadline. I can't speak with certainty whether it's 100% correct, and there are some notices that still need checking that didn't appear due to patching against RC2. HOwever, the bulk of the work looks like it's done, and the handbook page is in good shape. So we've marked this task complete over in the Google tracker.

Leaving this as needs review.

nancydru’s picture

After I added some blank lines at the end of each section, it applied. Now to some testing...

nancydru’s picture

Hmm... I added a new user and gave her all permissions. She is not being shown in the expert's list. I think thsi also exists in D5 - "authenicated users" are not actually assigned that rid.

I am also not getting an "Ask a question" menu item.

Entering http://d6test/faq_ask gets access denied.

douggreen’s picture

corsix wrote:

"Single quotes strings are prefereable to double quoted, where possible."

Does it say so in the coding standards?

I don't think that this is true. Yes, single quotes take slightly less processing time ot handle, but when quoting SQL, it's better to use double quotes because the ANSI SQL standard uses single quotes ONLY for quoted terms. Thus, it's a lot easier to read a SQL string that is "SELECT * FROM {node} WHERE title LIKE '%something%'" instead of 'SELECT * FROM {node} WHERE title LIKE \'%something%\'' and actually prevents people from mistakenly using double quotes as in 'SELECT * FROM {node} WHERE title LIKE "%something%"'.

corsix also writes:

trailing spaces should be removed (personally I find it very odd that that trailing spaces is mentioned on http://drupal.org/node/539 and not on http://drupal.org/coding-standards, but that's another matter).

... Which is why they aren't checked for by coder, because their not in the coding standards document. I guess checking for trailing spaces wouldn't be terrible, but the use of tabs causes people many more problems than trailing spaces. These are easy to fix though, :%s/ *$//g

webchick’s picture

We use Drupal core as a benchmark for what the coding standards should be, because that has by far the most eyes/quality control on it. If core does something consistently, then that's the coding standard, regardless if anyone's gotten around to writing it up in the coding standards document "formally" yet.

However, if you see things like that that aren't yet updated (no trailing spaces, etc.) then please feel free to amend the standards accordingly so they reflect the "working" standard.

corsix’s picture

The coding standards document in CVS does now mention tailing spaces, but that is only periodically copied across to the d.o page (see http://drupal.org/node/205432).

nancydru’s picture

@Angie: I understand what you're saying but this is not a good practice; I've never encountered any IT organizations that allow such things. (I am a professional, certified project manager.) Standards should be hard rules that are approved by some form of approval body (even if that's only one person) after appropriate discussion. If any "Joe Drupal" may change the standards any time he/she feels like it, we will have a shambles and there is no way Doug, or any developer, would be able to keep up.

  1. If it's not officially approved, it cannot be documented.
  2. If it's not officially documented, it cannot be a standard.

So, having stated my piece, this is really not the appropriate issue to be discussing this.

webchick’s picture

I'm willing to bet that most IT organizations are not open source projects. ;)

But we can discuss the concept of a "gatekeeper" to the coding standards @ the webmasters queue.

corsix’s picture

StatusFileSize
new21.73 KB

In the previous patch, an extra space somehow got into the menu access arguments key for the faq ask page, leading to the page access problem.

nancydru’s picture

Yes, that fixed both of those problems. I am still testing. I have found some silly little things that have always been there. And I fixed the "authenticated user" expert problem.

nancydru’s picture

Status: Needs review » Needs work

The "url" and "l" functions have changed: http://drupal.org/node/114774#url

corsix’s picture

Status: Needs work » Needs review
StatusFileSize
new22.25 KB

Not sure how I missed those, but they are updated now :)

nancydru’s picture

Thanks. I'll do some more testing. Please don't forget the handbook page.

nancydru’s picture

Any ideas on this:

# user warning: Duplicate entry '0-5' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (5, 5, 0) in C:\www\drupal-6\modules\taxonomy\taxonomy.module on line 690.
# user warning: Duplicate entry '1-5' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (5, 5, 1) in C:\www\drupal-6\modules\taxonomy\taxonomy.module on line 690.

This looks like it might be a core bug http://drupal.org/node/213591

nancydru’s picture

As soon as the "url" changes get posted to the handbook page, I'll mark this RTBC.

nancydru’s picture

Status: Needs review » Needs work
corsix’s picture

Status: Needs work » Needs review
StatusFileSize
new23.21 KB

Updated patch; hook_menu no longer calls t(), as it is done automatically by menu, calls to watchdog() no longer use t(), as it is done automatically.

Updated documentation page; additions and corrections.

nancydru’s picture

Thank you, Peter. How are your other GHOP's doing?

nancydru’s picture

Status: Needs review » Reviewed & tested by the community

Okay, I can't find any more problems that are within your realm. Thanks a bunch, Peter.

PS: want to convert any more modules? I have several.

corsix’s picture

Another one would be good (hopefully I'll do more of these changes in the 1st iteration), but I'd want to get my final GHOP out of the way first.

nancydru’s picture

Status: Reviewed & tested by the community » Fixed

6.x-1.x-dev has now been created.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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