Skip to content
Snippets Groups Projects
Commit cdb6ea20 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #43 from greezybacon/issue/include-path-grows


Avoid adding extra slashes to the INCLUDE_PATH

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 65f2955a 2feede58
No related branches found
No related tags found
No related merge requests found
...@@ -50,8 +50,7 @@ class Deployment extends Unpacker { ...@@ -50,8 +50,7 @@ class Deployment extends Unpacker {
$include = ($upgrade) ? $this->get_include_dir() $include = ($upgrade) ? $this->get_include_dir()
: ($options['include'] ? $options['include'] : ($options['include'] ? $options['include']
: "{$this->destination}/include"); : "{$this->destination}/include");
if (substr($include, -1) !== '/') $include = rtrim($include, '/').'/';
$include .= '/';
# Locate the upload folder # Locate the upload folder
$root = $this->find_root_folder(); $root = $this->find_root_folder();
......
...@@ -48,6 +48,7 @@ class Unpacker extends Module { ...@@ -48,6 +48,7 @@ class Unpacker extends Module {
# Read the main.inc.php script # Read the main.inc.php script
$bootstrap_php = $this->destination . '/bootstrap.php'; $bootstrap_php = $this->destination . '/bootstrap.php';
$lines = explode("\n", file_get_contents($bootstrap_php)); $lines = explode("\n", file_get_contents($bootstrap_php));
$include_path = preg_replace('://+:', '/', $include_path);
# Try and use ROOT_DIR # Try and use ROOT_DIR
if (strpos($include_path, $this->destination) === 0) if (strpos($include_path, $this->destination) === 0)
$include_path = "ROOT_DIR . '" . $include_path = "ROOT_DIR . '" .
...@@ -141,11 +142,12 @@ class Unpacker extends Module { ...@@ -141,11 +142,12 @@ class Unpacker extends Module {
// NOTE: that this won't work for crafty folks who have a define or some // NOTE: that this won't work for crafty folks who have a define or some
// variable in the value of their include path // variable in the value of their include path
if (!defined('ROOT_DIR')) define('ROOT_DIR', $this->destination . '/'); if (!defined('ROOT_DIR'))
define('ROOT_DIR', rtrim($this->destination, '/').'/');
foreach ($lines as $line) foreach ($lines as $line)
eval($line); eval($line);
return INCLUDE_DIR; return rtrim(INCLUDE_DIR, '/').'/';
} }
function run($args, $options) { function run($args, $options) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment