本文整理汇总了PHP中TBGContext::addClasspath方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::addClasspath方法的具体用法?PHP TBGContext::addClasspath怎么用?PHP TBGContext::addClasspath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::addClasspath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doesComponentExist
protected static function _doesComponentExist($template, $throw_exceptions = true)
{
list($module_file, $actionClassName, $actionToRunName) = self::_getComponentDetails($template);
if (!class_exists($actionClassName)) {
TBGContext::addClasspath(THEBUGGENIE_MODULES_PATH . $module_file['module'] . DS . 'classes' . DS);
}
if (!class_exists($actionClassName)) {
if (!$throw_exceptions) {
return false;
}
throw new TBGComponentNotFoundException('The component class ' . $actionClassName . ' could not be found');
}
$actionClass = new $actionClassName();
if (!method_exists($actionClass, $actionToRunName)) {
if (!$throw_exceptions) {
return false;
}
throw new TBGComponentNotFoundException("The component action {$actionToRunName} was not found in the {$actionClassName} class");
}
$retval = self::_doesTemplateExist($template, $throw_exceptions, $module_file);
if (!$throw_exceptions) {
return $retval;
}
return array($retval, $actionClass, $actionToRunName);
}
示例2: install
public final function install($scope)
{
try {
$this->_install($scope);
$b2db_classpath = THEBUGGENIE_MODULES_PATH . $this->_name . DS . 'classes' . DS . 'B2DB';
if (TBGContext::getScope()->isDefault() && is_dir($b2db_classpath)) {
TBGContext::addClasspath($b2db_classpath);
$b2db_classpath_handle = opendir($b2db_classpath);
while ($table_class_file = readdir($b2db_classpath_handle)) {
if (($tablename = substr($table_class_file, 0, strpos($table_class_file, '.'))) != '') {
B2DB::getTable($tablename)->create();
}
}
}
$this->_loadFixtures($scope);
} catch (Exception $e) {
throw $e;
}
}
示例3: _upgradeFrom3dot0
protected function _upgradeFrom3dot0()
{
// Add new tables
TBGScopeHostnamesTable::getTable()->create();
// Add classpath for existing old tables used for upgrade
TBGContext::addClasspath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.0');
// Upgrade old tables
TBGScopesTable::getTable()->upgrade(TBGScopesTable3dot0::getTable());
TBGIssueFieldsTable::getTable()->upgrade(TBGIssueFieldsTable3dot0::getTable());
// Upgrade all modules
foreach (TBGContext::getModules() as $module) {
if (method_exists($module, 'upgradeFrom3dot0')) {
$module->upgradeFrom3dot0();
}
}
// Start a transaction to preserve the upgrade path
$transaction = B2DB::startTransaction();
// Add votes to feature requests for default issue type scheme
$its = new TBGIssuetypeScheme(1);
foreach (TBGIssuetype::getAll() as $fr) {
if ($fr instanceof TBGIssuetype) {
if (in_array($fr->getKey(), array('featurerequest', 'bugreport', 'enhancement'))) {
$its->setFieldAvailableForIssuetype($fr, 'votes');
}
}
}
$ut = TBGUsersTable::getTable();
$crit = $ut->getCriteria();
$crit->addUpdate(TBGUsersTable::PRIVATE_EMAIL, true);
$ut->doUpdate($crit);
// Add default gravatar setting
TBGSettings::saveSetting(TBGSettings::SETTING_ENABLE_GRAVATARS, 1);
$trans_crit = TBGWorkflowTransitionsTable::getTable()->getCriteria();
$trans_crit->addWhere(TBGWorkflowTransitionsTable::NAME, 'Request more information');
$trans_crit->addWhere(TBGWorkflowTransitionsTable::WORKFLOW_ID, 1);
$trans_row = TBGWorkflowTransitionsTable::getTable()->doSelectOne($trans_crit);
if ($trans_row) {
$transition = new TBGWorkflowTransition($trans_row->get(TBGWorkflowTransitionsTable::ID), $trans_row);
$transition->setTemplate('main/updateissueproperties');
$transition->save();
}
// End transaction and finalize upgrade
$transaction->commitAndEnd();
$this->upgrade_complete = true;
}
示例4: do_execute
//.........这里部分代码省略.........
$this->cliEcho("\nPlease enter the username The Bug Genie will use to connect to the database: \n");
$this->cliEcho('Database username: ', 'white', 'bold');
$db_username = $this->getInput();
$this->cliEcho("Database password (press ENTER if blank): ", 'white', 'bold');
$db_password = $this->getInput();
$this->cliEcho("\nPlease enter the database The Bug Genie will use.\nIf it does not exist, The Bug Genie will create it for you.\n(the default database name is ");
$this->cliEcho("thebuggenie_db", 'white', 'bold');
$this->cliEcho(" - press ENTER to use that):\n");
$this->cliEcho('Database name: ', 'white', 'bold');
$db_name = $this->getInput('thebuggenie_db');
$this->cliEcho("\n");
$this->cliEcho("The following settings will be used:\n");
$this->cliEcho("Database type: \t\t", 'white', 'bold');
$this->cliEcho($db_type . "\n");
$this->cliEcho("Database hostname: \t", 'white', 'bold');
$this->cliEcho($db_hostname . "\n");
$this->cliEcho("Database username: \t", 'white', 'bold');
$this->cliEcho($db_username . "\n");
$this->cliEcho("Database password: \t", 'white', 'bold');
$this->cliEcho($db_password . "\n");
$this->cliEcho("Database name: \t\t", 'white', 'bold');
$this->cliEcho($db_name . "\n");
$this->cliEcho("\nIf these settings are ok, press ENTER, or anything else to retry: ");
$e_ok = $this->askToDecline();
} while (!$e_ok);
try {
B2DB::setHost($db_hostname);
B2DB::setUname($db_username);
B2DB::setPasswd($db_password);
B2DB::setDBtype($db_type);
B2DB::initialize();
$engine_path = B2DB::getEngineClassPath();
if ($engine_path !== null) {
TBGContext::addClasspath($engine_path);
} else {
throw new Exception("Cannot initialize the B2DB engine");
}
B2DB::doConnect();
B2DB::createDatabase($db_name);
B2DB::setDBname($db_name);
B2DB::doConnect();
} catch (Exception $e) {
throw new Exception("Could not connect to the database:\n" . $e->getMessage());
}
B2DB::setDBname($db_name);
B2DB::doSelectDB();
$this->cliEcho("\nSuccessfully connected to the database.\n", 'green');
$this->cliEcho("Press ENTER to continue ... ");
$this->pressEnterToContinue();
$this->cliEcho("\n");
$this->cliEcho("Saving database connection information ... ", 'white', 'bold');
$this->cliEcho("\n");
B2DB::saveConnectionParameters(THEBUGGENIE_CORE_PATH . 'b2db_bootstrap.inc.php');
$this->cliEcho("Successfully saved database connection information.\n", 'green');
$this->cliEcho("\n");
} else {
B2DB::initialize(THEBUGGENIE_CORE_PATH . 'b2db_bootstrap.inc.php');
$this->cliEcho("Successfully connected to the database.\n", 'green');
if ($this->getProvidedArgument('use_existing_db_info') != 'yes') {
$this->cliEcho("Press ENTER to continue ... ");
$this->pressEnterToContinue();
}
}
$this->cliEcho("\nThe Bug Genie needs some server settings to function properly...\n\n");
do {
$this->cliEcho("URL rewriting\n", 'cyan', 'bold');
示例5: define
define('B2DB_BASEPATH', THEBUGGENIE_CORE_PATH . 'B2DB' . DS);
define('B2DB_CACHEPATH', THEBUGGENIE_CORE_PATH . 'cache' . DS . 'B2DB' . DS);
TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'B2DB' . DS . 'classes' . DS);
TBGLogging::log('...done (Adding B2DB classes to autoload path)');
TBGLogging::log('Initializing B2DB');
if (!isset($argc)) {
B2DB::setHTMLException(true);
}
B2DB::initialize(THEBUGGENIE_CORE_PATH . 'b2db_bootstrap.inc.php');
TBGLogging::log('...done (Initializing B2DB)');
if (B2DB::isInitialized()) {
TBGLogging::log('Database connection details found, connecting');
B2DB::doConnect();
TBGLogging::log('...done (Database connection details found, connecting)');
TBGLogging::log('Adding core table classpath to autoload path');
TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'classes' . DS . 'B2DB' . DS);
}
} catch (Exception $e) {
tbg_exception('Could not load and initiate the B2DB subsystem', $e);
}
TBGLogging::log('...done');
TBGLogging::log('Initializing context');
TBGContext::initialize();
TBGLogging::log('...done');
//require THEBUGGENIE_CORE_PATH . 'common_functions.inc.php';
require THEBUGGENIE_CORE_PATH . 'geshi/geshi.php';
TBGLogging::log('Caspar framework loaded');
} catch (Exception $e) {
if (!isset($argc)) {
tbg_exception('Exception caught', $e);
exit;