In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
850 [In-Portal CMS] Optimization task N/A 2010-09-01 02:31 2011-09-26 05:08
alex  
alex  
normal  
needs work 5.1.0  
open  
 
none  
http://groups.google.com/group/in-portal-dev/browse_thread/thread/913c2ee4329cd75e
0
0000850: Automatic class name retrieving based on it's filename
I propose we auto-guess php class name based on filename, where that class is stored.

For example "my_super_helper.php" file will contain "MySuperHelper" class and nothing other.

There are several benefits of this:

    * no need to specify class name in unit config file (only class filename remains);
    * developer will be forced to properly name class file to connect it's class to the system.

We'll make some presumptions, that:

    * "eh" will transform to "EventHandler"
    * "tp" will transform to "TagProcessor"
    * all classes from "core" module, that are not event handler/tag processor should have "k" in front of their name

Before:

    * UsersEventHandler, users_event_handler.php
    * UserGroupsEventHandler, user_groups_eh.php
    * kThemesHelper, themes_helper.php
    * CustomFieldsTagProcessor, custom_fields_tag_processor.php

After:

    * UserEventHandler, user_eh.php
    * UserGroupEventHandler, user_group_eh.php
    * kThemeHelper, theme_helper.php
    * CustomFieldTagProcessor, custom_field_tp.php
This large change, since we need to rename most of our classes/files to keep everything working. That's why I propose this change to be made as part of 5.2.0 release.
Issue History
2011-09-26 05:08 alex Target Version 5.2.0 => Icebox
2011-09-26 05:07 alex Note Added: 0003913
2010-09-06 05:38 alex Note Added: 0002773
2010-09-06 05:38 alex Issue Monitored: Dmitry
2010-09-06 05:37 alex Status needs feedback => needs work
2010-09-06 05:37 alex Description Updated bug_revision_view_page.php?rev_id=563#r563
2010-09-05 20:54 Dmitry Note Added: 0002768
2010-09-05 20:54 Dmitry Assigned To => alex
2010-09-05 20:54 Dmitry Status active => needs feedback
2010-09-01 02:31 alex New Issue
2010-09-01 02:31 alex Reference => http://groups.google.com/group/in-portal-dev/browse_thread/thread/913c2ee4329cd75e

Notes
(0002768)
Dmitry   
2010-09-05 20:54   
I believe there is a type in one of your examples:

* CustomFieldEventHandler, custom_field_tp.php

will be:

* CustomFieldEventHandler, custom_field_eh.php


Also, just to clarify all non-EH/TP and NON-Core module Classes will NOT have "k" infront of it. Let's say Custom module Helper or something else?
(0002773)
alex   
2010-09-06 05:38   
Reminder sent to: Dmitry

10x for noticing, but error was on other part:

EventHandler should be replaced with TagProcessor, since most of other examples already have EventHandler in them.

I've fixed that.
(0003913)
alex   
2011-09-26 05:07   
We'll wait with this once, since auto-detecting filename could slow down unit config cache rebuild process.