Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified PHP linker to use configurable autoloaders and include paths #205

Merged
merged 2 commits into from
Aug 4, 2017

Conversation

tyearke
Copy link
Contributor

@tyearke tyearke commented Aug 3, 2017

Description

This pull request allows modules to specify PHP autoloaders and include paths using JSON config files in etc/linker.d.

Motivation and Context

XDMoD requires additional PHP libraries beyond Open XDMoD's requirements. This pull request allows those libraries to be used without having to directly reference them in Open XDMoD.

Tests Performed

Deployed modified code and verified that the instance worked as expected. Modified deployments with debug code to verify that the final include path stayed identical to the path before this change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This allows modules to specify autoloaders and include paths using a JSON config file in etc/linker.d.
@tyearke tyearke added the enhancement Enhancement of the functionality of an existing feature label Aug 3, 2017
@tyearke tyearke added this to the v7.0.0 milestone Aug 3, 2017
// Load linker configuration.
require_once("$baseDir/classes/CCR/Json.php");
require_once("$baseDir/classes/Xdmod/Config.php");
$config = Xdmod\Config::factory();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add some comments in here because it's a pain looking at the Xdmod\Config class code to figure out that it's loading the file on demand. Something like "Autoload linker configuration from linker.json" should be sufficient.

require_once("$baseDir/classes/CCR/Json.php");
require_once("$baseDir/classes/Xdmod/Config.php");
$config = Xdmod\Config::factory();
$linkerConfig = $config['linker'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file doesn't exist catch the exception and report a useful message.

$include_path .= ":" . $baseDir . '/classes/ReportTemplates';
$include_path .= ":" . $baseDir . '/classes/AppKernel';
$include_path .= ":" . $baseDir . '/libraries/HighRoller_1.0.5';
foreach ($linkerConfig['include_dirs'] as $includeDirPath) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we throw a warning if include_dirs doesn't exist?

@tyearke tyearke merged commit 8f68786 into ubccr:xdmod7.0 Aug 4, 2017
@tyearke tyearke deleted the features/modular-php-loader branch October 5, 2017 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of the functionality of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants