Jump to content

Recommended Posts

Posted

in the blesta logs we found a lot of this notice message, is not a big deal , but it fill the logs and make them big sizer.

E_NOTICE: Use of undefined constant COREDIR - assumed 'COREDIR' {"code":8,"message":"Use of undefined constant COREDIR - assumed 'COREDIR'","file":"/home/hhhhhh/public_html/core/Automation/Tasks/Common/AbstractTask.php","line":116}

and still this old notice when editing invoice logged

E_WARNING: sprintf(): Too few arguments {"code":2,"message":"sprintf(): Too few arguments","file":"/home/hhhhhh/public_html/vendors/minphp/language/src/Language.php","line":125}

 

Posted
  On 5/23/2019 at 9:02 PM, Tyson said:

Do you have COREDIR defined in /core/ServiceProviders/MinphpBridge.php? It sounds like it's missing. 

Expand  

Yes , i have checked, it exist, but i have found that we didn't add it in a custom plugin that override  some container functions.

Posted

I'm curious to know what the reason is behind overriding WEBDIR? Adding a new constant for your case would not suffice?

Also, you can override WEBDIR by extending the container.

Posted
  On 5/24/2019 at 4:20 PM, Tyson said:

I'm curious to know what the reason is behind overriding WEBDIR? Adding a new constant for your case would not suffice? 

Also, you can override WEBDIR by extending the container. 

Expand  

we have some seo practice in our website, nd we need this to do it in our multilanguage plugin that add instance for every language in blesta like /fr/ or /ar/ ...ect

how we can override only WEBDIR by extending the container?

Posted

Interesting. You can extend it by calling the container's ::extend method, e.g.:

$this->container->extend(
    'minphp.constants',
    function ($instance, $c) {
        return array_merge($instance, ['WEBDIR' => $instance['WEBDIR'] . 'fr/']);
    }
);

There is an example in Blesta v4.6 that does this to override a few of the services for the application.

Posted
  On 5/28/2019 at 4:44 PM, Tyson said:

Interesting. You can extend it by calling the container's ::extend method, e.g.:

$this->container->extend(
    'minphp.constants',
    function ($instance, $c) {
        return array_merge($instance, ['WEBDIR' => $instance['WEBDIR'] . 'fr/']);
    }
);

There is an example in Blesta v4.6 that does this to override a few of the services for the application. 

Expand  

thank tyson, this only for the upcoming blesta 4.6 ?

i will test it later,  this will allow us to override it globally in blesta. so anywhere to call $this->base_uri will get the overridden value and not the default one ?  so from the preAction event we can dot it without changing or modifying any blesta files ?

Posted

Extending the container has been available since v4.0. We just happen to use it for v4.6.

I suspect you can extend the container from wherever you'd like (although I have not tested that), but it is better to extend it as early as possible in execution or it may be possible for some places to have already used the value before you override it.

  • Tyson locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...