Quote:
Dude, use the current source on GitHub :) The sourceforge code is moldy -- lots of changes since then.
I have a problem with using GitHub, for starters as the Module Team Leader I do not have access, also we are supported and one of the few projects that Sourceforge.net feature, for one reason, there total interface is made from XOOPS 1.
Also GitHub is sourceforge competitor, as well as git being available on Sourceforge.net which are a strong sponsor of us and we should be using Git on Sourceforge, can you give me access to the GitHub so I can start working on the modules for 2.6? I will set up a username now which is -
LabsDotCoopJust a thought I really think we should be using the git on source-forge, otherwise I am happy to migrate the modules to each unique GitHubs for Each one if necessary.
Quote:
If you put this hook in to Model\Read you would never be able to trust the expected return from anything. Any installed module would be able to interfere with any handler no matter if it was the active module or not. Sounds like a free for all that could get unstable very easily, and that is not good.
Actually that is not the case, the purpose of reporting the for example 'table' name reported by the persistence is part of the reason, part the reason for the method one is to do the following for example in the
XoopsModelRead::GetAll() from
/class/model/read.php function, so if needed it can be event hooked by a preloader in those unique scenarios, I found like in
multisite (
Which I really think you should implement in the code as it is a great hack I found that can be done to allow for multiple session on domain and sub-domain’s please look at it, there where alot of demand in the forum previous to implement my multisite hack in the system and the core back when I was both in module teams and the core development of XOOPS 2.4)
Just looking at the example given for
XoopsPreloader::triggerMethod() it really needs to look like so:-
/**
* Triggers a specific function or method with variable of return
*
* @param $event_name string Name of the event to trigger
* @param $args array Method arguments
*
* @return void
*/
function triggerMethod($method_name = '', $function = '', $class = '', $dbtable = 'default', $arga = NULL, $argb = NULL, $argc = NULL, $argd = NULL, $arge = NULL, $argf = NULL, $argg = NULL, $argh = NULL, $argj = NULL)
{
if (!is_null($argj))
$args = "j";
elseif (!is_null($argh) && is_null($argj))
$args = "h";
elseif (!is_null($argg) && is_null($argh))
$args = "g";
elseif (!is_null($argf) && is_null($argg))
$args = "f";
elseif (!is_null($arge) && is_null($argf))
$args = "e";
elseif (!is_null($argd) && is_null($arge))
$args = "d";
elseif (!is_null($argc) && is_null($argd))
$args = "c";
elseif (!is_null($argb) && is_null($argc))
$args = "b";
elseif (!is_null($arga) && is_null($argb))
$args = "a";
else
$args = "-";
$method_name = strtolower(str_replace('.', '', $method_name)) . strtolower(str_replace('.', '', $function)) . strtolower(str_replace('.', '', $class)) .;
if (isset($this->_routines[$method_name])) {
foreach ($this->_routines[$method_name] as $event) {
try {
switch ($args)
{
case "j":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd, $arge, $argf, $argg, $arge, $argj);
break;
case "h":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd, $arge, $argf, $argg, $argh);
break;
case "g":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd, $arge, $argf, $argg);
break;
case "f":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd, $arge, $argf);
break;
case "e":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd, $arge);
break;
case "d":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc, $argd);
break;
case "c":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb, $argc);
break;
case "b":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga, $argb);
break;
case "a":
return call_user_func(array($event['class_name'], $event['method']), $dbtable, $arga);
break;
default:
return call_user_func(array($event['class_name'], $event['method']), $dbtable);
break;
}
}
catch(Exception $err)
{
trigger_error("Preload Function Hooking Error: ".$event['class_name']."::".$event['method'] . " ~ $err", E_RECOVERABLE_ERROR);
}
}
}
Just looking at the example given for
XoopsModelRead::GetAll() +
XoopsModelRead::GetObjects() it really needs to look like so:-
/**
* get all objects matching a condition
*
* @param object $criteria {@link CriteriaElement} to match
* @param array $fields variables to fetch
* @param bool $asObject flag indicating as object, otherwise as array
* @param bool $id_as_key use the ID as key for the array
* @return array of objects/array {@link XoopsObject}
*/
function &getAll($criteria = null, $fields = null, $asObject = true, $id_as_key = true)
{
XoopsLoad::load('preload');
$xoopsPreload =& XoopsPreload::getInstance();
$criteria = $xoopsPreload->triggerMethod('core.class.model.criteria', __FUNCTION__, __CLASS__, $this->table, $criteria, &$fields, &$asObject, &$id_as_key);
$fields = $xoopsPreload->triggerMethod('core.class.model.fields', __FUNCTION__, __CLASS__, $this->table, $criteria, &$fields, &$asObject, &$id_as_key);
if (is_array($fields) && count($fields) > 0) {
if (!in_array($this->handler->keyName, $fields)) {
$fields[] = $this->handler->keyName;
}
$select = "`" . implode("`, `", $fields) . "`";
} else {
$select = "*";
}
$limit = null;
$start = null;
$sql = "SELECT {$select} FROM `{$this->handler->table}`";
if (isset($criteria) && is_subclass_of($criteria, "criteriaelement")) {
$sql .= " " . $criteria->renderWhere();
if ($groupby = $criteria->getGroupby()) {
$sql .= $groupby;
}
if ($sort = $criteria->getSort()) {
$sql .= " ORDER BY {$sort} " . $criteria->getOrder();
$orderSet = true;
}
$limit = $criteria->getLimit();
$start = $criteria->getStart();
}
if (empty($orderSet)) {
//$sql .= " ORDER BY `{$this->handler->keyName}` DESC";
}
$result = $this->handler->db->query($sql, $limit, $start);
$ret = array();
if ($asObject) {
while ($myrow = $this->handler->db->fetchArray($result)) {
$object =& $this->handler->create(false);
$object->assignVars($myrow);
if ($id_as_key) {
$ret[$myrow[$this->handler->keyName]] = $object;
} else {
$ret[] = $object;
}
unset($object);
}
} else {
$object =& $this->handler->create(false);
while ($myrow = $this->handler->db->fetchArray($result)) {
$object->assignVars($myrow);
if ($id_as_key) {
$ret[$myrow[$this->handler->keyName]] = $object->getValues(array_keys($myrow));
} else {
$ret[] = $object->getValues(array_keys($myrow));
}
}
unset($object);
}
return $xoopsPreload->triggerMethod('core.class.model.return', __FUNCTION__, __CLASS__, $this->table, $ret);;
}
/**
* retrieve objects from the database
*
* For performance consideration, getAll() is recommended
*
* @param object $criteria {@link CriteriaElement} conditions to be met
* @param bool $id_as_key use the ID as key for the array
* @param bool $as_object return an array of objects?
* @return array
*/
function &getObjects($criteria = null, $id_as_key = false, $as_object = true)
{
XoopsLoad::load('preload');
$xoopsPreload =& XoopsPreload::getInstance();
$criteria = $xoopsPreload->triggerMethod('core.class.model.criteria', __FUNCTION__, __CLASS__, $this->table, $criteria, &$fields, &$asObject, &$id_as_key);
$objects = $this->getAll($criteria, null, $as_object, $id_as_key);
return $xoopsPreload->triggerMethod('core.class.model.return', __FUNCTION__, __CLASS__, $this->table, $objects);
}
The reason I need these changes made is the event hook stratum was my concept that I got trabis to implement who only did a small property of the total events on the core that needed to be hooked!
The purpose of an event hook is so all facilities of the core is reachable by the module development so any feature, query, question or otherwise can be some how determined and altered should it be needed!!
The purpose if you understand is fluid dynamics of the code, this means, to do some features in the core it become static and doesn't need to be later altered by module developers having to distribute the core files to replace, this triggerMethod() needs to go through all the functions as well as there needs to be functioning on function __destruct() as well as function __construct() with all the core classes the following preloader running:-
function __construct()
{
XoopsLoad::load('preload');
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.construct.'.strtolower(__CLASS__), array($this));
}
function __destruct()
{
XoopsLoad::load('preload');
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.destruct.'.strtolower(__CLASS__), array($this));
}
Cause these are components of events that all classes have that are missing!!
One thing you will notice is if you look at XoopsPreloader::setPreloads() is the ataption of preloaders for themes, this is a functional requirement as it need's to be in all facite of the events system as an eventing hooker (Which is how microsoft stuff works actually with Event Hooks for CPU MIPS)
/**
* Get available preloads information and set them to go!
*
* @return void
*/
function setPreloads()
{
//$modules_list = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH . "/modules/");
if ($modules_list = XoopsCache::read('system_modules_active')) {
$i = 0;
foreach ($modules_list as $module) {
if (is_dir($dir = XOOPS_ROOT_PATH . "/modules/{$module}/preloads/")) {
$file_list = XoopsLists::getFileListAsArray($dir);
foreach ($file_list as $file) {
if (preg_match('/(.php)$/i', $file)) {
$file = substr($file, 0, -4);
$this->_preloads[$i]['module'] = $module;
$this->_preloads[$i]['file'] = $file;
$i++;
}
}
}
}
if (isset($GLOBALS["xoopsConfig"]['theme_set']))
{
$theme = $GLOBALS["xoopsConfig"]['theme_set'];
if (is_dir($dir = XOOPS_ROOT_PATH . "/themes/{$theme}/preloads/")) {
$file_list = XoopsLists::getFileListAsArray($dir);
foreach ($file_list as $file) {
if (preg_match('/(.php)$/i', $file)) {
$file = substr($file, 0, -4);
$this->_preloads[$i]['theme'] = $theme;
$this->_preloads[$i]['file'] = $file;
$i++;
}
}
}
}
}
I will continue my response in the next thread this is getting length.. but thanks for your reply so far geekwrite!!
Btw, geek write you want an invisible spot to mail from can you and the other team member
send me 2 postcards to create a divine handshake - upto 5 days apart with a return either email or snail mail address for an
@extraterrestrialmail.com - 500Mb Imap/pop3 mail box my snail mail address for one postcard with your always assumed password with Labs.coop as well as your return mail address and email address to:
Quote:
Chronolabs Cooperative
Unit Ten
466 Illawarra Rd
Marrickville South, NSW, 2204
Australia
Make sure they are identical SO I know they are yours the post card, I have upto 50 Email address, I will be paying for a year supply, if you also want a forwarder on it specify it in the second postcard, and the email address you want the forwarder, separate from the first postcard with your email, return mail so i can send you the server setting in the snail mail and.. at least in some kind of order, just make sure the postcard for the postcardware email box is identical so they match up, mine is
leshy@extraterrestrialmail.com