[geeklog-devel] Brainstorming: Admin Toolbox?

Tony Bibbs tony at tonybibbs.com
Mon Jul 12 17:47:21 EDT 2004


>Not sure about this one, but do we want to support more than one function
>per scriptlet? Or would those go into separate scriptlets?
>  
>
runScriptlet() can act as a proxy method.  It is the starting point for 
processing so you could have:

function runScriptlet()
{
    global $HTTP_POST_VARS;

    if (isset($HTTP_POST_VARS['someVariable'])) {
        $this->_runFunctionA();
    } else {
        $this->_runFunctionB();
    }
}

function _runFunctionA()
{
    // Custom process for handling POST data
}

function _runFunctionB()
{
    // Default (i.e. non-POST) processing
}

>Also, what about POST requests? How do they come back into the scriptlet?
>  
>
Above example should address this too.

>Outside of the webtree makes sense. Not sure about the database, as it
>also beats the "simple installation" idea.
>  
>
Uh, I don't agree.  The only attributes in a database table would be:
script_id(auto_increment)
script_className
script_version
script_author
script_long_desc
script_short_desc
been_ran (bit) -> this indicates the script has been ran at least once
enabled_flag (bit)
[insert security fields here]

All that stuff would come right out of the class definition so the 
installation would be easy:

<?php

// Get tmp file location
$fileToInclude = [..];

// Include it
require_once $fileToInclude;

// Get class name
$className = [...];

// Instantiate class
$myObj = new $className();

// Delete scriptlet if it already exists
DB_query("DELETE FROM {$_TABLES['scriptlet']} WHERE script_className = 
'$className');

//Add it to scriptlet table:
$sql = sprintf("INSERT INTO ? (script_className, script_version, 
script_author, script_long_desc, script_short_desc, been_ran, enabled) 
values ('?','?','?','?','?',?,?)",
    $_TABLES['scriptlet'], $className, $myObj->getVersion(), 
$myObj->getAuthor(), $myObj->getLongDesc(), $myObj->getShortDesc(), 0, 1);
DB_query($sql);

?>

>I don't really see any file permission issues. The scriptlets are
>probably included(?) or they're simple .php files.
>  
>
Well, the directory they'd go in would need to be writeable.  Again, I'd 
prefer the database if for no other than to make upgrades easier, but 
that's just my to cents.

--Tony




More information about the geeklog-devel mailing list