Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Sharedir from configuration file ignored #8

piotras opened this Issue · 6 comments

3 participants

  • Create configuration with self defined ShareDir=/my/path.
  • In PHP script invoke midgard_storage::create_class_storage for a class which is defined in schema dir under /my/path.

Warning is thrown because given class is not registered as PHP, and all schemas has been read from standard prefix/share directory.


init schema using share-dir from config-file (if possible). Closed by 16814d1

@bergie bergie reopened this

Seems this issue still persists. If you place schemas into a custom directory and try to set them via a ShareDir of a Midgard config file (or config object) in a php-cli, the schemas will not be found.

This is especially critical as AiP is also running under cli.


Did you try to sharedir via env ?

export MIDGARD_ENV_GLOBAL_SHAREDIR=/path/to/sharedir

The problem with PHP extension is fact that we must register all classes when extension is loaded which means very early before PHP comes to userland.


Ah, just checked the closing commit.
In php ini, set :
The this config should be taken into account and it's sharedir.


Yes, but I wanted to reopen this so we get sharedirs working properly on dynamically loaded configurations as well. In the Hrungnir cycle making the schemas more flexible will be an important priority. In Desktop Summit you mentioned this should now be possible with more recent PHP versions?


Yep. I have been told there were many fixes in PHP wrt classes' memory management. But still, we have to consider couple of options:

  1. How to register classes in cli and in http server context.

Classes registered per request (in apache env) might be easily performance killer.

  1. How it should be forward compatible with PHP-GIR.

In PHP, we should start thinking differently. There will be no more

$o = new MgdSchemaClassName();

but instead:

$o = MidgardSchemaFactory::factory ("MgdSchemaClassName");


$o = new \GIR\Object ("MgdSchemaClassName");
@indeyets indeyets closed this in d7e7040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.