IRC log for #drupal-games, 2008-05-16 (GMT)

 
2008-05-15
2008-05-17
TimeNickMessage
[00:41:53]* litwol|mac has joined #drupal-games
[14:09:02]* litwol|mac has quit ()
[14:58:09]* litwol|mac has joined #drupal-games
[15:02:24]* litwol|mac has quit (Client Quit)
[16:01:39]* litwol|mac has joined #drupal-games
[16:45:26]* aaronwinborn_ has joined #drupal-games
[16:59:03]* aaronwinborn_ has quit (zelazny.freenode.net irc.freenode.net)
[16:59:18]* aaronwinborn_ has joined #drupal-games
[18:20:40]* afeijo has joined #drupal-games
[18:20:44]<litwol|mac>hi
[18:20:44]<Druplicon>hey
[18:20:54]<litwol|mac>let me give you a brief behind the architecture
[18:21:00]<litwol|mac>or what i'm *trying* to accomplish
[18:21:27]<litwol|mac>i'm changing the way content access is being checked
[18:21:40]<litwol|mac>right now private msg only stores author and recipient
[18:21:46]<afeijo>k
[18:21:50]<litwol|mac>so its a linear access
[18:21:59]<litwol|mac>what i'm changing this into is the following
[18:22:24]<litwol|mac>author -> writes to -> group - > of users -> {one or more users}
[18:22:38]<afeijo>a msg table should consider uid or gid
[18:22:44]<litwol|mac>i ahve all that
[18:22:45]<litwol|mac>:-p
[18:22:50]<afeijo>cool
[18:22:54]<litwol|mac>message table still stores author
[18:23:10]<litwol|mac>but recipients are stored through groups and users
[18:23:25]<litwol|mac>each new message gets new group
[18:23:26]<afeijo>multiple records then
[18:23:46]<litwol|mac>i bet there are ways to optimize this to reuse groups
[18:23:51]<litwol|mac>but we can optimize this later
[18:24:08]<litwol|mac>with this structure we get interesting things
[18:24:16]<litwol|mac>1) i can easily look up message access
[18:24:25]<litwol|mac>for individual user, or group of users
[18:24:31]<litwol|mac>but more importantly is individual user
[18:24:39]<litwol|mac>are you familiar with drupal's node_access ?
[18:24:49]<litwol|mac>node_access in drupal is current bottleneck
[18:24:58]<litwol|mac>because queries against node_access are unindexed
[18:25:13]<litwol|mac>impossible to index because node_access does a DISTINCT query
[18:25:18]<litwol|mac>anyhow
[18:25:24]<litwol|mac>i'm eliminating this with my architecture
[18:25:32]<afeijo>node_access isnt a problem
[18:25:42]<litwol|mac>because you ask the database 'give me messages that user X can view'
[18:25:45]<litwol|mac>and it will do just that
[18:26:01]<afeijo>ok
[18:26:13]<litwol|mac>its indexed and there's no computation behind it
[18:26:29]<litwol|mac>if other modules want to alter node access, they will alter the records of message <>group<>user association
[18:26:50]<litwol|mac>so *theoretically* this architecture is erm better/faster?
[18:26:51]<litwol|mac>duno
[18:26:52]<litwol|mac>thats my hope
[18:27:13]<litwol|mac>so anyhow, thats how it works under the hood. now i'm going to pastebin the current code for ya
[18:27:22]<litwol|mac>by the way
[18:27:29]<litwol|mac>install privatemsg module
[18:27:42]<litwol|mac>then do database import
[18:27:46]<litwol|mac>from the dump that i giv you
[18:28:07]<litwol|mac>it will only include privatemsg, pmsg_group and pmsg_group_user tables
[18:28:13]<litwol|mac>you will need users uid = 1 and uid = 3
[18:28:25]<litwol|mac>it will already have some messages there
[18:28:30]<afeijo>bring it on
[18:30:23]<litwol|mac>afeijo: i'm prepared to scrap my design if its utterly flawed, or implement a new one if its better. i'm very open to ideas and will go with the best aproach
[18:30:36]<litwol|mac>so when working on this, dont limit yourself to what i already have
[18:42:42]<afeijo>where are the tables?
[18:44:58]<litwol|mac>when you enable the modules as per my instructions in the email, all the tables will be created
[18:45:06]<litwol|mac>you will just need to insert the data
[18:45:08]<litwol|mac>from that dump
[18:45:40]<afeijo>got your email, your files are .zip.zip hehe
[18:46:17]<afeijo>d5? I tought you said d6
[18:48:10]<litwol|mac>i started working on it in d5, but didnt have time to convert to d6
[18:48:21]<litwol|mac>i have a d6 version but its just a copy/paste job from d5
[18:48:30]<litwol|mac>point is, i decided to do the d6 version 2 days ago
[18:48:37]<litwol|mac>and didnt have time to convert current code
[18:48:43]<afeijo>I can try port it
[18:50:45]<afeijo>why u double zip? zip in a zip
[18:51:34]<litwol|mac>i ziped the files, but then my email client zips it again :(
[18:52:02]<afeijo>ahh ehehehe
[18:52:17]<litwol|mac>yeah so very important
[18:52:22]<litwol|mac>i dont want to get stuck on a shitty design
[18:52:29]<litwol|mac>so if my architecture behind this sucks
[18:52:33]<litwol|mac>let me know :-p
[18:59:04]<afeijo>pmsg could implement uploads
[19:00:38]<litwol|mac>yeah
[19:00:47]<litwol|mac>my intention is highly modular design
[19:00:56]<litwol|mac>notice how i implemented query alters
[19:01:06]<litwol|mac>i am going to improve it a bit
[19:01:11]<litwol|mac>because i want to give names to all queris
[19:01:12]<litwol|mac>queries
[19:01:15]<litwol|mac>like query_id
[19:01:20]<litwol|mac>so modules can hook onto an ID to alter it
[19:02:09]<afeijo>good idea
[19:02:47]<litwol|mac>i havent implemented that feature yet
[19:02:56]<litwol|mac>but it will be a part of my modular query design
[19:03:02]<afeijo>what is the history about pmsg api?
[19:03:05]<litwol|mac>notice that hook_db_rewrite_sql is too limitd to allow for that
[19:03:16]<litwol|mac>pmsg api is just cut > paste job from pmsg module
[19:03:26]<litwol|mac>intent behind pmsg api is to be core api with no functionality
[19:03:35]<afeijo>so I dont install it?
[19:03:38]<litwol|mac>you do
[19:03:43]<litwol|mac>pmsg uses some api from there
[19:03:50]<afeijo>ok
[19:03:56]<afeijo>I am installin' on my d6
[19:04:04]<litwol|mac>test it on d5 first
[19:04:07]<litwol|mac>so you can understand how it runs
[19:04:21]<litwol|mac>i implemented message listing query
[19:04:25]<litwol|mac>for threaded and non threaded display
[19:04:31]<litwol|mac>took me a while to figure it out
[19:04:43]<litwol|mac>the important thing here is that i want those queries to be somewhat efficient
[19:04:47]<litwol|mac>when the db is HUGE
[19:05:52]<afeijo>naturally
[19:06:09]<afeijo>wr r u from?
[19:07:40]<litwol|mac>new york
[19:07:49]<litwol|mac>you?
[19:07:49]<Druplicon>you are not that clever, are you?
[19:07:54]<litwol|mac>whoa
[19:07:56]<afeijo>brazil
[19:07:57]<afeijo>hahah
[19:08:03]<litwol|mac>Druplicon: forget you
[19:08:03]<Druplicon>litwol|mac: I've forgotten about you.
[19:08:09]<litwol|mac>holly shit that just freaked me out
[19:08:14]<litwol|mac>you?
[19:08:15]<litwol|mac>k good
[19:08:16]<litwol|mac>:-p
[19:08:16]<afeijo>but you born on ny? your name sound lest europe
[19:08:37]<afeijo>hahaha I try to teach Druplicon to respond to 'bom dia', but he dont
[19:09:01]<litwol|mac>i'm russian born
[19:09:08]<afeijo>ahh :)
[19:10:15]<litwol|mac>do i get a few extra iq points for that?
[19:10:15]<litwol|mac>:-p
[19:10:16]<litwol|mac>hehe jk
[19:10:39]<afeijo>sure hehe
[19:11:01]<afeijo>pmsg is installed on my d6, no errors, except a tiny one on the new menu api, fixing...
[19:13:11]<afeijo>done
[19:13:56]<litwol|mac>cool
[19:14:05]<litwol|mac>notice a const defined at top of pmsg.module
[19:14:20]<litwol|mac>its a switch to go from and to threaded and non threaded message display
[19:14:23]<afeijo>aye
[19:14:55]<afeijo>your _list func returns a ugly content hehehe
[19:15:22]<litwol|mac>its debugging content
[19:15:28]<litwol|mac>message id, author - > recipient
[19:15:35]<litwol|mac>to test that threading works right
[19:15:39]<litwol|mac>and the whole query in general
[19:15:46]<litwol|mac>took me a while but i think i nailed it
[19:17:22]<afeijo>I like to use theme_table to debug like that, easy to read
[19:18:39]<litwol|mac>interesting
[19:18:42]<litwol|mac>i never thought of that
[19:18:46]<afeijo>I like to use implode to feed a array like in the _list_select_alter
[19:18:53]<afeijo>can I change and add theme_table?
[19:19:00]<litwol|mac>do what you need
[19:19:30]<litwol|mac>but i already use impode on _list_select_alter
[19:20:09]<afeijo>no
[19:20:24]<afeijo>u use a line to each column
[19:20:28]<afeijo>$SELECT[] =
[19:20:32]<litwol|mac>yeah
[19:20:41]<litwol|mac>oh
[19:21:11]<litwol|mac>and how would you do it?
[19:21:57]<afeijo>1m
[19:23:20]<afeijo> $SELECT[] = implode(' ', 'pm.* recipient author subject folder pg.* pu.*');
[19:23:39]<afeijo>you can use comma as separator as well, the could would look like sql
[19:23:45]<litwol|mac>i c
[19:23:59]<litwol|mac>i duno, i prefer my method :-p
[19:25:27]<litwol|mac>in a nutshell, all i ahve so far is some api to make messages fetching flexible
[19:26:00]<litwol|mac>my intent was to implement individual feature sets as stand alone modules
[19:26:11]<litwol|mac>even small things like folders
[19:26:14]<litwol|mac>or archiving
[19:26:16]<afeijo>like cck
[19:26:20]<afeijo>its good
[19:26:23]<litwol|mac>bingo
[19:26:38]<litwol|mac>sattelite modules are easier to maintain
[19:26:39]<litwol|mac>are smaller
[19:26:42]<litwol|mac>and easier to build
[19:26:52]<litwol|mac>so in return more developers may contribute to this
[19:27:06]<litwol|mac>also, by doing flexi fetching, we need to enable flexi theming
[19:27:16]<litwol|mac>the only thing i want the *core* pmsg to do
[19:27:20]<litwol|mac>is to provide api
[19:27:25]<litwol|mac>and provide listing query
[19:27:29]<litwol|mac>with access checks
[19:27:38]<afeijo>I never used db_rewrite_sql, I'm reading it source
[19:27:49]<litwol|mac>its tough
[19:27:54]<litwol|mac>i can just explain it to you
[19:27:58]<afeijo>ok
[19:28:00]<litwol|mac>db_rewrite_sql is meant to be used for nodes
[19:28:04]<litwol|mac>so it will just confuse you
[19:28:31]<litwol|mac>okey so basicaly
[19:28:35]<litwol|mac>what db_rewrite_sql is
[19:28:49]<litwol|mac>db_rewrite_sql to queries is what hook_form_alter is to forms
[19:29:26]<litwol|mac>it allows other modules to hook into a query and add things like WHERE, JOIN and DISTINCT
[19:29:33]<litwol|mac>now we want to avoid distinct
[19:29:37]<litwol|mac>so just ignore it for now
[19:29:42]<litwol|mac>what we care about is WHERE and JOIN
[19:29:57]<litwol|mac>so look at my original query
[19:30:02]<litwol|mac>$query = "SELECT ". implode(", ", $SELECT);
[19:30:02]<litwol|mac> $query .=" FROM {privatemsg} pm ";
[19:30:10]<litwol|mac>it becomes something like select * from privatemsg pm
[19:30:14]<litwol|mac>small and simple
[19:30:36]<litwol|mac>then i run it through db_rewrite_sql
[19:30:58]<litwol|mac>it calls hook_db_rewrite_sql which in my case is pmsg_db_rewrite_sql
[19:31:16]<litwol|mac>pmsg_db_rewrite_sql returns a query modifier array with keys 'join' and 'where'
[19:31:34]<afeijo>I got the picture! very usefull
[19:31:41]<litwol|mac>then db_rewrite_sql uses some regex to inject those 'where' and 'join' conditions into the original query
[19:31:43]<afeijo>I will use it a lot hehe
[19:33:37]<litwol|mac>be careful
[19:33:51]<litwol|mac>db_rewrite_sql becomes horrid when it injects DISTINCT
[19:33:56]<litwol|mac>that what kills node listing queries
[19:33:59]<litwol|mac>thats what makes it slow
[19:34:07]<litwol|mac>the more nodes you ahve the slower your listing queries wil be
[19:34:09]<litwol|mac>due to distinct
[19:37:37]<litwol|mac>i didnt understand db_rewrite_sql until i write my own version of it which was more versitile (notice i included select alters and other stuff)
[19:37:52]<litwol|mac>but after i wrote my own api for it, it looked awfuly familiar
[19:37:53]<litwol|mac>lol
[19:38:01]<litwol|mac>that was the night when i finaly understood db_rewrite_sql
[19:38:12]<litwol|mac>i guess sometimes to understand the wheel, you need to reinvent it
[19:38:12]<litwol|mac>lol
[19:40:14]<afeijo> $messages = array();
[19:40:15]<afeijo> while($row = db_fetch_array($result)) {
[19:40:15]<afeijo> //drupal_set_message('<pre>'. print_r($row->id. ' - '. $row->author .' ->> '. $row->recipient, 1) .'</pre>');
[19:40:15]<afeijo> $messages[] = $row;
[19:40:15]<afeijo> }
[19:40:16]<afeijo> $head = $SELECT;
[19:40:18]<afeijo> $content = theme_table($head, $messages);
[19:42:42]<afeijo>the module today just asemble the sql? it dont actualy send a msg?
[19:43:20]<litwol|mac>notice db_rewrite_sql works from primary ID
[19:43:27]<litwol|mac>thats the only way to hook into a query correctly
[19:43:42]<litwol|mac>i want to add a required query_id
[19:43:51]<litwol|mac>so we dont have to "gues" which query we are altering
[19:48:48]<litwol|mac>so what do you think of this architecture
[19:48:57]<litwol|mac>is this something that could work well in a long run?
[19:49:15]<afeijo>looks nice
[19:49:34]<afeijo>the simple send msg and read msg should be the first step
[19:50:03]<litwol|mac>yeah
[19:50:05]<afeijo>do you use history to control readed msg?
[19:50:10]<afeijo>history table
[19:50:11]<litwol|mac>but i wanted to iron out concept
[19:50:20]<litwol|mac>not yet
[19:50:25]<litwol|mac>this is a satelite module
[19:50:25]<litwol|mac>:-p
[19:50:35]<afeijo>I see
[19:50:52]<litwol|mac>one of the reasons i made queries into arrays/objects
[19:51:01]<litwol|mac>is that other modules can not only add items, but remove too
[19:51:14]<litwol|mac>so if one fnctionality conflicts with other
[19:51:19]<litwol|mac>module developer can resolve it himself
[19:52:14]<litwol|mac>i wnat to keep the core pmsg module as simple as possible
[19:52:20]<litwol|mac>only the most basic functionality needs to go there
[19:52:40]<litwol|mac>and one more important than others, is message access permissions
[19:53:20]<afeijo>why not remove own pmsg?
[19:53:29]<afeijo>archive own pmsg?
[19:53:49]<litwol|mac>?
[19:53:50]<litwol|mac>wha/
[19:53:55]<afeijo>perm
[19:54:28]<afeijo>even send pmsg is a important perm
[19:54:38]<afeijo>so anonymous will not be able to
[19:54:46]<afeijo>avoiding spam
[19:55:36]<litwol|mac>sure
[19:55:38]<litwol|mac>add that in
[19:55:45]<afeijo>I did
[19:55:48]<litwol|mac>:-p
[19:56:20]<afeijo>why access own? if I get a msg, I should be able to read it, no? but reply, is another side
[19:56:51]<afeijo>edit own pmsg too, I added
[19:57:03]<litwol|mac>yo uwant to allow editing?
[19:57:08]<afeijo>to fix sent msgs not yet readed hehe
[19:57:16]<litwol|mac>lets leave that to a satelite module
[19:57:37]<afeijo>I think thats core, but ok, lets move on
[19:57:40]<afeijo>what else?
[19:58:06]<litwol|mac>while message sending is going through all the alterations
[19:58:16]<litwol|mac>i want to allow modules to invalidate message send
[19:58:39]<litwol|mac>in sql terms i guess it goes like this: invalidate transaction commit
[19:58:41]<litwol|mac>:-p
[19:59:03]<litwol|mac>oo
[19:59:05]<afeijo>hahaha, I dont think mysql has it
[19:59:09]<litwol|mac>yeah
[19:59:13]<litwol|mac>i just said it to you so you know what i mean
[19:59:31]<afeijo>define can be redefine? dont remember
[19:59:38]<litwol|mac>duno
[19:59:40]<afeijo>if a module change a define, you abort the inst
[19:59:41]<litwol|mac>look in module util
[19:59:43]<afeijo>*insert
[20:00:22]<litwol|mac>any message alter that returns false should abort message commit/insert/send (w/e we call it :-p
[20:00:26]<litwol|mac>look in module i wrote
[20:00:27]<litwol|mac>called util
[20:00:33]<litwol|mac>look at the theming function
[20:00:36]<afeijo>you can just use if (defined('abort_new_pmsg'))
[20:00:51]<afeijo>ok
[20:01:00]<litwol|mac>look at how i do theme('table')
[20:01:12]<litwol|mac>i exposed table rows to drupal_alter()
[20:01:13]<afeijo>I dont have that util module
[20:01:18]<litwol|mac>download it :-p
[20:01:33]<litwol|mac>look at how i exposed table rows to drupal_alter
[20:01:35]<litwol|mac>why is this important ?
[20:01:45]<litwol|mac>because when modules add fields to the $SELECT
[20:01:50]<litwol|mac>they should be able to also theme it
[20:01:56]<litwol|mac>so when we theme our message
[20:02:05]<litwol|mac>we need to let modules alter the table row
[20:02:09]<litwol|mac>before its rendered into HTML
[20:02:18]<litwol|mac>a feature drupal core doesnt offer yet
[20:10:39]<afeijo>util installed
[20:11:06]<litwol|mac>just look at system module
[20:11:07]<litwol|mac>theme
[20:12:37]<litwol|mac>look at line 154 in system_module.module
[20:12:38]<litwol|mac>inside util
[20:12:39]<afeijo>ok
[20:12:43]<litwol|mac>look how i expose rows to alters
[20:12:46]<afeijo>arguments
[20:12:50]<litwol|mac>so people can add/remove table columns
[20:13:02]<litwol|mac>its a feature theme('table') doesnt offer on it's own
[20:13:49]<afeijo>thats nice
[20:13:51]<afeijo>could be on core
[20:13:56]<afeijo>should
[20:14:55]<litwol|mac>this was just experimental
[20:15:12]<litwol|mac>as you can see i'm experimenting alot with these modules :)
[20:15:36]<litwol|mac>i was considering to do d6 port of privatemsg
[20:15:43]<litwol|mac>but morbus pissed me off hard :(
[20:15:53]<litwol|mac>so now i'm sticking to my guns with this rewrite
[20:15:56]<afeijo>dont bother with him
[20:16:21]<afeijo>that module you sent me, works on d5?
[20:16:29]<litwol|mac>yes
[20:17:33]<afeijo>how? I cant se the code to that
[20:18:02]<litwol|mac>wait. which module?
[20:18:04]<litwol|mac>pmsg?
[20:18:08]<afeijo>yes
[20:18:15]<litwol|mac>yeah its my d5 version
[20:19:03]<afeijo>thru where I can test? cant find it lol
[20:19:16]<litwol|mac>make a local d5 install :-p
[20:19:16]<litwol|mac>lol
[20:19:19]<litwol|mac>with uid 1 and 3
[20:19:36]<afeijo>lets pretend I did, what next?
[20:19:57]<litwol|mac>enable privatemsg then pmsg api then pmsg
[20:20:03]<litwol|mac>then go to /pmsg
[20:20:07]<litwol|mac>oh
[20:20:11]<litwol|mac>make sure to do data import
[20:20:12]<afeijo>I did all that
[20:20:18]<litwol|mac>did ou import data?
[20:20:21]<afeijo>aye
[20:20:21]<litwol|mac>from that sql
[20:20:24]<litwol|mac>and it doesnt work?
[20:20:25]<litwol|mac>O-o
[20:20:35]<afeijo>I can see the debug that
[20:20:45]<afeijo>that I improved with table_theme
[20:20:49]<litwol|mac>yeah
[20:20:51]<afeijo>but how to SEND a msg?
[20:20:55]<litwol|mac>thats all there is to pmsg
[20:20:56]<litwol|mac>oh
[20:21:01]<litwol|mac>you dont... yet
[20:21:10]<afeijo>so d5 dont work yet ether
[20:21:20]<litwol|mac>oh sry i misunderstood you
[20:21:26]<afeijo>totally hehehe
[20:21:26]<litwol|mac>this rewrite is non functional yet
[20:21:35]<litwol|mac>i began it like a week ago
[20:21:40]<afeijo>aaaahhhh
[20:22:20]<litwol|mac>functions _save_pmsg_group and _save_pmsg_group_user _supposed_ to handle message saving
[20:22:28]<litwol|mac>but i never used them yet
[20:22:36]<litwol|mac>because i dont have ui for message composing
[20:22:59]<afeijo>I recomend nicEdit to the textarea
[20:23:00]<litwol|mac>i really only wrote the proof of concept SQL against my pmsg_group, pmsg_group_user and privatemsg tables
[20:23:18]<litwol|mac>now that i have message listing working
[20:23:23]<litwol|mac>i'm going to do the UI
[20:23:28]<litwol|mac>nicedit?
[20:23:28]<Druplicon>http://drupal.org/project/nicedit
[20:23:57]<litwol|mac>cool
[20:24:07]<litwol|mac>we can make message textbox exposed to nice edit
[20:26:28]<litwol|mac>by the way
[20:26:42]<litwol|mac>i named hte module pmsg so that i could run it with privatemsg without name conflict
[20:26:56]<litwol|mac>i intend to rename "pmsg" to "privatemsg"
[20:27:03]<afeijo>good to know
[20:27:08]<afeijo>why not privatemsg2?
[20:27:30]<litwol|mac>well i was hoping to maintain the same drupal.org project name space
[20:27:47]<afeijo>ok
[20:28:15]<litwol|mac>i will set up proper branches for this code base
[20:28:22]<litwol|mac>and give you cvs access if you are interested in comminting
[20:28:26]<litwol|mac>or you could just post patches
[20:28:42]<litwol|mac>i would prefer to ahve some kind of review before commits
[20:29:16]<afeijo>at first I can email you. Beside, I need to lern about cvs, didnt used it yet
[20:29:40]<litwol|mac>do you know how to create patches?
[20:29:42]<litwol|mac>cvs?
[20:29:42]<Druplicon>The CVS handbook can be found at http://drupal.org/handbook/cvs and the application process for a cvs account is http://drupal.org/node/59
[20:29:43]<litwol|mac>patch?
[20:29:43]<Druplicon>Information about patches can be found at http://drupal.org/patch and if you want to help test the most important core patch right now, see the "Patch spotlight" at http://drupal.org/patch/spotlight
[20:29:48]<litwol|mac>create patch?
[20:30:19]<afeijo>I installed a tool to run a patch here, didnt try build one yet. But isnt hard I'm sure
[20:31:45]<litwol|mac>its not
[20:31:51]<litwol|mac>i'll help you out
[20:32:05]<litwol|mac>you help me write better sql and i'll help you with other stuff
[20:32:06]<litwol|mac>:)
[20:32:11]<litwol|mac>mutual back scratching
[20:32:17]<afeijo>works for me!
[20:32:21]<litwol|mac>i'm heading out to get food. brb
[20:32:26]<afeijo>ok
[20:38:38]<afeijo>do you use windows or linux?
[20:43:16]* afeijo has quit ("gotta work")
[21:29:33]* aaronwinborn_ has quit ("ChatZilla 0.9.82.1 [Firefox 2.0.0.14/2008041816]")
[21:30:20]* aaronwinborn has quit (Read error: 104 (Connection reset by peer))
[23:35:13]* litwol|mac has quit ()