51
trabis
Re: XHelp Pop email Not working - Cron help
  • 2010/8/29 21:46

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

ghia wrote:
No, these loadings were not necessary in previous XOOPS versions, but have been introduced in the newer versions. It is then up to the core to load these things itself!


Sure they were necessary, that is what xhelp/servicemain.php is about, initializing database, logger and other services. It is only natural that, while the core evolves, new dependencies are added or removed on the bootstrap. When a module emulates the core bootstrap, like xhelp does with servicemain.php, it risks to get outdated.

htdocs/image.php also uses nocommon and required updating its own bootstrap. Maybe xhelp could borrow code from it:
error_reporting(0);
if (
version_compare(PHP_VERSION'5.3.0''<')) {
    
set_magic_quotes_runtime(0);
}

if (
function_exists('mb_http_output')) {
    
mb_http_output('pass');
}
$xoopsOption['nocommon'] = 1;
include 
dirname(__FILE__) . DIRECTORY_SEPARATOR 'mainfile.php';

$image_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if (empty(
$image_id)) {
    
header('Content-type: image/gif');
    
readfile(XOOPS_ROOT_PATH '/uploads/blank.gif');
    exit();
}

include 
XOOPS_ROOT_PATH '/include/functions.php';
include_once 
XOOPS_ROOT_PATH '/class/xoopsload.php';
include_once 
XOOPS_ROOT_PATH '/class/preload.php';
include_once 
XOOPS_ROOT_PATH '/class/logger/xoopslogger.php';
include_once 
XOOPS_ROOT_PATH '/class/module.textsanitizer.php';
include_once 
XOOPS_ROOT_PATH '/class/database/databasefactory.php';
require_once 
XOOPS_ROOT_PATH '/kernel/object.php';
require_once 
XOOPS_ROOT_PATH '/class/criteria.php';

$xoopsLogger =& XoopsLogger::getInstance();
$xoopsLogger->startTime();

define('XOOPS_DB_PROXY'1);
$xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection();

52
ghia
Re: XHelp Pop email Not working - Cron help
  • 2010/8/30 4:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You are still using the inverse logic!
It is not the module its fault that it has problems with the new core!
It is the core that makes problems for the module and thus it is the core that contains the bug and it is the core that should be altered to resolve this!!!

And with your example of image.php, you are proving my point:
Quote:
It would take several modules that must repeat above code, while doing once in the core would be fit for all.
This bootstrapping and preparing for use is typical something the core must do and not introduce it to other modules and files.
(If you reason further on your path, we can set up in modules a database connection of our own and finally, we don't need a core at all, because we did all setups ourselves.)

These initializations and bootstrapping or whatever you want to call it, were not needed before the changes and there is no reason why they should be needed after. It is not up to the modules for making the core functions and initialisations, that lack, complete.

It simply means the implementation of the changes is half work. It only provides for the nocommon false case. Because, if the core did not do this bootstrapping, then we were now facing the fact that all modules were invalidated and needed additional bootstrap code in order to stay running.
That would not make very much sense, would it?

So, please complete the core for the nocommon true case. A first step is what I already have done in the previous posts by adding code. I think for the things that I rolled back, also some code could be added from your code exemples in order to make it run, without further changes forthe existing modules and thus making the core truely compatible with the previous versions.


53
trabis
Re: XHelp Pop email Not working - Cron help
  • 2010/8/30 12:16

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:
This bootstrapping and preparing for use is typical something the core must do and not introduce it to other modules and files.

And it does, unless the module ask the core to not run the bootstrap when using xoopsoption['nocommon'];
Note that these initializations and bootstrapping happen in include/common.php.

Quote:

(If you reason further on your path, we can set up in modules a database connection of our own and finally, we don't need a core at all, because we did all setups ourselves.)

You could do anything you want with the contents of mainfile.php and it has always been that way.

Quote:

These initializations and bootstrapping or whatever you want to call it, were not needed before the changes and there is no reason why they should be needed after. It is not up to the modules for making the core functions and initialisations, that lack, complete.


Regarding xhelp and 'nocommon' usage:
-These bootstrapping WERE needed before the changes.
What you see in xhelp is a partially copy/paste of an old include/common.php(the bootstrap).
What xhelp needs is to complete its OWN bootstrap to match the new dependencies.




Login

Who's Online

119 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 119


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits