GHOP #160 - Convert Faq_Ask to D6 and Document Steps

NancyDru - January 18, 2008 - 22:26
Project:FAQ_Ask
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:GHOP
Description

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

#1

NancyDru - January 18, 2008 - 22:29
Title:GHOP #xxx - Convert Faq_Ask to D6 and Document Steps» GHOP #160 - Convert Faq_Ask to D6 and Document Steps

#2

aclight - January 19, 2008 - 02:38

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

#3

NancyDru - January 21, 2008 - 17:34

Claimed by Corsix.

#4

corsix - January 21, 2008 - 20:09
Status:active» needs work

Basic functionality is converted, needs more work though.

AttachmentSize
faq_ask_d6.patch 16.23 KB

#5

NancyDru - January 21, 2008 - 22:11

Wow that was fast. How is the documentation going?

#6

corsix - January 21, 2008 - 23:11
Status:needs work» needs review

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

AttachmentSize
faq_ask_d6_2.patch 21.53 KB

#7

NancyDru - January 22, 2008 - 00:26

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.

#8

corsix - January 22, 2008 - 00:41

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.

#9

NancyDru - January 22, 2008 - 00:52

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

Thanks again for doing this.

BTW, you probably should assign this to yourself.

#10

webchick - January 22, 2008 - 05:11

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.

#11

NancyDru - January 22, 2008 - 05:21

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.

#12

NancyDru - January 22, 2008 - 05:51

@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.

#13

corsix - January 22, 2008 - 07:30

This one applies cleanly; http://img102.imageshack.us/img102/9428/image1sk9.png

AttachmentSize
faq_ask_d6_3.patch 21.52 KB

#14

corsix - January 22, 2008 - 07:57

Made some changes needed from moving D6RC2 -> D6CVS

AttachmentSize
faq_ask_d6_4.patch 21.71 KB

#15

corsix - January 22, 2008 - 08:03

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.

#16

webchick - January 22, 2008 - 08:03

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.

#17

NancyDru - January 22, 2008 - 13:04

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

#18

NancyDru - January 22, 2008 - 16:13

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.

#19

douggreen - January 22, 2008 - 15:59

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

#20

webchick - January 22, 2008 - 16:28

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.

#21

corsix - January 22, 2008 - 16:31

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).

#22

NancyDru - January 22, 2008 - 16:43

@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.

#23

webchick - January 22, 2008 - 16:57

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.

#24

corsix - January 22, 2008 - 17:53

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.

AttachmentSize
faq_ask_d6_5.patch 21.73 KB

#25

NancyDru - January 22, 2008 - 18:09

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.

#26

NancyDru - January 22, 2008 - 18:25
Status:needs review» needs work

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

#27

corsix - January 22, 2008 - 18:43
Status:needs work» needs review

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

AttachmentSize
faq_ask_d6_6.patch 22.25 KB

#28

NancyDru - January 22, 2008 - 22:27

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

#29

NancyDru - January 24, 2008 - 17:57

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

#30

NancyDru - January 24, 2008 - 18:00

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

#31

NancyDru - January 24, 2008 - 18:38
Status:needs review» needs work

Oops, watchdog changes: http://drupal.org/node/114774#watchdog_parameters

#32

corsix - January 25, 2008 - 00:13
Status:needs work» needs review

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.

AttachmentSize
faq_ask_d6_7.patch 23.21 KB

#33

NancyDru - January 25, 2008 - 00:29

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

#34

NancyDru - January 25, 2008 - 03:10
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.

#35

corsix - January 26, 2008 - 15:34

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.

#36

NancyDru - January 26, 2008 - 16:30
Status:reviewed & tested by the community» fixed

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

#37

Anonymous (not verified) - February 9, 2008 - 16:33
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.