本文整理汇总了PHP中jFile::parseJelixPath方法的典型用法代码示例。如果您正苦于以下问题:PHP jFile::parseJelixPath方法的具体用法?PHP jFile::parseJelixPath怎么用?PHP jFile::parseJelixPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jFile
的用法示例。
在下文中一共展示了jFile::parseJelixPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: atStart
function atStart($config)
{
if ($config->sessions['storage'] == 'files') {
$config->sessions['files_path'] = jFile::parseJelixPath($config->sessions['files_path']);
}
$config->sessions['_class_to_load'] = array();
if ($config->sessions['loadClasses'] != '') {
trigger_error("Configuration: loadClasses is deprecated, use instead autoload configuration in jelix-module.json or module.xml files", E_USER_NOTICE);
$list = preg_split('/ *, */', $config->sessions['loadClasses']);
foreach ($list as $sel) {
if (preg_match("/^([a-zA-Z0-9_\\.]+)~([a-zA-Z0-9_\\.\\/]+)\$/", $sel, $m)) {
if (!isset($config->_modulesPathList[$m[1]])) {
throw new Exception('Error in the configuration file -- in loadClasses parameter, ' . $m[1] . ' is not a valid or activated module');
}
if (($p = strrpos($m[2], '/')) !== false) {
$className = substr($m[2], $p + 1);
$subpath = substr($m[2], 0, $p + 1);
} else {
$className = $m[2];
$subpath = '';
}
$path = $config->_modulesPathList[$m[1]] . 'classes/' . $subpath . $className . '.class.php';
if (!file_exists($path) || strpos($subpath, '..') !== false) {
throw new Exception('Error in the configuration file -- in loadClasses parameter, bad class selector: ' . $sel);
}
$config->sessions['_class_to_load'][] = $path;
} else {
throw new Exception('Error in the configuration file -- in loadClasses parameter, bad class selector: ' . $sel);
}
}
}
}
示例2: _connect
public function _connect()
{
if (isset($this->_profile['storage_dir']) && $this->_profile['storage_dir'] != '') {
$this->_storage_dir = jFile::parseJelixPath($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']);
}
}
示例3: _connect
protected function _connect()
{
$funcconnect = isset($this->profile['persistent']) && $this->profile['persistent'] ? 'sqlite_popen' : 'sqlite_open';
$db = $this->profile['database'];
if (preg_match('/^(app|lib|var)\\:/', $db)) {
$path = jFile::parseJelixPath($db);
} else {
$path = jApp::varPath('db/sqlite/' . $db);
}
if ($cnx = @$funcconnect($path)) {
return $cnx;
} else {
throw new jException('jelix~db.error.connection', $db);
}
}
示例4: _connect
protected function _connect()
{
$funcconnect = isset($this->profile['persistent']) && $this->profile['persistent'] ? 'sqlite_popen' : 'sqlite_open';
$db = $this->profile['database'];
if (preg_match('/^(app|lib|var)\\:/', $db)) {
$path = jFile::parseJelixPath($db);
} else {
if ($db[0] == '/' || preg_match('!^[a-z]\\:(\\\\|/)[a-z]!i', $db)) {
if (file_exists($db) || file_exists(dirname($db))) {
$path = $db;
} else {
throw new Exception('sqlite connector: unknown database path scheme');
}
} else {
$path = jApp::varPath('db/sqlite/' . $db);
}
}
if ($cnx = @$funcconnect($path)) {
return $cnx;
} else {
throw new jException('jelix~db.error.connection', $db);
}
}
示例5: _connect
protected function _connect()
{
$db = $this->profile['database'];
if (preg_match('/^(app|lib|var|temp|www)\\:/', $db)) {
$path = jFile::parseJelixPath($db);
} else {
if ($db[0] == '/' || preg_match('!^[a-z]\\:(\\\\|/)[a-z]!i', $db)) {
if (file_exists($db) || file_exists(dirname($db))) {
$path = $db;
} else {
throw new Exception('sqlite3 connector: unknown database path scheme');
}
} else {
$path = jApp::varPath('db/sqlite3/' . $db);
}
}
$sqlite = new SQLite3($path);
// Load extensions if needed
if (isset($this->profile['extensions'])) {
$list = preg_split('/ *, */', $this->profile['extensions']);
foreach ($list as $ext) {
try {
$sqlite->loadExtension($ext);
} catch (Exception $e) {
throw new Exception('sqlite3 connector: error while loading sqlite extension ' . $ext);
}
}
}
// set timeout
if (isset($this->profile['busytimeout'])) {
$timeout = intval($this->profile['busytimeout']);
if ($timeout) {
$sqlite->busyTimeout($timeout);
}
}
return $sqlite;
}
示例6: getModulesPath
/**
* retrieve all modules specifications
*/
protected function getModulesPath($modulesPath, $defaultAccess)
{
$list = preg_split('/ *, */', $modulesPath);
array_unshift($list, JELIX_LIB_PATH . 'core-modules/');
$modulesPathList = array();
foreach ($list as $k => $path) {
if (trim($path) == '') {
continue;
}
$p = jFile::parseJelixPath($path);
if (!file_exists($p)) {
throw new Exception('The path, ' . $path . ' given in the jelix config, doesn\'t exists !', E_USER_ERROR);
}
if (substr($p, -1) != '/') {
$p .= '/';
}
$this->moduleRepositories[$p] = array();
if ($handle = opendir($p)) {
while (false !== ($f = readdir($handle))) {
if ($f[0] != '.' && is_dir($p . $f)) {
$m = new migrateModule();
$m->path = $p . $f . '/';
$m->name = $f;
$m->access = $f == 'jelix' ? 2 : $defaultAccess;
$m->repository = $p;
$modulesPathList[$f] = $m;
$this->moduleRepositories[$p][$f] = $m;
}
}
closedir($handle);
}
}
return $modulesPathList;
}
示例7: _execute
protected function _execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getArgument('module');
$initialVersion = $input->getOption('ver');
if (!$initialVersion) {
$initialVersion = '0.1pre';
}
// note: since module name are used for name of generated name,
// only this characters are allowed
if ($module == null || preg_match('/([^a-zA-Z_0-9])/', $module)) {
throw new \Exception("'" . $module . "' is not a valid name for a module");
}
// check if the module already exist or not
$path = '';
try {
$path = $this->getModulePath($module);
} catch (\Exception $e) {
}
if ($path != '') {
throw new \Exception("module '" . $module . "' already exists");
}
// verify the given repository
$repository = $input->getArgument('repository');
if (substr($repository, -1) != '/') {
$repository .= '/';
}
$repositoryPath = \jFile::parseJelixPath($repository);
if (!$input->getOption('noregistration')) {
$this->registerModulesDir($repository, $repositoryPath);
}
$path = $repositoryPath . $module . '/';
$this->createDir($path);
App::setConfig(null);
$noSubDir = $input->getOption('nosubdir');
$addInstallZone = $input->getOption('addinstallzone');
$isdefault = $input->getOption('defaultmodule');
if ($input->getOption('admin')) {
$noSubDir = false;
$addInstallZone = false;
}
$param = array();
$param['module'] = $module;
$param['version'] = $initialVersion;
$this->createFile($path . 'jelix-module.json', 'module/jelix-module.json.tpl', $param);
// create all sub directories of a module
if (!$noSubDir) {
$this->createDir($path . 'classes/');
$this->createDir($path . 'zones/');
$this->createDir($path . 'controllers/');
$this->createDir($path . 'templates/');
$this->createDir($path . 'classes/');
$this->createDir($path . 'daos/');
$this->createDir($path . 'forms/');
$this->createDir($path . 'locales/');
$this->createDir($path . 'locales/en_US/');
$this->createDir($path . 'locales/fr_FR/');
$this->createDir($path . 'install/');
if ($this->verbose()) {
$output->writeln("Sub directories have been created in the new module {$module}.");
}
$this->createFile($path . 'install/install.php', 'module/install.tpl', $param);
$this->createFile($path . 'urls.xml', 'module/urls.xml.tpl', array());
}
$iniDefault = new \Jelix\IniFile\IniModifier(App::mainConfigFile());
$urlsFile = App::appConfigPath($iniDefault->getValue('significantFile', 'urlengine'));
$xmlMap = new \Jelix\Routing\UrlMapping\XmlMapModifier($urlsFile, true);
// activate the module in the application
if ($isdefault) {
if ($this->allEntryPoint) {
$xmlEp = $xmlMap->getDefaultEntryPoint($type);
} else {
$xmlEp = $xmlMap->getEntryPoint($this->entryPointId);
}
if ($xmlEp) {
$xmlEp->addUrlAction('/', $module, 'default:index', null, null, array('default' => true));
$xmlEp->addUrlModule('', $module);
if ($this->verbose()) {
$output->writeln("The new module {$module} becomes the default module");
}
} else {
if ($this->verbose()) {
$output->writeln("No default entry point found: the new module cannot be the default module");
}
}
}
$xmlMap->save();
$iniDefault->setValue($module . '.access', $this->allEntryPoint ? 2 : 1, 'modules');
$iniDefault->save();
$list = $this->getEntryPointsList();
$install = new \Jelix\IniFile\IniModifier(App::configPath('installer.ini.php'));
// install the module for all needed entry points
foreach ($list as $entryPoint) {
$configFile = App::appConfigPath($entryPoint['config']);
$epconfig = new \Jelix\IniFile\IniModifier($configFile);
if ($this->allEntryPoint) {
$access = 2;
} else {
$access = $entryPoint['file'] == $this->entryPointName ? 2 : 0;
}
$epconfig->setValue($module . '.access', $access, 'modules');
//.........这里部分代码省略.........
示例8: updateModulePath
protected function updateModulePath($ini, $currentModulesPath, $repository, $repositoryPath)
{
$listRepos = preg_split('/ *, */', $currentModulesPath);
$repositoryFound = false;
foreach ($listRepos as $path) {
if (trim($path) == '') {
continue;
}
$p = jFile::parseJelixPath($path);
if (substr($p, -1) != '/') {
$p .= '/';
}
if ($p == $repositoryPath) {
$repositoryFound = true;
break;
}
}
// the repository doesn't exist in the configuration
// let's add it into the configuration
if (!$repositoryFound) {
$ini->setValue('modulesPath', $currentModulesPath . ',' . $repository);
$ini->save();
$this->createDir($repositoryPath);
}
}
示例9: check_sqlite3
protected function check_sqlite3($params)
{
$db = $params['database'];
if ($db[0] == '/') {
$path = $db;
} else {
if (preg_match('/^(app|lib|var)\\:/', $db)) {
$path = jFile::parseJelixPath($db);
} else {
$path = jApp::varPath('db/sqlite3/' . $db);
}
}
try {
$sqlite = new SQLite3($path, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
$sqlite->close();
} catch (Exception $e) {
throw new Exception($this->locales['error.no.connection']);
}
return true;
}
示例10: _loadPluginsPathList
/**
* Analyse plugin paths
* @param object $config the config container
*/
protected static function _loadPluginsPathList($config)
{
$list = preg_split('/ *, */', $config->pluginsPath);
array_unshift($list, JELIX_LIB_PATH . 'plugins/');
foreach ($list as $k => $path) {
if (trim($path) == '') {
continue;
}
if (preg_match('@^module:([^/]+)(/.*)?$@', $path, $m)) {
$mod = $m[1];
if (isset($config->_modulesPathList[$mod])) {
$p = $config->_modulesPathList[$mod];
if (isset($m[2]) && strlen($m[2]) > 1) {
$p .= $m[2];
} else {
$p .= '/plugins/';
}
} else {
trigger_error('Error in main configuration on pluginsPath -- Path given in pluginsPath for the module ' . $mod . ' is ignored, since this module is unknown or deactivated', E_USER_NOTICE);
continue;
}
} else {
$p = jFile::parseJelixPath($path);
}
if (!file_exists($p)) {
trigger_error('Error in main configuration on pluginsPath -- The path, ' . $path . ' given in the jelix config, doesn\'t exists !', E_USER_ERROR);
exit;
}
if (substr($p, -1) != '/') {
$p .= '/';
}
if ($handle = opendir($p)) {
while (false !== ($f = readdir($handle))) {
if ($f[0] != '.' && is_dir($p . $f)) {
if ($subdir = opendir($p . $f)) {
if ($k != 0 && $config->compilation['checkCacheFiletime']) {
$config->_allBasePath[] = $p . $f . '/';
}
while (false !== ($subf = readdir($subdir))) {
if ($subf[0] != '.' && is_dir($p . $f . '/' . $subf)) {
if ($f == 'tpl') {
$prop = '_tplpluginsPathList_' . $subf;
if (!isset($config->{$prop})) {
$config->{$prop} = array();
}
array_unshift($config->{$prop}, $p . $f . '/' . $subf . '/');
} else {
$prop = '_pluginsPathList_' . $f;
$config->{$prop}[$subf] = $p . $f . '/' . $subf . '/';
}
}
}
closedir($subdir);
}
}
}
closedir($handle);
}
}
}
示例11: checkAppPaths
function checkAppPaths()
{
$ok = true;
if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
throw new Exception($this->messages->get('path.core'));
}
if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
$this->error('path.temp');
$ok = false;
}
if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
$this->error('path.log');
$ok = false;
}
if (!file_exists(jApp::varPath())) {
$this->error('path.var');
$ok = false;
}
if (!file_exists(jApp::configPath())) {
$this->error('path.config');
$ok = false;
} elseif ($this->checkForInstallation) {
if (!is_writable(jApp::configPath())) {
$this->error('path.config.writable');
$ok = false;
}
if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
$this->error('path.profiles.writable');
$ok = false;
}
if (file_exists(jApp::mainConfigFile()) && !is_writable(jApp::mainConfigFile())) {
$this->error('path.mainconfig.writable');
$ok = false;
} elseif (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
$this->error('path.mainconfig.writable');
$ok = false;
}
if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
$this->error('path.installer.writable');
$ok = false;
}
}
if (!file_exists(jApp::wwwPath())) {
$this->error('path.www');
$ok = false;
}
foreach ($this->otherPaths as $path) {
$realPath = jFile::parseJelixPath($path);
if (!file_exists($realPath)) {
$this->error('path.custom.not.exists', array($path));
$ok = false;
} else {
if (!is_writable($realPath)) {
$this->error('path.custom.writable', array($path));
$ok = false;
} else {
$this->ok('path.custom.ok', array($path));
}
}
}
if ($ok) {
$this->ok('paths.ok');
} else {
throw new Exception($this->messages->get('too.critical.error'));
}
/*if(!isset($GLOBALS['config_file']) ||
empty($GLOBALS['config_file']) ||
!file_exists(jApp::configPath($GLOBALS['config_file']))){
throw new Exception($this->messages->get('config.file'));
}*/
return $ok;
}
示例12: run
public function run()
{
$this->loadAppConfig();
$entrypoint = $this->getParam('entrypoint');
if (($p = strpos($entrypoint, '.php')) !== false) {
$entrypoint = substr($entrypoint, 0, $p);
}
$ep = $this->getEntryPointInfo($entrypoint);
if ($ep == null) {
try {
$cmd = JelixScript::getCommand('createentrypoint', $this->config);
$cmd->initOptParam(array(), array('name' => $entrypoint));
$cmd->run();
$this->appInfos = null;
$ep = $this->getEntryPointInfo($entrypoint);
} catch (Exception $e) {
throw new Exception("The entrypoint has not been created because of this error: " . $e->getMessage() . ". No other files have been created.\n");
}
}
$installConfig = new \Jelix\IniFile\IniModifier(App::configPath('installer.ini.php'));
$inifile = new \Jelix\IniFile\MultiIniModifier(App::mainConfigFile(), App::configPath($ep['config']));
$params = array();
$this->createFile(App::appPath('responses/adminHtmlResponse.class.php'), 'responses/adminHtmlResponse.class.php.tpl', $params, "Response for admin interface");
$this->createFile(App::appPath('responses/adminLoginHtmlResponse.class.php'), 'responses/adminLoginHtmlResponse.class.php.tpl', $params, "Response for login page");
$inifile->setValue('html', 'adminHtmlResponse', 'responses');
$inifile->setValue('htmlauth', 'adminLoginHtmlResponse', 'responses');
$inifile->setValue('startModule', 'master_admin');
$inifile->setValue('startAction', 'default:index');
$repositoryPath = jFile::parseJelixPath('lib:jelix-admin-modules');
$this->registerModulesDir('lib:jelix-admin-modules', $repositoryPath);
$installConfig->setValue('jacl.installed', '0', $entrypoint);
$inifile->setValue('jacl.access', '0', 'modules');
$installConfig->setValue('jacldb.installed', '0', $entrypoint);
$inifile->setValue('jacldb.access', '0', 'modules');
$urlconf = $inifile->getValue($entrypoint, 'simple_urlengine_entrypoints', null, true);
if ($urlconf === null || $urlconf == '') {
// in defaultconfig
$inifile->setValue($entrypoint, 'jacl2db_admin~*@classic, jauthdb_admin~*@classic, master_admin~*@classic, jpref_admin~*@classic', 'simple_urlengine_entrypoints', null, true);
// in the config of the entry point
$inifile->setValue($entrypoint, 'jacl2db~*@classic, jauth~*@classic, jacl2db_admin~*@classic, jauthdb_admin~*@classic, master_admin~*@classic, jpref_admin~*@classic', 'simple_urlengine_entrypoints');
} else {
$urlconf2 = $inifile->getValue($entrypoint, 'simple_urlengine_entrypoints');
if (strpos($urlconf, 'jacl2db_admin~*@classic') === false) {
$urlconf .= ',jacl2db_admin~*@classic';
}
if (strpos($urlconf, 'jauthdb_admin~*@classic') === false) {
$urlconf .= ',jauthdb_admin~*@classic';
}
if (strpos($urlconf, 'master_admin~*@classic') === false) {
$urlconf .= ',master_admin~*@classic';
}
if (strpos($urlconf2, 'jacl2db_admin~*@classic') === false) {
$urlconf2 .= ',jacl2db_admin~*@classic';
}
if (strpos($urlconf2, 'jauthdb_admin~*@classic') === false) {
$urlconf2 .= ',jauthdb_admin~*@classic';
}
if (strpos($urlconf2, 'master_admin~*@classic') === false) {
$urlconf2 .= ',master_admin~*@classic';
}
if (strpos($urlconf2, 'jacl2db~*@classic') === false) {
$urlconf2 .= ',jacl2db~*@classic';
}
if (strpos($urlconf2, 'jauth~*@classic') === false) {
$urlconf2 .= ',jauth~*@classic';
}
if (strpos($urlconf2, 'jpref_admin~*@classic') === false) {
$urlconf2 .= ',jpref_admin~*@classic';
}
$inifile->setValue($entrypoint, $urlconf, 'simple_urlengine_entrypoints', null, true);
$inifile->setValue($entrypoint, $urlconf2, 'simple_urlengine_entrypoints');
}
if (null == $inifile->getValue($entrypoint, 'basic_significant_urlengine_entrypoints', null, true)) {
$inifile->setValue($entrypoint, '1', 'basic_significant_urlengine_entrypoints', null, true);
}
$inifile->save();
$verbose = $this->verbose();
$reporter = new \Jelix\Installer\Reporter\Console($verbose ? 'notice' : 'warning');
$installer = new \Jelix\Installer\Installer($reporter);
$installer->installModules(array('master_admin'), $entrypoint . '.php');
$authini = new \Jelix\IniFile\IniModifier(App::configPath($entrypoint . '/auth.coord.ini.php'));
$authini->setValue('after_login', 'master_admin~default:index');
$authini->setValue('timeout', '30');
$authini->save();
$profile = $this->getOption('-profile');
if (!$this->getOption('-noauthdb')) {
if ($profile != '') {
$authini->setValue('profile', $profile, 'Db');
}
$authini->save();
$installer->setModuleParameters('jauthdb', array('defaultuser' => true));
$installer->installModules(array('jauthdb', 'jauthdb_admin'), $entrypoint . '.php');
} else {
$installConfig->setValue('jauthdb_admin.installed', '0', $entrypoint);
$installConfig->save();
$inifile->setValue('jauthdb_admin.access', '0', 'modules');
$inifile->save();
}
if (!$this->getOption('-noacl2db')) {
if ($profile != '') {
//.........这里部分代码省略.........
示例13: _getClient
/**
* callback method for jprofiles. Internal use.
*/
public static function _getClient($profile)
{
$wsdl = null;
$client = 'SoapClient';
if (isset($profile['wsdl'])) {
$wsdl = $profile['wsdl'];
if ($wsdl == '') {
$wsdl = null;
} else {
if (!preg_match("!^https?\\://!", $wsdl)) {
$wsdl = jFile::parseJelixPath($wsdl);
}
}
unset($profile['wsdl']);
}
if (isset($profile['trace'])) {
$profile['trace'] = intval($profile['trace']);
// SoapClient recognize only true integer
if ($profile['trace']) {
$client = 'SoapClientDebug';
}
}
if (isset($profile['exceptions'])) {
$profile['exceptions'] = intval($profile['exceptions']);
// SoapClient recognize only true integer
}
if (isset($profile['connection_timeout'])) {
$profile['connection_timeout'] = intval($profile['connection_timeout']);
// SoapClient recognize only true integer
}
// deal with classmap
$classMap = array();
if (isset($profile['classmap_file']) && ($f = trim($profile['classmap_file'])) != '') {
if (!isset(self::$classmap[$f])) {
if (!file_exists(jApp::configPath($f))) {
trigger_error("jSoapClient: classmap file " . $f . " does not exists.", E_USER_WARNING);
self::$classmap[$f] = array();
} else {
self::$classmap[$f] = parse_ini_file(jApp::configPath($f), true);
}
}
if (isset(self::$classmap[$f]['__common__'])) {
$classMap = array_merge($classMap, self::$classmap[$f]['__common__']);
}
if (isset(self::$classmap[$f][$profile['_name']])) {
$classMap = array_merge($classMap, self::$classmap[$f][$profile['_name']]);
}
unset($profile['classmap_file']);
}
if (isset($profile['classmap']) && is_string($profile['classmap']) && $profile['classmap'] != '') {
$map = (array) json_decode(str_replace("'", '"', $profile['classmap']));
$classMap = array_merge($classMap, $map);
unset($profile['classmap']);
}
if (count($classMap)) {
$profile['classmap'] = $classMap;
}
//$context = stream_context_create( array('http' => array('max_redirects' => 3)));
//$profile['stream_context'] = $context;
unset($profile['_name']);
return new $client($wsdl, $profile);
}
示例14: __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'] != '') {
$cache_dir = jFile::parseJelixPath($params['cache_dir']);
if (is_dir($cache_dir) && is_writable($cache_dir)) {
$this->_cache_dir = rtrim(realpath($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']);
} else {
$this->_directory_umask = jApp::config()->chmodDir;
}
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']);
} else {
$this->_cache_file_umask = jApp::config()->chmodFile;
}
}
示例15: _connect
protected function _connect()
{
if (isset($this->_profile['file']) && $this->_profile['file'] != '') {
$this->_file = jFile::parseJelixPath($this->_profile['file']);
} else {
throw new Exception('No file in the configuration of the dba driver for jKVDB');
}
$mode = "cl";
if (isset($this->_profile['handler']) && $this->_profile['handler'] != '') {
$handler = $this->_profile['handler'];
} else {
throw new Exception('No handler in the configuration of the dba driver for jKVDB');
}
if (isset($this->_profile['persistant']) && $this->_profile['persistant']) {
$conn = dba_popen($this->_file, $mode, $handler);
} else {
$conn = dba_open($this->_file, $mode, $handler);
}
if ($conn === false) {
return null;
}
return $conn;
}