本文整理汇总了PHP中FileHandler::makedir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::makedir方法的具体用法?PHP FileHandler::makedir怎么用?PHP FileHandler::makedir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::makedir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPoint
/**
* @brief 포인트 설정
**/
function setPoint($member_srl, $point, $mode = null)
{
$member_srl = abs($member_srl);
$mode_arr = array('add', 'minus', 'update', 'signup');
if (!$mode || !in_array($mode, $mode_arr)) {
$mode = 'update';
}
// 설정 정보 가져오기
$oMemberModel =& getModel('member');
$oModuleModel =& getModel('module');
$oPointModel =& getModel('point');
$config = $oModuleModel->getModuleConfig('point');
// 기존 포인트 정보를 구함
$prev_point = $oPointModel->getPoint($member_srl, true);
$prev_level = $oPointModel->getLevel($prev_point, $config->level_step);
// 포인트 변경
$args->member_srl = $member_srl;
$args->point = $prev_point;
switch ($mode) {
case 'add':
$args->point += $point;
break;
case 'minus':
$args->point -= $point;
break;
case 'update':
$args->point = $point;
break;
case 'signup':
$args->point = $point;
break;
}
if ($args->point < 0) {
$args->point = 0;
}
$point = $args->point;
// 포인트가 있으면 update, 없으면 insert
$oPointModel =& getModel('point');
if ($oPointModel->isExistsPoint($member_srl)) {
executeQuery("point.updatePoint", $args);
} else {
executeQuery("point.insertPoint", $args);
}
// 새로운 레벨을 구함
$level = $oPointModel->getLevel($point, $config->level_step);
// 기존 레벨과 새로운 레벨이 다르면 포인트 그룹 설정 시도
if ($level != $prev_level) {
// 현재 포인트 대비하여 레벨을 계산하고 레벨에 맞는 그룹 설정을 체크
$point_group = $config->point_group;
// 포인트 그룹 정보가 있을때 시행
if ($point_group && is_array($point_group) && count($point_group)) {
// 기본 그룹을 구함
$default_group = $oMemberModel->getDefaultGroup();
// 제거될 그룹과 새로 부여 받을 그룹을 구함
$del_group_list = array();
$new_group_srls = array();
asort($point_group);
// 포인트 그룹 설정을 돌면서 현재 레벨까지 체크
foreach ($point_group as $group_srl => $target_level) {
if ($config->group_reset != 'N') {
$del_group_list[] = $group_srl;
}
if ($target_level <= $level) {
$new_group_srls[] = $group_srl;
}
}
// 만약 새로운 그룹이 없다면 기본 그룹을 부여 받음
if (!$new_group_srls[0]) {
$new_group_srls[0] = $default_group->group_srl;
}
// 연동 그룹 제거
if ($config->group_reset != 'N' && $del_group_list && count($del_group_list)) {
$del_group_args->member_srl = $member_srl;
$del_group_args->group_srl = implode(',', $del_group_list);
$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
}
// 새로운 그룹을 부여
foreach ($new_group_srls as $group_srl) {
$new_group_args->member_srl = $member_srl;
$new_group_args->group_srl = $group_srl;
executeQuery('member.addMemberToGroup', $new_group_args);
}
}
}
// 캐시 설정
$cache_path = sprintf('./files/member_extra_info/point/%s/', getNumberingPath($member_srl));
FileHandler::makedir($cache_path);
$cache_filename = sprintf('%s%d.cache.txt', $cache_path, $member_srl);
FileHandler::writeFile($cache_filename, $point);
return $output;
}
示例2: setPoint
//.........这里部分代码省略.........
// Check if the level, for which the current points are prepared, is calculate and set the correct group
$point_group = $config->point_group;
// If the point group exists
if ($point_group && is_array($point_group) && count($point_group)) {
// Get the default group
$default_group = $oMemberModel->getDefaultGroup();
// Get the removed group and the newly granted group
$del_group_list = array();
$new_group_list = array();
asort($point_group);
// Reset group after initialization
if ($config->group_reset != 'N') {
// If the new level is in the right group
if (in_array($level, $point_group)) {
// Delete all groups except the one which the current level belongs to
foreach ($point_group as $group_srl => $target_level) {
$del_group_list[] = $group_srl;
if ($target_level == $level) {
$new_group_list[] = $group_srl;
}
}
} else {
$i = $level;
while ($i > 0) {
if (in_array($i, $point_group)) {
foreach ($point_group as $group_srl => $target_level) {
if ($target_level == $i) {
$new_group_list[] = $group_srl;
}
}
$i = 0;
}
$i--;
}
}
// Delete the group of a level which is higher than the current level
foreach ($point_group as $group_srl => $target_level) {
if ($target_level > $level) {
$del_group_list[] = $group_srl;
}
}
$del_group_list[] = $default_group->group_srl;
} else {
// Check until the current level by rotating setting the configurations of the point groups
foreach ($point_group as $group_srl => $target_level) {
$del_group_list[] = $group_srl;
if ($target_level <= $level) {
$new_group_list[] = $group_srl;
}
}
}
// If there is no a new group, granted the default group
if (!$new_group_list[0]) {
$new_group_list[0] = $default_group->group_srl;
}
// Remove linkage group
if ($del_group_list && count($del_group_list)) {
$del_group_args = new stdClass();
$del_group_args->member_srl = $member_srl;
$del_group_args->group_srl = implode(',', $del_group_list);
$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
}
// Grant a new group
foreach ($new_group_list as $group_srl) {
$new_group_args = new stdClass();
$new_group_args->member_srl = $member_srl;
$new_group_args->group_srl = $group_srl;
executeQuery('member.addMemberToGroup', $new_group_args);
}
}
}
// Call a trigger (after)
$trigger_obj->new_group_list = $new_group_list;
$trigger_obj->del_group_list = $del_group_list;
$trigger_obj->new_level = $level;
$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj);
if (!$trigger_output->toBool()) {
$oDB->rollback();
return $trigger_output;
}
$oDB->commit();
// Cache Settings
$cache_path = sprintf('./files/member_extra_info/point/%s/', getNumberingPath($member_srl));
FileHandler::makedir($cache_path);
$cache_filename = sprintf('%s%d.cache.txt', $cache_path, $member_srl);
FileHandler::writeFile($cache_filename, $point);
$oCacheHandler = CacheHandler::getInstance('object', null, true);
if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) {
$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
$oCacheHandler->delete($cache_key);
}
$oCacheHandler = CacheHandler::getInstance('object');
if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) {
$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
$oCacheHandler->delete($cache_key);
}
return $output;
}