本文整理汇总了PHP中Services::startService方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::startService方法的具体用法?PHP Services::startService怎么用?PHP Services::startService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::startService方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_start_stop_restart
function test_start_stop_restart()
{
$this->test_register_service();
//$this->assertFalse(Services::serviceRunning("DBHandler"));
// start it!
$this->assertTrue(Services::startService("DBHandler"));
$this->assertTrue(Services::serviceRunning("DBHandler"));
$this->assertTrue(Services::serviceAvailable("DBHandler"));
// stop it!
$this->assertTrue(Services::stopService("DBHandler"));
$this->assertFalse(Services::serviceRunning("DBHandler"));
$this->assertTrue(Services::serviceAvailable("DBHandler"));
// restart it! (or, first start it, *then* restart it!)
$this->assertTrue(Services::startService("DBHandler"));
$this->assertTrue(Services::serviceRunning("DBHandler"));
$this->assertTrue(Services::serviceAvailable("DBHandler"));
$this->assertTrue(Services::restartService("DBHandler"));
$this->assertTrue(Services::serviceRunning("DBHandler"));
$this->assertTrue(Services::serviceAvailable("DBHandler"));
}
示例2: requireService
/**
* The Require Service function checks for required service availability.
*
* The function first checks for service availabilty, and then attempts to
* start the service if it's available. If either action fails, it stops
* script execution. If $start=false then the function will only check for
* availability.
* @param string $name The name of the service.
* @param boolean $start If we should attempt to start the service or not.
* @access public
* @static
* @return ref object The started service object. (if start=true)
* @deprecated 2004/07/28 Use {@link startManagerAsService()} and {@link getService()} instead.
**/
static function requireService($service, $start = true)
{
$backtrace = debug_backtrace();
print "\n<br/><strong>Warning: Method call, Services::requireService(), is deprecated. Please use Services::startManagerAsService() and/or Services::getService() instead. ";
print $backtrace[0]['file'] . " (Line " . $backtrace[0]['line'] . ")";
print "</strong><br/>\n";
$error = false;
if (!Services::serviceAvailable($service)) {
$error = true;
} else {
if ($start && !Services::serviceRunning($service) && !Services::startService($service)) {
$error = true;
}
}
if ($error) {
// if we have the error Handler, throw a pretty error with that,
// otherwise, use the die() function.
if ($GLOBALS[SERVICES_OBJECT]->available('ErrorHandler')) {
throwError(new Error("A required Service <b>\"{$service}\"</b> " . ($start ? "could not be started" : "is not available"), "Services", 1));
} else {
$debug = debug_backtrace();
$str = "<B>FATAL ERROR</b><br /><br />";
$str .= "A required Service <b>\"{$service}\"</b> ";
$str .= $start ? "could not be started" : "is not available";
$str .= ".<br /><br />\n";
$str .= "<b>Debug backtrace:</b>\n";
$str .= "<pre>\n";
$str .= print_r($debug, true);
$str .= "\n</pre>\n";
die($str);
}
}
if ($start) {
return Services::getService($service);
}
}
示例3: Timer
$timer = new Timer();
$timer->start();
$harmonyLoadupTimer = new Timer();
$harmonyLoadupTimer->start();
require_once dirname(__FILE__) . "/../../../../harmoni.inc.php";
$harmonyLoadupTimer->end();
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler");
$dbHandler = Services::getService("DatabaseManager");
$dbIndex = $dbHandler->addDatabase(new MySQLDatabase("devo", "doboHarmoniTest", "test", "test"));
$dbHandler->pConnect($dbIndex);
Services::startService("Shared", $dbIndex, "doboHarmoniTest");
Services::startService("Hierarchy", $dbIndex, "doboHarmoniTest");
Services::startService("AuthN", $dbIndex, "doboHarmoniTest");
$errorHandler->setDebugMode(TRUE);
$test = new GroupTest('Authorization Tests');
$test->addTestFile(HARMONI . '/oki/authorization/tests/FunctionTestCase.class.php');
$test->addTestFile(HARMONI . '/oki/authorization/tests/QualifierTestCase.class.php');
$test->addTestFile(HARMONI . '/oki/authorization/tests/AuthorizationTestCase.class.php');
$test->addTestFile(HARMONI . '/oki/authorization/tests/AuthorizationManagerTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
$timer->end();
print "\n<br />Harmoni Load Time: " . $harmonyLoadupTimer->printTime();
print "\n<br />Overall Time: " . $timer->printTime();
print "\n</p>";
$num = $dbHandler->getTotalNumberOfQueries();
debug::output("Total # of queries: " . $num, 1, "DBHandler");
debug::printAll();