Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

Standardize class include paths

#47

Currently we include classes from the common folder using 2 different paths:
/common/feed.php /common//feed.php While these paths compute to the same location, they're viewed as unique for caching purposes. Removing the duplicate slashes would resolve this probably and lend itself to cleaner code.

Reported by Brian Michalski · September 17th, 2009 @ 10:20 PM

State: resolved
Milestone: Concert 1.9.x
Assigned to: Brian Michalski Brian Michalski

Activity

  1. Brian Michalski
    Brian Michalski
    • State changed from new to open

    It looks like we're inconsistent in our usage of COMMON_DIR when including files, as shown below. Should we assume this path always ends in a trailing slash or always assume it doesn't?

    admin/index.php:include(COMMON_DIR.'/feed.php')
    vs
    screen/content.php:include(COMMON_DIR."feed.php")

    Full usage of COMMON_DIR:
    admin/index.php:include(COMMON_DIR.'/mysql.inc.php');//Tom's sql library interface + db connection settings
    admin/index.php:include(COMMON_DIR.'/user.php'); //Class to represent a site user
    admin/index.php:include(COMMON_DIR.'/screen.php'); //Class to represent a screen in the system
    admin/index.php:include(COMMON_DIR.'/feed.php'); //Class to represent a content feed
    admin/index.php:include(COMMON_DIR.'/field.php'); //Class to represent a field in a template
    admin/index.php:include(COMMON_DIR.'/position.php'); //Class to represent a postion relationship
    admin/index.php:include(COMMON_DIR.'/content.php'); //Class to represent content items
    admin/index.php:include(COMMON_DIR.'/upload.php'); //Helps uploading
    admin/index.php:include(COMMON_DIR.'/group.php'); //Class to represent user groups
    admin/index.php:include(COMMON_DIR.'/dynamic.php'); //Functionality for dynamic content
    admin/index.php:include(COMMON_DIR.'/notification.php'); //Functionality for notifications
    admin/index.php:include(COMMON_DIR.'/newsfeed.php'); //Functionality for notifications
    admin/index.php:include(COMMON_DIR.'/template.php'); //Class to represent a template
    admin/index.php:include(COMMON_DIR.'/image.inc.php'); //Image library, used for resizing images
    common/upload.php: $command = COMMON_DIR . "scripts/DocumentConverter.py " . $source . " " . $target;
    common/template.php: $font=COMMON_DIR.'FreeSans.ttf';
    common/scripts/notifications.php:include(COMMON_DIR.'mysql.inc.php');//Tom's sql library interface + db connection settings
    common/scripts/notifications.php:include(COMMON_DIR.'user.php'); //Class to represent a site user
    common/scripts/notifications.php:include(COMMON_DIR.'screen.php'); //Class to represent a screen in the system
    common/scripts/notifications.php:include(COMMON_DIR.'feed.php'); //Class to represent a content feed
    common/scripts/notifications.php:include(COMMON_DIR.'field.php'); //Class to represent a field in a template
    common/scripts/notifications.php:include(COMMON_DIR.'position.php'); //Class to represent a postion relationship
    common/scripts/notifications.php:include(COMMON_DIR.'content.php'); //Class to represent content items in the system
    common/scripts/notifications.php:include(COMMON_DIR.'upload.php'); //Helps uploading
    common/scripts/notifications.php:include(COMMON_DIR.'group.php'); //Class to represent user groups
    common/scripts/notifications.php:include(COMMON_DIR.'dynamic.php'); //Functionality for dynamic content
    common/scripts/notifications.php:include(COMMON_DIR.'image.inc.php');//Image library, used for resizing images
    common/scripts/notifications.php:include(COMMON_DIR.'notification.php');//Class to represent notifications
    common/scripts/cron.php:include(COMMON_DIR.'mysql.inc.php');//Tom's sql library interface + db connection settings
    common/scripts/cron.php:include(COMMON_DIR.'user.php'); //Class to represent a site user
    common/scripts/cron.php:include(COMMON_DIR.'screen.php'); //Class to represent a screen in the system
    common/scripts/cron.php:include(COMMON_DIR.'feed.php'); //Class to represent a content feed
    common/scripts/cron.php:include(COMMON_DIR.'field.php'); //Class to represent a field in a template
    common/scripts/cron.php:include(COMMON_DIR.'position.php'); //Class to represent a postion relationship
    common/scripts/cron.php:include(COMMON_DIR.'content.php'); //Class to represent content items in the system
    common/scripts/cron.php:include(COMMON_DIR.'upload.php'); //Helps uploading
    common/scripts/cron.php:include(COMMON_DIR.'group.php'); //Class to represent user groups
    common/scripts/cron.php:include(COMMON_DIR.'dynamic.php'); //Functionality for dynamic content
    common/scripts/cron.php:include(COMMON_DIR.'image.inc.php');//Image library, used for resizing images
    common/scripts/cron.php:include(COMMON_DIR.'notification.php');//Class to represent notifications
    common/scripts/template_exp.php:include(COMMON_DIR.'mysql.inc.php');//Tom's sql library interface + db connection settings
    config.inc.php:define('COMMON_DIR', ROOT_DIR.'common/'); //server-side path to dir with resources for
    config.inc.php.sample:define('COMMON_DIR', ROOT_DIR.'common/'); //server-side path to dir with resources for
    content/render/api/009.php:include(COMMON_DIR.'/user.php'); //Class to represent a site user
    content/render/api/009.php:include(COMMON_DIR.'/feed.php'); //Class to represent a content feed
    content/render/api/009.php:include(COMMON_DIR.'/content.php'); //Class to represent content items in the system
    content/render/api/007.php:include(COMMON_DIR.'/user.php'); //Class to represent a site user
    content/render/api/007.php:include(COMMON_DIR.'/feed.php'); //Class to represent a content feed
    content/render/api/007.php:include(COMMON_DIR.'/content.php'); //Class to represent content items in the system
    content/render/api/008.php:include(COMMON_DIR.'/user.php'); //Class to represent a site user
    content/render/api/008.php:include(COMMON_DIR.'/feed.php'); //Class to represent a content feed
    content/render/api/008.php:include(COMMON_DIR.'/content.php'); //Class to represent content items in the system
    content/render/index.php:include_once(COMMON_DIR.'mysql.inc.php');
    content/render/render.php: include_once(COMMON_DIR.'image.inc.php');
    screen/image.php:include(COMMON_DIR.'mysql.inc.php');
    screen/template.php:include(COMMON_DIR.'mysql.inc.php');
    screen/index.php:include(COMMON_DIR."mysql.inc.php");
    screen/test.php:include(COMMON_DIR."/mysql.inc.php");
    screen/content.php:include(COMMON_DIR."mysql.inc.php");
    screen/content.php:include(COMMON_DIR."driver.php");
    screen/content.php:include(COMMON_DIR."feed.php");
    screen/content.php:include(COMMON_DIR."dynamic.php");
    screen/content.php:include(COMMON_DIR."screen.php");

    January 25th, 2010 @ 05:45 PM

  2. Brian Michalski
    Brian Michalski

    Mike: Do you see any reason we should NOT standardize the existence of a trailing slash on the COMMON_DIR variable? It would seem consistant with our other variables for us to assume its there...

    February 17th, 2010 @ 08:55 PM

  3. Michael DiTore
    Michael DiTore

    That sounds totally reasonable. The other variables (the ones that do CSS
    includes and all sorts of other things), I'm a little more hesitant to
    touch, but this one should definitely be standardized.

    February 18th, 2010 @ 01:10 AM

  4. Brian Michalski
    Brian Michalski
    • Assigned user set to Brian Michalski
    • State changed from open to resolved

    (from [708]) COMMON_DIR must end in a trailing slash (/). Updated diagnostics to test accordingly. [#47 Standardize class include paths state:resolved responsible:"Brian Michalski"]

    February 18th, 2010 @ 11:47 PM

  5. Brian Michalski

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.