Open Source Content Management Framework

New midgard-php

  1. New midgard-php

    Thu September 27 2007 08:06:48 UTC
    Hi!

    I think I ported all most important stuff from trunk ( aka Midgard2 ) to 1-9 branch.
    Changes will be available very soon in [new tarballs][0].

    New cool features:

    # midgard-php is now real language bindings.

    * It means every php object is mapped 1:1 to underlying GObject.
    * Properties' read and write is made "on-demand" ( 1.8 sets every single property wether you need to read it or not )
    * QB execute should be ~25% faster.
    * Constructor is twice faster.

    # Exceptions

    * MgdSchema constructor throws 'midgard_exception' exception, with mgd_errstr
    set as exception message.

    Difficult situation here is fact that MidCOM 2.8 must be usefull with Midgard 1.8 and 1.9,
    which means sill PHP4 support. Let me know if there are issues related to exceptions.
    I can disable them for some time.

    # Events

    * MgdSchema object and MidgardConnection emits signals for particular events.

    ## MgdSchema objects

    * action_create
    * action_created
    * action_update
    * action_updated
    * action_delete
    * action_deleted
    * action_purge
    * action_purged
    * action_import
    * action_imported
    * action_export
    * action_exported

    ## MidgardConnection

    * error
    * auth_changed
    * sitegroup_changed
    * lang_changed

    Legacy code also is modifed to emit signals.
    For example `mgd_auth_midgard` will trigger 'auth_changed' event.
    Every legacy function which sets error will trigger 'error' event.

    Example:

    <?php

    function my_func()
    {
    write_log(mgd_errstr());
    mail_admin(mgd_errstr());
    }

    $midgard = $_MIDGARD_CONNECTION;
    $midgard->connect("error", "my_func");

    $article = new midgard_article("theguidwhichdoesnotexist");

    ?>

    [More about events][1].

    # _MIDGARD_CONNECTION

    We still use legacy midgard connection , however new one is used in the background
    ( it means that Midgard1 is much more infected by Midgard2 ).
    There's $_MIDGARD_CONNECTION superglobal singleton on PHP level.

    You can use

    $whatever = $_MIDGARD_CONNECTION;

    any time you need in the code, however you might try these ( in apache environment ):

    $new_midgard = new midgard_connection();
    $new_midgard->open("configuration");

    $new_config = new midgard_config();
    $new_config->read_file("config_with_very_secret_data");

    but it really doesn't make sense :)
    Particular error messages are thrown in such cases, so you may sleep well, if you worried
    about security issues on your websites.

    BTW, what debian distro should I focus on while making new automated packages?
    stable, testing? Server is running stable so I need to figure out how to build testing
    packages in some chroot environment.

    [0]: http://www.midgard-project.org/nightly
    [1]: http://www.nemein.com/people/piotras/view/1182197841.html
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  2. RE: [midgard-dev] New midgard-php

    Fri September 28 2007 10:33:01 UTC
    Hi,

    > Changes will be available very soon in [new tarballs][0].

    Just for the record: all compiles ok but PHP won't load:

    PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/midgard.so' -
    /usr/lib/php/modules/midgard.so: undefined symbol: php_midgard_register_object in <b>Unknown</b> on
    line <b>0</b><br />

    BTW: I got on last running snapshot from 22.09

    (process:11936): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to
    `GObject'

    once for each request

    Solt

    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  3. Re: [midgard-dev] New midgard-php

    Fri September 28 2007 12:46:34 UTC
    "Marcin Soltysiak" <olga@olga.pl> wrote:

    > Hi,

    Hi!

    > > Changes will be available very soon in [new tarballs][0].
    >
    > Just for the record: all compiles ok but PHP won't load:
    >
    > PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/midgard.so' -
    > /usr/lib/php/modules/midgard.so: undefined symbol: php_midgard_register_object in <b>Unknown</b> on
    > line <b>0</b><br />

    Thanks! It's legacy mgd_get_object_by_guid.
    What about if I make this function dummy and throw warning about midgard_object_class::get_object_by_guid usage ?

    In meantime I fix it just in case.

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  4. RE: [midgard-dev] New midgard-php

    Fri September 28 2007 13:05:44 UTC
    > -----Original Message-----
    > From: dev-bounces@lists.midgard-project.org
    > [mailto:dev-bounces@lists.midgard-project.org] On Behalf Of
    > Piotr Pokora
    > Sent: Friday, September 28, 2007 2:47 PM
    > To: dev@lists.midgard-project.org
    > Subject: Re: [midgard-dev] New midgard-php
    >
    > "Marcin Soltysiak" <olga@olga.pl> wrote:
    >
    > > Hi,
    >
    > Hi!
    >
    > > > Changes will be available very soon in [new tarballs][0].
    > >
    > > Just for the record: all compiles ok but PHP won't load:
    > >
    > > PHP Startup: Unable to load dynamic library
    > '/usr/lib/php/modules/midgard.so' -
    > > /usr/lib/php/modules/midgard.so: undefined symbol:
    > php_midgard_register_object in <b>Unknown</b> on
    > > line <b>0</b><br />
    >
    > Thanks! It's legacy mgd_get_object_by_guid.
    > What about if I make this function dummy and throw warning
    > about midgard_object_class::get_object_by_guid usage ?

    Hmm.. let's see. However I saw lots of HAVE_LEGACY_API dependant functions. Are they all outdated?
    If so, there should be a bigger cleanup then.

    Solt

    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  5. Re: [midgard-dev] New midgard-php

    Fri September 28 2007 13:14:17 UTC
    "Marcin Soltysiak" <olga@olga.pl> wrote:

    Hi!

    > > What about if I make this function dummy and throw warning
    > > about midgard_object_class::get_object_by_guid usage ?
    >
    > Hmm.. let's see. However I saw lots of HAVE_LEGACY_API dependant functions. Are they all outdated?

    hmmm.... a bit, if you consider when all of them has been written ;)

    Those are always available:

    mgd_get_midgard
    mgd_preparse
    mgd_snippet
    mgd_errstr
    mgd_errno
    mgd_version
    mgd_auth_midgard
    mgd_unsetuid
    mgd_issetuid
    mgd_is_guid
    mgd_format
    mgd_set_lang
    mgd_get_lang
    mgd_set_default_lang
    mgd_get_default_lang
    mgd_debug_start
    mgd_debug_stop
    mgd_config_init
    get_sitegroup

    However there might be some issue with PHP_MIDGARD_LEGACY_API.
    New config.m4 is pecl compatible and I might missed something there.
    It's everything but decent configure script....

    > If so, there should be a bigger cleanup then.

    Midcom works nicely when extension is compiled with or without legacy API.
    Extension itself is cleaned in trunk , midcom needs to wait a bit I think.

    Anyway , I fixed this function and added E_NOTICE with midgard_object_class::get_object_by_guid reminder.
    midgard_object_class API is highly recommended and exists in 1.8 too , so no need to write additional hacks.

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
Designed by Nemein, hosted by Kafit