本文整理汇总了PHP中jApp::tempPath方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::tempPath方法的具体用法?PHP jApp::tempPath怎么用?PHP jApp::tempPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::tempPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
public function _connect()
{
if (isset($this->_profile['storage_dir']) && $this->_profile['storage_dir'] != '') {
$this->_storage_dir = str_replace(array('var:', 'temp:'), array(jApp::varPath(), jApp::tempPath()), $this->_profile['storage_dir']);
$this->_storage_dir = rtrim($this->_storage_dir, '\\/') . DIRECTORY_SEPARATOR;
} else {
$this->_storage_dir = jApp::varPath('kvfiles/');
}
jFile::createDir($this->_storage_dir);
if (isset($this->_profile['file_locking'])) {
$this->_file_locking = $this->_profile['file_locking'] ? true : false;
}
if (isset($this->_profile['automatic_cleaning_factor'])) {
$this->automatic_cleaning_factor = $this->_profile['automatic_cleaning_factor'];
}
if (isset($this->_profile['directory_level']) && $this->_profile['directory_level'] > 0) {
$this->_directory_level = $this->_profile['directory_level'];
if ($this->_directory_level > 16) {
$this->_directory_level = 16;
}
}
if (isset($this->_profile['directory_umask']) && is_string($this->_profile['directory_umask']) && $this->_profile['directory_umask'] != '') {
$this->_directory_umask = octdec($this->_profile['directory_umask']);
}
if (isset($this->_profile['file_umask']) && is_string($this->_profile['file_umask']) && $this->_profile['file_umask'] != '') {
$this->file_umask = octdec($this->_profile['file_umask']);
}
}
示例2: testContext
function testContext()
{
$appPath = jApp::appPath();
$varPath = jApp::varPath();
$logPath = jApp::logPath();
$configPath = jApp::configPath();
$wwwPath = jApp::wwwPath();
$scriptsPath = jApp::scriptsPath();
$tempPath = jApp::tempPath();
// first save
jApp::saveContext();
// verify that we still have the current path
$this->assertEquals($appPath, jApp::appPath());
$this->assertEquals($varPath, jApp::varPath());
$this->assertEquals($logPath, jApp::logPath());
$this->assertEquals($configPath, jApp::configPath());
$this->assertEquals($wwwPath, jApp::wwwPath());
$this->assertEquals($scriptsPath, jApp::scriptsPath());
$this->assertEquals($tempPath, jApp::tempPath());
// change the path
jApp::initPaths('/myapp/');
$this->assertEquals('/myapp/', jApp::appPath());
$this->assertEquals('/myapp/var/', jApp::varPath());
$this->assertEquals('/myapp/var/log/', jApp::logPath());
$this->assertEquals('/myapp/var/config/', jApp::configPath());
$this->assertEquals('/myapp/www/', jApp::wwwPath());
$this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
$this->assertEquals($tempPath, jApp::tempPath());
// second save
jApp::saveContext();
jApp::initPaths('/myapp2/');
$this->assertEquals('/myapp2/', jApp::appPath());
$this->assertEquals('/myapp2/var/', jApp::varPath());
$this->assertEquals('/myapp2/var/log/', jApp::logPath());
$this->assertEquals('/myapp2/var/config/', jApp::configPath());
$this->assertEquals('/myapp2/www/', jApp::wwwPath());
$this->assertEquals('/myapp2/scripts/', jApp::scriptsPath());
$this->assertEquals($tempPath, jApp::tempPath());
// pop the second save, we should be with the first saved values
jApp::restoreContext();
$this->assertEquals('/myapp/', jApp::appPath());
$this->assertEquals('/myapp/var/', jApp::varPath());
$this->assertEquals('/myapp/var/log/', jApp::logPath());
$this->assertEquals('/myapp/var/config/', jApp::configPath());
$this->assertEquals('/myapp/www/', jApp::wwwPath());
$this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
$this->assertEquals($tempPath, jApp::tempPath());
// pop the first save, we should be with initial paths
jApp::restoreContext();
$this->assertEquals($appPath, jApp::appPath());
$this->assertEquals($varPath, jApp::varPath());
$this->assertEquals($logPath, jApp::logPath());
$this->assertEquals($configPath, jApp::configPath());
$this->assertEquals($wwwPath, jApp::wwwPath());
$this->assertEquals($scriptsPath, jApp::scriptsPath());
$this->assertEquals($tempPath, jApp::tempPath());
}
示例3: testFlush
public function testFlush()
{
parent::testFlush();
$this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush1DataKey.cache'));
$this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush2DataKey.cache'));
$this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush3DataKey.cache'));
$this->assertTrue(jCache::flush($this->profile));
$this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush1DataKey.cache'));
$this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush2DataKey.cache'));
$this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush3DataKey.cache'));
}
示例4: loadProfile
protected function loadProfile()
{
try {
jProfiles::get('jcache', 'jforms', true);
} catch (Exception $e) {
// no profile, let's create a default profile
$cacheDir = jApp::tempPath('jforms');
jFile::createDir($cacheDir);
$params = array('enabled' => 1, 'driver' => 'file', 'ttl' => 3600 * 48, 'automatic_cleaning_factor' => 3, 'cache_dir' => $cacheDir, 'directory_level' => 3);
jProfiles::createVirtualProfile('jcache', 'jforms', $params);
}
}
示例5: useit
/**
* Let use one of the available theme
*/
function useit()
{
$theme = (string) $this->param('theme');
$mainConfig = new jIniFileModifier(jApp::configPath() . 'defaultconfig.ini.php');
$mainConfig->setValue('theme', strtolower($theme));
$mainConfig->setValue('datepicker', strtolower($theme), 'forms');
$mainConfig->save();
jFile::removeDir(jApp::tempPath(), false);
jMessage::add(jLocale::get('theme.selected'), 'information');
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
示例6: clear
function clear()
{
$confirm = $this->param('confirm');
if ($confirm == 'Y') {
jFile::removeDir(jApp::tempPath(), false);
jMessage::add(jLocale::get('jelixcache~jelixcache.cache.clear.done'));
} else {
jMessage::add(jLocale::get('jelixcache~jelixcache.cache.clear.canceled'));
}
$rep = $this->getResponse('redirect');
$rep->action = 'jelixcache~default:index';
return $rep;
}
示例7: testFlush
public function testFlush()
{
$kv = jKVDb::getConnection($this->profile);
$kv->set('flush1DataKey', 'some data', 0);
$kv->setWithTtl('flush2DataKey', 'data to remove', strtotime("+1 day"));
$kv->setWithTtl('flush3DataKey', 'other data to remove', time() + 30);
$this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/b6/d7/b6d72473bc7663367d02de121871b573_flush1DataKey'));
$this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/e0/85/e085abf6184768075f5284e5700897c2_flush2DataKey'));
$this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/c8/52/c8527b170651bf375a29e9e77e867385_flush3DataKey'));
$this->assertTrue($kv->flush());
$this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/b6/d7/b6d72473bc7663367d02de121871b573_flush1DataKey'));
$this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/e0/85/e085abf6184768075f5284e5700897c2_flush2DataKey'));
$this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/c8/52/c8527b170651bf375a29e9e77e867385_flush3DataKey'));
}
示例8: initOptions
/**
* set default parameters for Minify
*/
static function initOptions()
{
global $min_allowDebugFlag;
global $min_errorLogger;
global $min_enableBuilder;
global $min_cachePath;
global $min_documentRoot;
global $min_cacheFileLocking;
global $min_symlinks;
global $min_serveOptions;
global $min_uploaderHoursBehind;
global $min_customConfigPaths;
if (!isset($min_allowDebugFlag)) {
$min_allowDebugFlag = false;
}
if (!isset($min_errorLogger)) {
$min_errorLogger = false;
}
$min_enableBuilder = false;
$min_cachePath = \jApp::tempPath('minify/');
if (!file_exists($min_cachePath)) {
mkdir($min_cachePath, 0775);
}
if (!isset($min_documentRoot)) {
$min_documentRoot = self::getDocumentRoot();
}
if (!isset($min_cacheFileLocking)) {
$min_cacheFileLocking = true;
}
if (!isset($min_serveOptions['bubbleCssImports'])) {
$min_serveOptions['bubbleCssImports'] = false;
}
if (!isset($min_serveOptions['maxAge'])) {
$min_serveOptions['maxAge'] = 1800;
}
$min_serveOptions['minApp']['groupsOnly'] = false;
if (!isset($min_serveOptions['minApp']['maxFiles'])) {
$min_serveOptions['minApp']['maxFiles'] = 10;
}
if (!isset($min_symlinks)) {
$min_symlinks = array();
}
if (!isset($min_uploaderHoursBehind)) {
$min_uploaderHoursBehind = 0;
}
if (!isset($min_customConfigPaths)) {
$min_customConfigPaths = array('groups' => \jApp::configPath('minifyGroupsConfig.php'));
}
ini_set('zlib.output_compression', '0');
}
示例9: load
/**
* load and read the configuration of the application
* The combination of all configuration files (the given file
* and the mainconfig.ini.php) is stored
* in a single temporary file. So it calls the jConfigCompiler
* class if needed
* @param string $configFile the config file name
* @return object it contains all configuration options
* @see jConfigCompiler
*/
public static function load($configFile)
{
$config = array();
$file = jApp::tempPath() . str_replace('/', '~', $configFile);
if (BYTECODE_CACHE_EXISTS) {
$file .= '.conf.php';
} else {
$file .= '.resultini.php';
}
self::$fromCache = true;
if (!file_exists($file)) {
// no cache, let's compile
self::$fromCache = false;
} else {
$t = filemtime($file);
$dc = jApp::mainConfigFile();
$lc = jApp::configPath('localconfig.ini.php');
if (file_exists($dc) && filemtime($dc) > $t || filemtime(jApp::configPath($configFile)) > $t || file_exists($lc) && filemtime($lc) > $t) {
// one of the config files have been modified: let's compile
self::$fromCache = false;
} else {
// let's read the cache file
if (BYTECODE_CACHE_EXISTS) {
include $file;
$config = (object) $config;
} else {
$config = jelix_read_ini($file);
}
// we check all directories to see if it has been modified
if ($config->compilation['checkCacheFiletime']) {
foreach ($config->_allBasePath as $path) {
if (!file_exists($path) || filemtime($path) > $t) {
self::$fromCache = false;
break;
}
}
}
}
}
if (!self::$fromCache) {
require_once JELIX_LIB_CORE_PATH . 'jConfigCompiler.class.php';
return jConfigCompiler::readAndCache($configFile);
} else {
return $config;
}
}
示例10: readAndCache
public static function readAndCache($configFile, $isCli = null, $pseudoScriptName = '')
{
if ($isCli === null) {
$isCli = jServer::isCLI();
}
$config = self::read($configFile, false, $isCli, $pseudoScriptName);
$tempPath = jApp::tempPath();
jFile::createDir($tempPath);
if (BYTECODE_CACHE_EXISTS) {
$filename = $tempPath . str_replace('/', '~', $configFile) . '.conf.php';
if ($f = @fopen($filename, 'wb')) {
fwrite($f, '<?php $config = ' . var_export(get_object_vars($config), true) . ";\n?>");
fclose($f);
} else {
throw new Exception('Error while writing configuration cache file -- ' . $filename);
}
} else {
jIniFile::write(get_object_vars($config), $tempPath . str_replace('/', '~', $configFile) . '.resultini.php', ";<?php die('');?>\n");
}
return $config;
}
示例11: __construct
public function __construct($params)
{
$this->profil_name = $params['_name'];
if (isset($params['enabled'])) {
$this->enabled = $params['enabled'] ? true : false;
}
if (isset($params['ttl'])) {
$this->ttl = $params['ttl'];
}
$this->_cache_dir = jApp::tempPath('cache/') . $this->profil_name . '/';
if (isset($params['cache_dir']) && $params['cache_dir'] != '') {
if (is_dir($params['cache_dir']) && is_writable($params['cache_dir'])) {
$this->_cache_dir = rtrim(realpath($params['cache_dir']), '\\/') . DIRECTORY_SEPARATOR;
} else {
throw new jException('jelix~cache.directory.not.writable', $this->profil_name);
}
} else {
jFile::createDir($this->_cache_dir);
}
if (isset($params['file_locking'])) {
$this->_file_locking = $params['file_locking'] ? true : false;
}
if (isset($params['automatic_cleaning_factor'])) {
$this->automatic_cleaning_factor = $params['automatic_cleaning_factor'];
}
if (isset($params['directory_level']) && $params['directory_level'] > 0) {
$this->_directory_level = $params['directory_level'];
}
if (isset($params['directory_umask']) && is_string($params['directory_umask']) && $params['directory_umask'] != '') {
$this->_directory_umask = octdec($params['directory_umask']);
}
if (isset($params['file_name_prefix'])) {
$this->_file_name_prefix = $params['file_name_prefix'];
}
if (isset($params['cache_file_umask']) && is_string($params['cache_file_umask']) && $params['cache_file_umask'] != '') {
$this->_cache_file_umask = octdec($params['cache_file_umask']);
}
}
示例12: _getCacheFile
/**
* create the cache filename
* @return string the filename
*/
private function _getCacheFile()
{
$module = jContext::get();
$ar = $this->_params;
ksort($ar);
$id = md5(serialize($ar));
return jApp::tempPath('zonecache/~' . $module . '~' . strtolower(get_class($this)) . '~' . $id . '.php');
}
示例13: testSave
function testSave()
{
$parser = new testIniFileModifier('');
$content = '
; a comment
foo=bar
job= foo.b-a_r
messageLogFormat = "%date%\\t[%code%]\\t%msg%\\t%file%\\t%line%\\n"
anumber=98
afloatnumber= 5.098
[aSection]
truc= true
laurent=toto
isvalid = on
[othersection]
truc=machin2
[vla]
foo[]=aaa
foo[]=bbb
foo[]=ccc
';
$result = '
; a comment
foo=bar
job=foo.b-a_r
messageLogFormat="%date%\\t[%code%]\\t%msg%\\t%file%\\t%line%\\n"
anumber=98
afloatnumber=5.098
[aSection]
truc=true
laurent=toto
isvalid=on
[othersection]
truc=machin2
[vla]
foo[]=aaa
foo[]=bbb
foo[]=ccc
';
$parser->testParse($content);
$this->assertEqualOrDiff($result, $parser->generate());
file_put_contents(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php', $content);
$parser = new testIniFileModifier(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php');
$this->assertEqualOrDiff($result, $parser->generate());
$content = str_replace("\n", "\r", $content);
file_put_contents(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php', $content);
$parser = new testIniFileModifier(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php');
$this->assertEqualOrDiff($result, $parser->generate());
$content = str_replace("\r", "\r\n", $content);
file_put_contents(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php', $content);
$parser = new testIniFileModifier(jApp::tempPath() . 'test_jinifilemodifier.html_cli.php');
$this->assertEqualOrDiff($result, $parser->generate());
}
示例14: getCachePath
protected function getCachePath()
{
return jApp::tempPath('compiled/templates/');
}
示例15: _createCachePath
/**
* Build the WSDL cache file path
*/
private function _createCachePath()
{
$this->_cachePath = jApp::tempPath('compiled/' . $this->_dirname . '/' . $this->module . '~' . $this->controller . $this->_cacheSuffix);
}