Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

midgard_connection::open() and open_config() do not create classes #9

Open
indeyets opened this issue Jun 16, 2010 · 4 comments
Open

Comments

@indeyets
Copy link
Member

In case, when connection is established manually using midgard_connection::open() or midgard_connection::open_config() methods and schema-directory in config-file is different from the schema-directory originally set in midgard, mgdschema classes (descendants of midgard_object) are not initialized.

Fixing this, would require to move initialization of these classes from PHP_MINIT_FUNCTION(midgard2_object) to some other function and call that function after new config is loaded

@piotras
Copy link
Member

piotras commented May 19, 2011

It's also related to classes' type. If it's user type, it should be freed at request end. If it's internal one, it should be initialized during MINIT as it guaranteed to register classes in main process before any new child is forked.

@indeyets
Copy link
Member Author

@piotras this one is strictly about "schema" classes, which, in case of midgard_connection::open() or midgard_connection::open_config() have to be initialized/deinitialized during request lifetime.

@piotras
Copy link
Member

piotras commented May 19, 2011

Yes, this is what I meant. It is unsafe to register internal class in child process, and doesn't make sense to register all mgdschema classes per every request. Unless, there are special routines which take cli and server context into account. But this one might be a bit complicated.

@bergie
Copy link
Member

bergie commented Nov 2, 2011

This is a major annoyance when using Ratatoskr outside of Apache (with AiP, for instance). For now the workaround has been to use the MIDGARD_ENV_GLOBAL_SHAREDIR environment variable before starting the PHP process that uses Midgard. But that is clunky when everything else is handled via midgard_config object or file.

The current state causes weird workarounds, like:
https://github.com/piotras/phpcr-midgard2/blob/master/src/Midgard/PHPCR/RepositoryFactory.php#L25
https://github.com/piotras/phpcr-midgard2/blob/master/api-test/bootstrap.php#L22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants