Members

Note: You can use your Sitellite.org account here and vice versa.

Username

Password

Remember Login

Forgot your password?

Not a member? Click here to register

Alternate onStart method for Server.php

Home        News        Bugs        Downloads        Docs        Forum        CVS        Stats

Information

  • PHP Version: 4.3.x
  • Server OS: Linux
  • Sitellite Version: 4.2.x
  • Browser:

Email:

 

 

Details

I had some trouble with PHPBeans server quietly dying on startup and found that it was choking on non-bean files in the obj/ directory.

Here's an alternate onStart method that ensures only *.php files are loaded:

function onStart () {
$this->uptime = date ('Y-m-d H:i:s');

$olddir = getcwd();
chdir('obj');
$files = glob('*.php');
chdir($olddir);

foreach($files as $file) {
include_once ($file);
$class = 'Bean_' . str_replace ('.php', '', $file);
$this->register[$tmp->namespace] =& new $class ($this);
}
}

More Bugs

Comments

Add Comment


Whoops... The line that reads:
$this->register[$tmp->namespace] =& new $class ($this);

should be replaced by:
$tmp = new $class ($this);
$this->register[$tmp->namespace] =& $tmp;
unset ($tmp);

Add Comment

You must be logged in to comment.

Username
Password