From 74f810464a672ca73733cf9b02e9765e16008979 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Wed, 7 Jan 2015 20:19:28 +0200 Subject: [PATCH] introduce project_root constant instead of project_path --- ipf.php | 10 ++++++---- ipf/command/createmigration.php | 2 +- ipf/command/migrate.php | 2 +- ipf/project_template.php | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ipf.php b/ipf.php index 2551a15..5c2d315 100644 --- a/ipf.php +++ b/ipf.php @@ -43,6 +43,8 @@ final class IPF if (php_sapi_name() === 'cli-server' && IPF::requestedFileExists()) return false; + $project_root = dirname($project_path); + self::$settings = IPF_Settings::create() ->apply(array( 'app_base' => '', @@ -59,10 +61,10 @@ final class IPF 'admin_title' => 'IPF Administration', )) ->set('ipf_path', dirname(__FILE__)) - ->set('project_path', $project_path) + ->set('project_root', $project_root) ->set('document_root', $document_root) - ->applyFile($project_path.'/settings.php') - ->tryApplyFile($project_path.'/settings_local.php'); + ->applyFile($project_root.'/project/settings.php') + ->tryApplyFile($project_root.'/project/settings_local.php'); self::checkSettings(self::$settings); @@ -101,7 +103,7 @@ final class IPF $file = '/' . strtolower(implode(DIRECTORY_SEPARATOR, $elts)).'.php'; self::include_existing(self::$settings->get('ipf_path') . $file); - self::include_existing(self::$settings->get('project_path') . $file); + self::include_existing(self::$settings->get('project_root') . '/project' . $file); if (!function_exists($function)) throw new IPF_Exception('Impossible to load the function: '.$function.' in '.$file); diff --git a/ipf/command/createmigration.php b/ipf/command/createmigration.php index adca2d9..e1f50c5 100644 --- a/ipf/command/createmigration.php +++ b/ipf/command/createmigration.php @@ -8,7 +8,7 @@ class IPF_Command_CreateMigration public function run($args=null) { $m = new \PFF\Migrations\Migrations; - $filename = $m->createMigration(IPF::get('project_path').'/db/migrations', implode('_', $args)); + $filename = $m->createMigration(IPF::get('project_root').'/project/db/migrations', implode('_', $args)); echo "Create new migration $filename\n"; } } diff --git a/ipf/command/migrate.php b/ipf/command/migrate.php index ac7ddd4..ed50c45 100644 --- a/ipf/command/migrate.php +++ b/ipf/command/migrate.php @@ -9,7 +9,7 @@ class IPF_Command_Migrate { $project = IPF_Project::getInstance(); - $paths = array(IPF::get('project_path').'/db/migrations'); + $paths = array(IPF::get('project_root').'/project/db/migrations'); foreach ($project->appList() as $app) { $paths[] = $app->getPath() . 'migrations'; } diff --git a/ipf/project_template.php b/ipf/project_template.php index eaf5cec..1d406bd 100644 --- a/ipf/project_template.php +++ b/ipf/project_template.php @@ -6,7 +6,7 @@ final class IPF_Project_Template { $dirs = array(); - $projectTemplates = IPF::get('project_path') . '/templates'; + $projectTemplates = IPF::get('project_root') . '/project/templates'; if (is_dir($projectTemplates)) $dirs[] = $projectTemplates; -- 2.49.0