TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Hanami SVN discussion
  • (I hate to start ANOTHER Hanami thread but...)

    I thought it would be nice, now we are starting a little prep work with the svn (well a couple oare :P) to kick off a thread to update people with your thoughts, commits and ideas for the SVN.

    First off I've made a few changes with revisions 26->29 :)

    • Firstly I added a hanami folder to the modules directory (blank app structure ready for our work)
    • Secondly I edited admin.php and index.php.. the app was erroring because the constant IN_PRODUCTION had been removed
      • Secondary to this I moved all the common cfg stuff out of index/admin.php and put it into a common.php file: which they both can require(). I figure this simplifies any cfg options needed
    • I also added a HANAMI_VERSION constant into admin/index.php :)

    Thoughts?

  • Well, we don't want duplicate code while we're serving index.php, admin.php and install.php which difference is only the $kohana_application variable.
    The idea of the common.php isn't that bad.
    What's about the idea of having only the index.php and the htaccess serves a GET parameter (surely with an eye on security).


    # Rewrite admin. to admin.php/URL
    RewriteCond %{HTTP_HOST} ^admin.(.+) [NC]
    RewriteRule ^(.*)$ index.php/$1?backend [L,QSA]

    [...]

    # Rewrite to front.php/URL
    RewriteRule ^(.*)$ index.php/$1?frontend [PT,L]


    Now the install script have to change the IN_PRODUCTION const.

    Is this possible?

    Another note:
    I'll start an Hanami hook as a "bootstrap" like component where HANAMI_VERSION and HANAMI_CODENAME are placed. Would you agree? Or is our common.php the bootstrap?
  • I deliberately didnt call common.php hamani_bootstrap.php because it occured to me someone might want ot make a bootstrap hook :P (it's a great idea). HANAMI_VERSION is used in common.php to disallow direct access.. so if you move it to the hook (I'd say that was a good idea!) then we need something to replace that check (or just remove the check.) Up to you.

    Regarding the install script: it was just an idea to edit the file... it should be easy enough to edit the file with PHP: but it isn't essential :D

    Regarding the rewrite: that's not such a good idea I think. There is a chance that the URL could have GET info in it anyway and the .htaccess could mess that up. Maybe?

  • Instead of doing weird things with $_GET, why not use *backend.php* and *index.php*, like dyron suggested?

  • After my handball trainig this comes to my mind:

    Stay at index.php with


    $kohana_application = !IN_PRODUCTION ? 'modules/install' : 'frontend';


    and admin.php with


    $kohana_application = 'backend';


    and the head of the Install_Controller is


    <?php !IN_PRODUCTION or die('Installation already succeeded.');


    May this is save enough? In addition you can remove the install module folder too
  • @shadowhand: what you mentioned is how it is currently, just with "common" stuff shared in one file for ease

    @Dyron: It occurs to me that that is perhaps an idea to store for down the road, What do you think? When you can see how Install will integrate (as it is completed) you could well discover a different way :) but ofc I can't say either way. It's up to mkjems! (where is he!)...

    Umm it occurs I have just been making changes and adding stuff pretty arbitrarily.. it just seemed a good idea to put some code down and kick things off... I just did things that occurred to me! It's easily switched back :)

  • I'll try to merge my branch to the trunk.

    What do you think of keeping two "entring points" index.php and admin.php as stay near the Kohana index.php one.

    And all Hanami basic stuff can loaded after the system.ready via hook. I think that should be clean.
  • Yeh snds good to me :)

    EDIT: you mean get rid of common.php?

  • I think so. Wait for other comments *look at shadowhand*
  • Everyone that visits IRC should know that I'm a fan of hooks. :)

  • Hookman :)

    Tyrael

  • So, the hook has to check if all the required modules exists.

    Maybe in /modules/hanami/config/require.php


    $config['require'] = array
    (
    'auth',
    'acl',
    'static_content',
    );
  • I think, that IN_PRODUCTION const is bad idea, install.php in root folder is better.
    Because:
    - index.php is core file and think it should remain untouched
    - it'll be more simple for understanding, every part of application has its own 'gate' (index.php admin.php install.php)
    - no neccesary for program php-files editing (may be only for deleting), its more surely.
  • Posted By: Shadowhand

    Everyone that visits IRC should know that I'm a fan of hooks. :)



    After giving some thoughts to that, maybe Hanami get rid of the admin.php changing the application via hook. But i'm not happy about, that this have to check every request.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion