Jim,

>right now, there's a mix of entries in the notes database marked
>using the page title and the page id. the ones identified only by
>title need to get fixed in the database.

Out of interest, why did we change to using the page id?

>but mainly 'getting it into the rsync repository' was what was on
>my to-do list.

Cool.

> (if you're talking about commiting the get-user-notes code, it's
> already there. it needs work, but it is a good start.)

Yeah, I wrote it as a stopgap before all this rsync stuff was up and
working.  My local version works much nicer, but I didn't want to commit it
until we had rsync (a far better way than fetching notes from
http://www.php.net/get-user-notes.php). Once that's done, we can write the
usernotes from cron, and install the following code into shared-manual.inc

Sounds simple? :)

Simon


function manualGetUserNotesDb($title, $id)
{
    $host = 'localhost';
    $user = 'nobody';
    $pass = '';
    $db_id = mysql_connect($host, $user, $pass);
    $query = "SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE sect =
'$title' OR sect = '$id' ORDER BY id";
    $result_id = mysql_db_query("php3", $query, $db_id);

    $notes = array();
    if ($result_id && mysql_num_rows($result_id) > 0) {
        while ($row = mysql_fetch_array($result_id)) {
            $notes[] = $row;
        }
    }

    return $notes;
}

function manualGetUserNotesCache($sect)
{
    global $DOCUMENT_ROOT;
    $cachefile = "$DOCUMENT_ROOT/manual/usernotes/" . urlencode($sect) .
".txt";
    if ($fh = @fopen($cachefile,'r')) {
        $notes = @unserialize(fread($fh,10000000));
        fclose($fh);
    } else {
        $notes = array();
    }
    return $notes;
}


function manualUserNotes($title, $id) {
...
    if(strstr($MYSITE,"www.php.net")) {
        $notes = manualGetUserNotesDb($title, $id);
    } else {
        $notes = array_merge( manualGetUserNotesCache($title),
manualGetUserNotesCache($id) );
    }
...
}





-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to