本文整理汇总了PHP中FileHandler::readDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::readDir方法的具体用法?PHP FileHandler::readDir怎么用?PHP FileHandler::readDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::readDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteMenu
function deleteMenu($menu_srl)
{
// 캐시 파일 삭제
$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
if (count($cache_list)) {
foreach ($cache_list as $cache_file) {
$pos = strpos($cache_file, $menu_srl . '_');
if ($pos > 0) {
FileHandler::removeFile($cache_file);
}
}
}
// 이미지 버튼 모두 삭제
$image_path = sprintf('./files/attach/menu_button/%s', $menu_srl);
FileHandler::removeDir($image_path);
$args->menu_srl = $menu_srl;
// 메뉴 메뉴 삭제
$output = executeQuery("menu.deleteMenuItems", $args);
if (!$output->toBool()) {
return $output;
}
// 메뉴 삭제
$output = executeQuery("menu.deleteMenu", $args);
if (!$output->toBool()) {
return $output;
}
return new Object(0, 'success_deleted');
}
示例2: _getSupportedList
/**
* @brief 지원 가능한 DB 목록을 return
**/
function _getSupportedList()
{
$db_classes_path = _XE_PATH_ . "classes/db/";
$filter = "/^DB([^\\.]+)\\.class\\.php/i";
$supported_list = FileHandler::readDir($db_classes_path, $filter, true);
sort($supported_list);
// 구해진 클래스의 객체 생성후 isSupported method를 통해 지원 여부를 판단
for ($i = 0; $i < count($supported_list); $i++) {
$db_type = $supported_list[$i];
if (version_compare(phpversion(), '5.0') < 0 && preg_match('/pdo/i', $db_type)) {
continue;
}
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
$class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name);
if (!file_exists($class_file)) {
continue;
}
unset($oDB);
require_once $class_file;
$eval_str = sprintf('$oDB = new %s();', $class_name);
eval($eval_str);
if (!$oDB) {
continue;
}
$obj = null;
$obj->db_type = $db_type;
$obj->enable = $oDB->isSupported() ? true : false;
$this->supported_list[] = $obj;
}
return $this->supported_list;
}
示例3: moduleUpdate
/**
* @brief 업데이트 실행
**/
function moduleUpdate()
{
$oDB =& DB::getInstance();
// 2009. 02. 11 menu 테이블에 site_srl 추가
if (!$oDB->isColumnExists('layouts', 'site_srl')) {
$oDB->addColumn('layouts', 'site_srl', 'number', 11, 0, true);
}
// 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
$oLayoutModel =& getModel('layout');
$files = FileHandler::readDir('./files/cache/layout');
for ($i = 0, $c = count($files); $i < $c; $i++) {
$filename = $files[$i];
if (!preg_match('/([0-9]+)\\.html/i', $filename, $match)) {
continue;
}
$layout_srl = $match[1];
if (!$layout_srl) {
continue;
}
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
if (!is_dir($path)) {
FileHandler::makeDir($path);
}
FileHandler::copyFile('./files/cache/layout/' . $filename, $path . 'layout.html');
@unlink('./files/cache/layout/' . $filename);
}
return new Object(0, 'success_updated');
}
示例4: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
// remove module extend cache
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/config/module_extend.php');
// remove debug files
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_message.php');
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_db_query.php');
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_db_slow_query.php');
$oModuleModel = getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = NULL;
$oModule = getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove object cache
if (!in_array(Rhymix\Framework\Cache::getDriverName(), array('file', 'sqlite', 'dummy'))) {
Rhymix\Framework\Cache::clearAll();
}
// remove old cache dir
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if (strval($tmp_dir) !== '') {
$tmp_dir = \RX_BASEDIR . 'files/' . strval($tmp_dir);
if (!Rhymix\Framework\Storage::isDirectory($tmp_dir)) {
continue;
}
// If possible, use system command to speed up recursive deletion
if (function_exists('exec') && !preg_match('/(?<!_)exec/', ini_get('disable_functions'))) {
if (strncasecmp(\PHP_OS, 'win', 3) == 0) {
@exec('rmdir /S /Q ' . escapeshellarg($tmp_dir));
} else {
@exec('rm -rf ' . escapeshellarg($tmp_dir));
}
}
// If the directory still exists, delete using PHP.
Rhymix\Framework\Storage::deleteDirectory($tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type = Context::getDBType();
if ($db_type == 'cubrid') {
$db = DB::getInstance();
$db->deleteDuplicateIndexes();
}
// check autoinstall packages
$oAutoinstallAdminController = getAdminController('autoinstall');
$oAutoinstallAdminController->checkInstalled();
$this->setMessage('success_updated');
}
示例5: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove module extend cache
FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
// remove debug files
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
$oModuleModel = getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = NULL;
$oModule = getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove cache
$truncated = array();
$oObjectCacheHandler = CacheHandler::getInstance('object');
$oTemplateCacheHandler = CacheHandler::getInstance('template');
if ($oObjectCacheHandler->isSupport()) {
$truncated[] = $oObjectCacheHandler->truncate();
}
if ($oTemplateCacheHandler->isSupport()) {
$truncated[] = $oTemplateCacheHandler->truncate();
}
if (count($truncated) && in_array(FALSE, $truncated)) {
return new Object(-1, 'msg_self_restart_cache_engine');
}
// remove cache dir
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if ($tmp_dir) {
FileHandler::removeDir('./files/' . $tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type = Context::getDBType();
if ($db_type == 'cubrid') {
$db = DB::getInstance();
$db->deleteDuplicateIndexes();
}
// check autoinstall packages
$oAutoinstallAdminController = getAdminController('autoinstall');
$oAutoinstallAdminController->checkInstalled();
$this->setMessage('success_updated');
}
示例6: getAddonList
/**
* Returns addon list
*
* @param int $site_srl Site srl
* @param string $gtype site or global
* @return array Returns addon list
*/
function getAddonList($site_srl = 0, $gtype = 'site')
{
// Wanted to add a list of activated
$inserted_addons = $this->getInsertedAddons($site_srl, $gtype);
// Downloaded and installed add-on to the list of Wanted
$searched_list = FileHandler::readDir('./addons', '/^([a-zA-Z0-9-_]+)$/');
$searched_count = count($searched_list);
if (!$searched_count) {
return;
}
sort($searched_list);
$oAddonAdminController = getAdminController('addon');
for ($i = 0; $i < $searched_count; $i++) {
// Add the name of
$addon_name = $searched_list[$i];
if ($addon_name == "smartphone") {
continue;
}
// Add the path (files/addons precedence)
$path = $this->getAddonPath($addon_name);
// Wanted information on the add-on
$info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype);
if (!$info) {
$info = new stdClass();
}
$info->addon = $addon_name;
$info->path = $path;
$info->activated = FALSE;
$info->mactivated = FALSE;
$info->fixed = FALSE;
// Check if a permossion is granted entered in DB
if (!in_array($addon_name, array_keys($inserted_addons))) {
// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
$oAddonAdminController->doInsert($addon_name, $site_srl, $type, 'N', new stdClass());
// Is activated
} else {
if ($inserted_addons[$addon_name]->is_used == 'Y') {
$info->activated = TRUE;
}
if ($inserted_addons[$addon_name]->is_used_m == 'Y') {
$info->mactivated = TRUE;
}
if ($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y') {
$info->fixed = TRUE;
}
}
$list[] = $info;
}
return $list;
}
示例7: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
$temp_cache_dir = './files/cache_' . time();
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove debug files
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
$oModuleModel =& getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = null;
$oModule =& getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove cache
$truncated = array();
$oObjectCacheHandler =& CacheHandler::getInstance('object');
$oTemplateCacheHandler =& CacheHandler::getInstance('template');
if ($oObjectCacheHandler->isSupport()) {
$truncated[] = $oObjectCacheHandler->truncate();
}
if ($oTemplateCacheHandler->isSupport()) {
$truncated[] = $oTemplateCacheHandler->truncate();
}
if (count($truncated) && in_array(false, $truncated)) {
return new Object(-1, 'msg_self_restart_cache_engine');
}
// remove cache dir
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if ($tmp_dir) {
FileHandler::removeDir('./files/' . $tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type =& Context::getDBType();
if ($db_type == 'cubrid') {
$db =& DB::getInstance();
$db->deleteDuplicateIndexes();
}
$this->setMessage('success_updated');
}
示例8: moduleUpdate
/**
* Execute update
* @return Object
*/
function moduleUpdate()
{
$oDB =& DB::getInstance();
// 2009. 02. 11 Add site_srl to menu table
if (!$oDB->isColumnExists('layouts', 'site_srl')) {
$oDB->addColumn('layouts', 'site_srl', 'number', 11, 0, true);
}
// 2009. 02. 26 Move the previous layout for faceoff
$oLayoutModel = getModel('layout');
$files = FileHandler::readDir('./files/cache/layout');
for ($i = 0, $c = count($files); $i < $c; $i++) {
$filename = $files[$i];
if (!preg_match('/([0-9]+)\\.html/i', $filename, $match)) {
continue;
}
$layout_srl = $match[1];
if (!$layout_srl) {
continue;
}
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
if (!is_dir($path)) {
FileHandler::makeDir($path);
}
FileHandler::copyFile('./files/cache/layout/' . $filename, $path . 'layout.html');
@unlink('./files/cache/layout/' . $filename);
}
if (!$oDB->isColumnExists('layouts', 'layout_type')) {
$oDB->addColumn('layouts', 'layout_type', 'char', 1, 'P', true);
}
$args = new stdClass();
$args->layout = '.';
$output = executeQueryArray('layout.getLayoutDotList', $args);
if ($output->data && count($output->data) > 0) {
foreach ($output->data as $layout) {
$layout_path = explode('.', $layout->layout);
if (count($layout_path) != 2) {
continue;
}
if (is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) {
$args->layout = implode('|@|', $layout_path);
$args->layout_srl = $layout->layout_srl;
$output = executeQuery('layout.updateLayout', $args);
Rhymix\Framework\Cache::delete('layout:' . $args->layout_srl);
}
}
}
return new Object(0, 'success_updated');
}
示例9: getTableInfo
/**
* Returns table information
*
* Used for finding column type info (string/numeric) <br />
* Obtains the table info from XE's XML schema files
*
* @param object $query_id
* @param bool $table_name
* @return array
*/
function getTableInfo($query_id, $table_name)
{
$column_type = array();
$module = '';
$id_args = explode('.', $query_id);
if (count($id_args) == 2) {
$target = 'modules';
$module = $id_args[0];
$id = $id_args[1];
} else {
if (count($id_args) == 3) {
$target = $id_args[0];
$targetList = array('modules' => 1, 'addons' => 1, 'widgets' => 1);
if (!isset($targetList[$target])) {
return;
}
$module = $id_args[1];
$id = $id_args[2];
}
}
// get column properties from the table
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
if (!file_exists($table_file)) {
$searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
$searched_count = count($searched_list);
for ($i = 0; $i < $searched_count; $i++) {
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
if (file_exists($table_file)) {
break;
}
}
}
if (file_exists($table_file)) {
$table_xml = FileHandler::readFile($table_file);
$xml_parser = new XmlParser();
$table_obj = $xml_parser->parse($table_xml);
if ($table_obj->table) {
if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
$table_obj->table->column = array($table_obj->table->column);
}
foreach ($table_obj->table->column as $k => $v) {
$column_type[$v->attrs->name] = $v->attrs->type;
}
}
}
return $column_type;
}
示例10: getDownloadedWidgetStyleList
/**
* @brief 위젯의 종류와 정보를 구함
* 다운로드되어 있는 위젯의 종류 (생성과 다른 의미)
**/
function getDownloadedWidgetStyleList()
{
// 다운받은 위젯과 설치된 위젯의 목록을 구함
$searched_list = FileHandler::readDir('./widgetstyles');
$searched_count = count($searched_list);
if (!$searched_count) {
return;
}
sort($searched_list);
// 찾아진 위젯 목록을 loop돌면서 필요한 정보를 간추려 return
for ($i = 0; $i < $searched_count; $i++) {
// 위젯의 이름
$widgetStyle = $searched_list[$i];
// 해당 위젯의 정보를 구함
$widgetStyle_info = $this->getWidgetStyleInfo($widgetStyle);
$list[] = $widgetStyle_info;
}
return $list;
}
示例11: dispPointAdminConfig
/**
* @brief 기본 설정
**/
function dispPointAdminConfig()
{
// 레벨 아이콘 목록 구함
$level_icon_list = FileHandler::readDir("./modules/point/icons");
Context::set('level_icon_list', $level_icon_list);
// 그룹 목록 가져오기
$oMemberModel =& getModel('member');
$group_list = $oMemberModel->getGroups();
$selected_group_list = array();
if (count($group_list)) {
foreach ($group_list as $key => $val) {
if ($val->is_admin == 'Y' || $val->is_default == 'Y') {
continue;
}
$selected_group_list[$key] = $val;
}
}
Context::set('group_list', $selected_group_list);
// 템플릿 지정
$this->setTemplateFile('config');
}
示例12: dispPointAdminConfig
/**
* @brief Default configurations
*/
function dispPointAdminConfig()
{
// Get the list of level icons
$level_icon_list = FileHandler::readDir("./modules/point/icons");
Context::set('level_icon_list', $level_icon_list);
// Get the list of groups
$oMemberModel = getModel('member');
$group_list = $oMemberModel->getGroups();
$selected_group_list = array();
if (count($group_list)) {
foreach ($group_list as $key => $val) {
$selected_group_list[$key] = $val;
}
}
Context::set('group_list', $selected_group_list);
//Security
$security = new Security();
$security->encodeHTML('group_list..title', 'group_list..description');
// Set the template
$this->setTemplateFile('config');
}
示例13: getPopupContent
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Bringing a list of emoticons directory
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
$emoticon_list = array();
if ($emoticon_dirs) {
foreach ($emoticon_dirs as $emoticon) {
if (preg_match("/^([a-z0-9\\_]+)\$/i", $emoticon)) {
$emoticon_list[] = $emoticon;
}
}
}
Context::set('emoticon_list', $emoticon_list);
// The first emoticon image files in the directory Wanted
$emoticons = $this->getEmoticons($emoticon_list[0]);
Context::set('emoticons', $emoticons);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path . 'tpl';
$tpl_file = 'popup.html';
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例14: getPopupContent
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
**/
function getPopupContent()
{
// 이모티콘 디렉토리 목록을 가져옴
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
$emoticon_list = array();
if ($emoticon_dirs) {
foreach ($emoticon_dirs as $emoticon) {
if (preg_match("/^([a-z0-9\\_]+)\$/i", $emoticon)) {
$emoticon_list[] = $emoticon;
}
}
}
Context::set('emoticon_list', $emoticon_list);
// 첫번째 이모티콘 디렉토리의 이미지 파일을 구함
$emoticons = $this->getEmoticons($emoticon_list[0]);
Context::set('emoticons', $emoticons);
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->component_path . 'tpl';
$tpl_file = 'popup.html';
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例15: getAddonList
/**
* @brief 애드온의 종류와 정보를 구함
**/
function getAddonList($site_srl = 0)
{
// activated된 애드온 목록을 구함
$inserted_addons = $this->getInsertedAddons($site_srl);
// 다운받은 애드온과 설치된 애드온의 목록을 구함
$searched_list = FileHandler::readDir('./addons');
$searched_count = count($searched_list);
if (!$searched_count) {
return;
}
sort($searched_list);
for ($i = 0; $i < $searched_count; $i++) {
// 애드온의 이름
$addon_name = $searched_list[$i];
// 애드온의 경로 (files/addons가 우선)
$path = $this->getAddonPath($addon_name);
// 해당 애드온의 정보를 구함
unset($info);
$info = $this->getAddonInfoXml($addon_name, $site_srl);
$info->addon = $addon_name;
$info->path = $path;
$info->activated = false;
// DB에 입력되어 있는지 확인
if (!in_array($addon_name, array_keys($inserted_addons))) {
// DB에 입력되어 있지 않으면 입력 (model에서 이런짓 하는거 싫지만 귀찮아서.. ㅡ.ㅜ)
$oAddonAdminController =& getAdminController('addon');
$oAddonAdminController->doInsert($addon_name, $site_srl);
// 활성화 되어 있는지 확인
} else {
if ($inserted_addons[$addon_name]->is_used == 'Y') {
$info->activated = true;
}
}
$list[] = $info;
}
return $list;
}