本文整理汇总了PHP中lmb_var_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP lmb_var_dir函数的具体用法?PHP lmb_var_dir怎么用?PHP lmb_var_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lmb_var_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createIniFileNames
function _createIniFileNames()
{
$name = mt_rand();
$file = lmb_var_dir() . '/tmp_ini/' . $name . '.ini';
$override_file = lmb_var_dir() . '/tmp_ini/' . $name . '.override.ini';
return array($file, $override_file);
}
示例2: testCacheCreation
function testCacheCreation()
{
$cache_dir = lmb_var_dir() . '/some_dir';
$cache = lmbCacheFactory::createConnection('file://' . $cache_dir);
$this->assertEqual('file', $cache->getType());
$this->assertEqual($cache_dir, $cache->getCacheDir());
}
示例3: aggregate
function aggregate()
{
if (!rename($this->log_file, $new_name = tempnam(lmb_var_dir(), 'cache_log_aggregator'))) {
throw new lmbException('Can\'t move file', array('source' => $this->log_file, 'destination' => $new_name));
}
$cmd = "cat " . $new_name . ' | awk \' {if($NF>1){data[$2"/"$1]++;}} END{for(i in data){print i"/"data[i];}}\'';
$output = array();
exec($cmd, $output);
unlink($new_name);
$info = array();
foreach ($output as $string) {
list($cache_name, $result, $count) = explode('/', $string);
if (!isset($info[$cache_name])) {
$info[$cache_name] = array();
}
if (lmbCacheLog::PREFIX_HIT === $result) {
$info[$cache_name]['hits_count'] = $count;
} elseif (lmbCacheLog::PREFIX_MISS === $result) {
$info[$cache_name]['misses_count'] = $count;
} else {
throw new lmbException('WTF?', array($string));
}
}
return $info;
}
示例4: setUp
function setUp()
{
parent::setUp();
$this->conn = lmbToolkit::instance()->getDefaultDbConnection();
$dir_for_tests = lmb_var_dir() . '/constructor/';
$this->dir_for_test_case = $dir_for_tests . '/' . get_class($this);
lmbFs::mkdir($this->dir_for_test_case);
}
示例5: _createIniFile
function _createIniFile($contents, &$override_file = null)
{
$name = mt_rand();
$file = lmb_var_dir() . '/tmp_ini/' . $name . '.ini';
$override_file = lmb_var_dir() . '/tmp_ini/' . $name . '.override.ini';
file_put_contents($file, $contents);
return $file;
}
示例6: testPackageInclude_CustomPath
function testPackageInclude_CustomPath()
{
$this->createPackageMainFile('include_custom', lmb_var_dir());
lmb_package_require('include_custom', lmb_var_dir());
$this->assertTrue(lmb_package_registered('include_custom'));
$this->assertTrue(lmb_Var_dir() . '/include_custom', lmb_package_get_path('include_custom'));
$this->assertIdentical(1, lmbPackagesFunctionsTest::$counter);
}
示例7: lmb_tests_init_var_dir
function lmb_tests_init_var_dir($value)
{
if (file_exists($value)) {
lmbFs::rm($value);
}
lmbFs::mkdir($value);
$real = realpath($value) . '/';
lmb_var_dir($real);
}
示例8: testWrite
function testWrite()
{
$dsn = new lmbUri('file://' . lmb_var_dir() . '/logs/error' . uniqid() . '.log');
$writer = new lmbLogFileWriter($dsn);
$entry = new lmbLogEntry(LOG_ERR, 'foo');
$writer->write($entry);
$content = file_get_contents($writer->getLogFile());
$this->assertPattern('/Error/', $content);
$this->assertPattern('/foo/', $content);
}
示例9: testWrite
function testWrite()
{
$php_log = lmb_var_dir() . '/php.log';
ini_set('error_log', $php_log);
$writer = new lmbLogPHPLogWriter(new lmbUri());
$writer->write(new lmbLogEntry(LOG_ERR, 'foo'));
$content = file_get_contents($php_log);
$this->assertPattern('/Error/', $content);
$this->assertPattern('/foo/', $content);
}
示例10: testParse
function testParse()
{
$dsn = lmb_var_dir() . '/input_stream';
$params = 'foo_1=bar_1&foo_2=bar_2';
file_put_contents($dsn, $params);
$input_stream_parser = new lmbInputStreamParser();
$parsed_params = $input_stream_parser->parse($dsn);
$this->assertEqual($parsed_params['foo_1'], 'bar_1');
$this->assertEqual($parsed_params['foo_2'], 'bar_2');
}
示例11: setUp
function setUp()
{
if (!is_dir(lmb_var_dir())) {
mkdir(lmb_var_dir());
}
$this->tmp_dir = lmb_var_dir() . '/lmb_require/';
$this->_rm($this->tmp_dir);
mkdir($this->tmp_dir);
$this->env = $_ENV;
}
示例12: setUp
function setUp()
{
lmbToolkit::save();
$this->toolkit = lmbToolkit::merge(new lmbConfTools());
$this->application_configs_dir = lmb_var_dir() . '/app/settings';
lmbFs::mkdir($this->application_configs_dir);
$this->package_configs_dir = lmb_var_dir() . '/package/settings';
lmbFs::mkdir($this->package_configs_dir);
$tests_include_apth = $this->application_configs_dir . ';' . $this->package_configs_dir;
$this->toolkit->setConfIncludePath($tests_include_apth);
}
示例13: setUp
function setUp()
{
$this->base_dir = lmb_var_dir() . '/tpl';
$this->tpl_dir = $this->base_dir;
$this->cache_dir = $this->base_dir . '/compiled';
$this->tags_dir = dirname(__FILE__) . '/../../src/tags';
$this->filters_dir = dirname(__FILE__) . '/../../src/filters';
lmbFs::rm(lmb_var_dir());
lmbFs::mkdir(lmb_var_dir());
lmbFs::mkdir($this->base_dir);
lmbFs::mkdir($this->tpl_dir);
lmbFs::mkdir($this->cache_dir);
}
示例14: testWrite_SetEntryTitle
function testWrite_SetEntryTitle()
{
$toolkit = lmbToolkit::instance();
$toolkit->setLogEntryTitle('some_title');
$dsn = new lmbUri('file://' . lmb_var_dir() . '/logs/info' . uniqid() . '.log');
$conf = array('logs' => array('foo' => $dsn));
$toolkit->setConf('log', $conf);
$toolkit->log('message', $level = LOG_INFO, $params = array(), null, $log_name = 'foo');
$writers = $toolkit->getLog('foo')->getWriters();
$this->assertIsA($writers[0], 'lmbLogFileWriter');
$content = file_get_contents($writers[0]->getLogFile());
$this->assertPattern('/some_title/', $content);
$this->assertPattern('/Info/', $content);
$this->assertPattern('/message/', $content);
}
示例15: lmb_tests_init_db_dsn
function lmb_tests_init_db_dsn()
{
lmb_env_set('LIMB_CACHE_DB_META_IN_FILE', false);
if (lmbToolkit::instance()->isDefaultDbDSNAvailable()) {
$dsn = lmbToolkit::instance()->getDefaultDbDSN();
static $reported_about;
if (is_null($reported_about) || $reported_about != $dsn) {
$pass = $dsn->_getUri()->getPassword();
$masked_dsn = str_replace($pass, str_pad('*', strlen($pass), '*'), $dsn->toString());
echo "INFO: Using database '{$masked_dsn}'\n";
$reported_about = $dsn;
}
} else {
$default_value = 'sqlite://localhost/' . lmb_var_dir() . '/sqlite_tests.db';
$dsn = lmb_env_get('LIMB_TEST_DB_DSN', $default_value);
lmbToolkit::instance()->setDefaultDbDSN($dsn);
echo "INFO: Using default test database '{$dsn}'\n";
}
}