import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Framework
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
* @version $Id: Abstract.php 17795 2009-08-24 19:04:01Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -105,25 +105,47 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
* - if an enpoint variable has been registered in teh client registry - key=workingDirectory
|
||||
* - if an ENV variable with the key ZFPROJECT_PATH is found
|
||||
*
|
||||
* @
|
||||
* @param $loadProfileFlag bool Whether or not to throw an exception when no profile is found
|
||||
* @param $projectDirectory string The project directory to use to search
|
||||
* @param $searchParentDirectories bool Whether or not to search upper level direcotries
|
||||
* @return Zend_Tool_Project_Profile
|
||||
*/
|
||||
protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null)
|
||||
protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null, $searchParentDirectories = true)
|
||||
{
|
||||
|
||||
|
||||
// use the cwd if no directory was provided
|
||||
if ($projectDirectory == null) {
|
||||
$projectDirectory = getcwd();
|
||||
} elseif (realpath($projectDirectory) == false) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('The $projectDirectory supplied does not exist.');
|
||||
}
|
||||
|
||||
$profile = new Zend_Tool_Project_Profile();
|
||||
$profile->setAttribute('projectDirectory', $projectDirectory);
|
||||
|
||||
if ($profile->isLoadableFromFile()) {
|
||||
$profile->loadFromFile();
|
||||
$this->_loadedProfile = $profile;
|
||||
|
||||
$parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim($projectDirectory, DIRECTORY_SEPARATOR));
|
||||
while ($parentDirectoriesArray) {
|
||||
$projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);
|
||||
|
||||
if (DIRECTORY_SEPARATOR !== "\\") {
|
||||
$projectDirectoryAssembled = DIRECTORY_SEPARATOR . $projectDirectoryAssembled;
|
||||
}
|
||||
|
||||
$profile->setAttribute('projectDirectory', $projectDirectoryAssembled);
|
||||
if ($profile->isLoadableFromFile()) {
|
||||
chdir($projectDirectoryAssembled);
|
||||
|
||||
$profile->loadFromFile();
|
||||
$this->_loadedProfile = $profile;
|
||||
break;
|
||||
}
|
||||
|
||||
// break after first run if we are not to check upper directories
|
||||
if ($searchParentDirectories == false) {
|
||||
break;
|
||||
}
|
||||
|
||||
array_pop($parentDirectoriesArray);
|
||||
}
|
||||
|
||||
|
||||
if ($this->_loadedProfile == null) {
|
||||
if ($loadProfileFlag == self::NO_PROFILE_THROW_EXCEPTION) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.');
|
||||
@ -183,6 +205,21 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
$projectProfileFile->getContext()->save();
|
||||
}
|
||||
|
||||
protected function _getContentForContext(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters)
|
||||
{
|
||||
$storage = $this->_registry->getStorage();
|
||||
if (!$storage->isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!class_exists('Zend_Tool_Project_Context_Content_Engine')) {
|
||||
require_once 'Zend/Tool/Project/Context/Content/Engine.php';
|
||||
}
|
||||
|
||||
$engine = new Zend_Tool_Project_Context_Content_Engine($storage);
|
||||
return $engine->getContent($context, $methodName, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* _loadContextClassesIntoRegistry() - This is called by the constructor
|
||||
* so that child providers can provide a list of contexts to load into the
|
||||
@ -198,4 +235,4 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
$registry->addContextClass($contextClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user