Help save net neutrality! Learn more.
Close

#209 2.3: XoopsCore/CoreServices/Database.xofrm/legacy.php

XOOPS_2.x
open
nobody
Core (214)
5
2012-09-25
2006-02-20
XoopsGold
No

Hallo Skalpa!

Was just going through the legacy.php and found
something that I just thought of drawing your
attention, if you could have a look, when you come out
of your developers submarine, as follows:

class xoops_db_Database_legacy extends
xoops_db_Database_mysql {

/**
 * Get field name
 *
 * @param resource $result query result
 * @param int numerical field index
 * @return string
 */
function getFieldName($result, $offset)
{
    return mysql_field_name($result, $offset);
}

I suggest:

function getXoopsFieldName{
....blah
}

And add to it:

function getExternalFieldName{
...
connect to array_remote_db[xx]
...
Get Field Names of Table[xx] (as saved in the Pluggin DB)
...
}

Implications:

The Xoops would then have capacity to save names of the
database and tables to capture the fields.

Hence, all the Users and Groups table from any script
could be loaded by this function.

Use:

Xoops would then have potential to administrate any CMS
including to that of Joomla, provided Xoops remain the
Primary (Super) or Master CMS and others (for e.g.
Joomla) as a slave.

Thereafter, all the Users, Groups and Sessions table of
any CMS could be handled through a database mapping.

Does it make sense, dear captain?

Discussion

  • XoopsGold

    XoopsGold - 2006-02-20

    Logged In: YES
    user_id=1329834

    Further, was just going through more and found the following
    in the file:

    XOOPS / Frameworks / XoopsCore / CoreServices / Http.xofrm /
    session.xoobj / handler-db.php

    http://svn.berlios.de/viewcvs/xoops4/XoopsCore/branches/tasks/123542-admin/XOOPS/Frameworks/XoopsCore/CoreServices/Http.xofrm/session.xoobj/handler-db.php?view=markup

    function write( $sessionId, $data ) {
    $sessionId = $this->db->quote( $sessionId );
    $data = $this->db->quote( $data );
    $time = time();

        list( $count ) = $this->db->fetchRow( $this->db->query(
    

    "SELECT COUNT(*) FROM $this->tableName WHERE
    sess_id=$sessionId" ) );

        if ( $count > 0 ) {
            $sql = "UPDATE `$this->tableName` SET
    

    sess_updated=$time,sess_data=$data WHERE sess_id=$sessionId";
    } else {
    $ip = $this->db->quote( $_SERVER['REMOTE_ADDR'] );
    $sql = "INSERT INTO $this->tableName
    (sess_id,sess_updated,sess_ip,sess_data) VALUES
    ($sessionId,$time,$ip,$data)";
    }
    return $this->db->queryF( $sql );
    }

    The mapping I suggested could be very simple and could be
    implemented as follows:

        list( $count ) = $this->db->fetchRow( $this->db->query(
    

    "SELECT COUNT(*) FROM $this->MAPPEDtableName WHERE
    sess_id=$sessionId" ) );

        if ( $count > 0 ) {
            $sql = "UPDATE `$this->MAPPEDtableName` SET
    

    sess_updated=$time,sess_data=$data WHERE sess_id=$sessionId";
    } else {
    $ip = $this->db->quote( $_SERVER['REMOTE_ADDR'] );
    $sql = "INSERT INTO $this->MAPPEDtableName
    (sess_id,sess_updated,sess_ip,sess_data) VALUES
    ($sessionId,$time,$ip,$data)";
    }

    And the $this->MAPPEDtableName will go through all the
    sessions table listed in the DB, update them.

    Xoops shall provide a Gateway to all other CMS, as User
    table is also mapped with this concept!

     

Log in to post a comment.