本文整理汇总了PHP中TBGContext::addAutoloaderClassPath方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::addAutoloaderClassPath方法的具体用法?PHP TBGContext::addAutoloaderClassPath怎么用?PHP TBGContext::addAutoloaderClassPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::addAutoloaderClassPath方法的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::addAutoloaderClassPath(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: die
<?php
// This code requires PHP 5.3 or newer, so if we don't have it - don't continue
if (PHP_VERSION_ID < 50300) {
die('This software requires PHP 5.3.0 or newer, but you have an older version. Please upgrade.');
}
gc_enable();
date_default_timezone_set('UTC');
if (!defined('THEBUGGENIE_PATH')) {
throw new \Exception('You must define the THEBUGGENIE_PATH constant so we can find the files we need');
}
// Load the context class, which controls most of things
require THEBUGGENIE_CORE_PATH . 'classes' . DS . 'TBGContext.class.php';
spl_autoload_register(array('TBGContext', 'autoload'));
TBGContext::setDebugMode(true);
TBGContext::setMinifyEnabled(false);
TBGContext::addAutoloaderClassPath(THEBUGGENIE_CORE_PATH . 'classes' . DS);
TBGContext::addAutoloaderClassPath(THEBUGGENIE_CORE_PATH . 'classes' . DS . 'B2DB' . DS);
TBGContext::autoloadNamespace('b2db', THEBUGGENIE_CORE_PATH . 'B2DB' . DS);
TBGContext::initialize();
// Initialize all composer loaded vendor packages
if (!file_exists(THEBUGGENIE_CORE_PATH . 'lib' . DS . 'autoload.php')) {
throw new \TBGComposerException('You must initialize vendor libraries by running `composer.phar install` via cli');
}
require THEBUGGENIE_CORE_PATH . 'lib' . DS . 'autoload.php';
示例3: runUpgrade
public function runUpgrade(TBGRequest $request)
{
$version_info = explode(',', file_get_contents(THEBUGGENIE_PATH . 'installed'));
$this->current_version = $version_info[0];
$this->upgrade_available = $this->current_version != '3.3';
if ($this->upgrade_available) {
$scope = new TBGScope();
$scope->setID(1);
$scope->setEnabled();
TBGContext::setScope($scope);
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.2');
$this->statuses = TBGListTypesTable::getTable()->getStatusListForUpgrade();
$this->adminusername = TBGUsersTable3dot2::getTable()->getAdminUsername();
}
$this->upgrade_complete = false;
if ($this->upgrade_available && $request->isPost()) {
$this->upgrade_complete = false;
switch ($this->current_version) {
case '3.0':
$this->_upgradeFrom3dot0();
case '3.1':
$this->_upgradeFrom3dot1();
case '3.2':
$this->_upgradeFrom3dot2($request);
}
if ($this->upgrade_complete) {
$existing_installed_content = file_get_contents(THEBUGGENIE_PATH . 'installed');
file_put_contents(THEBUGGENIE_PATH . 'installed', TBGSettings::getVersion(false, false) . ', upgraded ' . date('d.m.Y H:i') . "\n" . $existing_installed_content);
$prev_error_reportiong_level = error_reporting(0);
unlink(THEBUGGENIE_PATH . 'upgrade');
error_reporting($prev_error_reportiong_level);
if (file_exists(THEBUGGENIE_PATH . 'upgrade')) {
$this->upgrade_file_failed = true;
}
$this->current_version = TBGSettings::getVersion(false, false);
$this->upgrade_available = false;
}
} elseif ($this->upgrade_available) {
$this->permissions_ok = false;
if (is_writable(THEBUGGENIE_PATH . 'installed') && is_writable(THEBUGGENIE_PATH . 'upgrade')) {
$this->permissions_ok = true;
}
} elseif ($this->upgrade_complete) {
$this->forward(TBGContext::getRouting()->generate('home'));
}
}
示例4: install
public final function install($scope)
{
try {
TBGContext::clearRoutingCache();
TBGContext::clearPermissionsCache();
$this->_install($scope);
$b2db_classpath = THEBUGGENIE_MODULES_PATH . $this->_name . DS . 'classes' . DS . 'B2DB';
if (TBGContext::getScope()->isDefault() && is_dir($b2db_classpath)) {
TBGContext::addAutoloaderClassPath($b2db_classpath);
$b2db_classpath_handle = opendir($b2db_classpath);
while ($table_class_file = readdir($b2db_classpath_handle)) {
if (($tablename = mb_substr($table_class_file, 0, mb_strpos($table_class_file, '.'))) != '') {
\b2db\Core::getTable($tablename)->create();
}
}
}
$this->_loadFixtures($scope);
} catch (Exception $e) {
throw $e;
}
}
示例5: 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\Core::setHost($db_hostname);
\b2db\Core::setUname($db_username);
\b2db\Core::setPasswd($db_password);
\b2db\Core::setDBtype($db_type);
\b2db\Core::initialize();
$engine_path = \b2db\Core::getEngineClassPath();
if ($engine_path !== null) {
TBGContext::addAutoloaderClassPath($engine_path);
} else {
throw new Exception("Cannot initialize the B2DB engine");
}
\b2db\Core::doConnect();
\b2db\Core::createDatabase($db_name);
\b2db\Core::setDBname($db_name);
\b2db\Core::doConnect();
} catch (Exception $e) {
throw new Exception("Could not connect to the database:\n" . $e->getMessage());
}
\b2db\Core::setDBname($db_name);
\b2db\Core::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\Core::saveConnectionParameters(THEBUGGENIE_CORE_PATH . 'b2db_bootstrap.inc.php');
$this->cliEcho("Successfully saved database connection information.\n", 'green');
$this->cliEcho("\n");
} else {
\b2db\Core::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');