本文整理汇总了PHP中FileHandler::removeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::removeFile方法的具体用法?PHP FileHandler::removeFile怎么用?PHP FileHandler::removeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::removeFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController = getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
$page_content = $this->module_info->content;
}
return $page_content;
}
示例2: checkUpdate
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate()
{
if (file_exists($this->cache_file)) {
FileHandler::removeFile($this->cache_file);
}
return false;
}
示例3: deleteModuleFiles
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl)
{
// 전체 첨부파일 목록을 구함
$args->module_srl = $module_srl;
$output = executeQueryArray('file.getModuleFiles', $args);
if (!$output) {
return $output;
}
$files = $output->data;
// DB에서 삭제
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if (!$output->toBool()) {
return $output;
}
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
// DB에서 구한 파일 목록을 삭제
$path = array();
$cnt = count($files);
for ($i = 0; $i < $cnt; $i++) {
$uploaded_filename = $files[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// 해당 글의 첨부파일 디렉토리 삭제
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}
示例4: procAuthenticationAdminConfig
function procAuthenticationAdminConfig()
{
$args = Context::getRequestVars();
if (!trim(strip_tags($args->agreement))) {
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
FileHandler::removeFile($agreement_file);
$args->agreement = NULL;
}
// check agreement value exist
if ($args->agreement) {
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
$output = FileHandler::writeFile($agreement_file, $args->agreement);
unset($args->agreement);
}
if (!$args->sender_no) {
$args->sender_no = NULL;
}
if (!$args->message_content) {
$args->message_content = NULL;
}
if (!$args->list) {
$args->list = NULL;
}
if (!$args->cellphone_fieldname) {
$args->cellphone_fieldname = NULL;
}
// save module configuration.
$oModuleController = getController('module');
$output = $oModuleController->updateModuleConfig('authentication', $args);
$this->setMessage('success_saved');
$redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAuthenticationAdminConfig');
$this->setRedirectUrl($redirectUrl);
}
示例5: testFileMethods
public function testFileMethods()
{
$mock = dirname(__FILE__) . '/mock.txt';
$mock2 = dirname(__FILE__) . '/mock2.txt';
touch($mock);
// copy file
$this->assertTrue(is_readable($mock));
FileHandler::copyFile($mock, $mock2);
$this->assertTrue(is_readable($mock2));
// remove file
$this->assertTrue(FileHandler::removeFile($mock2));
$this->assertFalse(is_readable($mock2));
$this->assertFalse(FileHandler::removeFile($mock2));
// rename file
$this->assertTrue(FileHandler::rename($mock, $mock2));
$this->assertFalse(is_readable($mock));
$this->assertTrue(is_readable($mock2));
$this->assertFalse(FileHandler::rename($mock, $mock2));
// move file
$this->assertTrue(FileHandler::rename($mock2, $mock));
$this->assertTrue(is_readable($mock));
$this->assertFalse(is_readable($mock2));
$this->assertTrue(touch($mock2) && is_readable($mock2));
$this->assertTrue(FileHandler::moveFile($mock, $mock2));
$this->assertFalse(is_readable($mock));
$this->assertTrue(is_readable($mock2));
// remove file
$this->assertFalse(FileHandler::removeFile($mock));
$this->assertTrue(FileHandler::removeFile($mock2));
$this->assertFalse(is_readable($mock));
$this->assertFalse(is_readable($mock2));
}
示例6: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches);
$page_content = '';
for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
$page_content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n";
}
}
return $page_content;
}
示例7: procDoNotify
function procDoNotify()
{
$oController =& getController('module');
$output = $oController->lock('commentnotify', 400);
if (!$output->toBool()) {
return;
}
$deadline = $output->get('deadline');
if (file_exists($this->cachedir . $this->cachefile)) {
FileHandler::removeFile($this->cachedir . $this->cachefile);
}
$oModel =& getModel('tccommentnotify');
$output = $oModel->GetCommentsFromNotifyQueue();
if (!$output->toBool()) {
debugPrint("Error");
debugPrint($output);
}
if ($output->data) {
foreach ($output->data as $data) {
$this->deleteFromQueue($data->comment_srl);
$this->sendCommentNotify($data->comment_srl);
}
}
$oController->unlock('commentnotify', $deadline);
}
示例8: dispPageIndex
/**
* @brief 일반 요청시 출력
**/
function dispPageIndex()
{
// 템플릿에서 사용할 변수를 Context::set()
if ($this->module_srl) {
Context::set('module_srl', $this->module_srl);
}
// 캐시 파일 지정
$cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file)) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->content;
}
Context::set('module_info', $this->module_info);
Context::set('page_content', $page_content);
$this->setTemplateFile('content');
}
示例9: procRssAdminInsertConfig
/**
* @brief RSS 전체피드 설정
**/
function procRssAdminInsertConfig()
{
$oModuleModel =& getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
$config_vars = Context::getRequestVars();
$config_vars->feed_document_count = (int) $config_vars->feed_document_count;
if (!$config_vars->use_total_feed) {
$alt_message = 'msg_invalid_request';
}
if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) {
$config_vars->open_rss = 'Y';
}
if ($config_vars->image || $config_vars->del_image) {
$image_obj = $config_vars->image;
$config_vars->image = $total_config->image;
// 삭제 요청에 대한 변수를 구함
if ($config_vars->del_image == 'Y' || $image_obj) {
FileHandler::removeFile($config_vars->image);
$config_vars->image = '';
$total_config->image = '';
}
// 정상적으로 업로드된 파일이 아니면 무시
if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) {
// 이미지 파일이 아니어도 무시 (swf는 패스~)
$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
if (!preg_match("/\\.(jpg|jpeg|gif|png)\$/i", $image_obj['name'])) {
$alt_message = 'msg_rss_invalid_image_format';
} else {
// 경로를 정해서 업로드
$path = './files/attach/images/rss/';
// 디렉토리 생성
if (!FileHandler::makeDir($path)) {
$alt_message = 'msg_error_occured';
} else {
$filename = $path . $image_obj['name'];
// 파일 이동
if (!move_uploaded_file($image_obj['tmp_name'], $filename)) {
$alt_message = 'msg_error_occured';
} else {
$config_vars->image = $filename;
}
}
}
}
}
if (!$config_vars->image && $config_vars->del_image != 'Y') {
$config_vars->image = $total_config->image;
}
$output = $this->setFeedConfig($config_vars);
if (!$alt_message) {
$alt_message = 'success_updated';
}
$alt_message = Context::getLang($alt_message);
Context::set('msg', $alt_message);
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('default_layout.html');
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile("top_refresh.html");
}
示例10: getThumbnailByUrl
function getThumbnailByUrl($image_url, $width = 80, $height = 0, $thumbnail_type = '')
{
if (!$height) {
$height = $width;
}
if (!in_array($thumbnail_type, array('crop', 'ratio'))) {
$config = $GLOBALS['__document_config__'];
if (!$config) {
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
$GLOBALS['__document_config__'] = $config;
}
$thumbnail_type = $config->thumbnail_type;
}
if (!is_dir('./files/thumbnails/magiccontent_thumbnail')) {
FileHandler::makeDir('./files/thumbnails/magiccontent_thumbnail');
}
$thumbnail_path = sprintf('files/thumbnails/magiccontent_thumbnail/%s', base64_encode($image_url));
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
if (file_exists($thumbnail_file)) {
if (filesize($thumbnail_file) < 1) {
return false;
} else {
return $thumbnail_url;
}
}
$tmp_file = sprintf('./files/cache/tmp/%s', md5(rand(111111, 999999) . $image_url));
if (!is_dir('./files/cache/tmp')) {
FileHandler::makeDir('./files/cache/tmp');
}
if (!preg_match('/^(http|https):\\/\\//i', $image_url)) {
$image_url = Context::getRequestUri() . $image_url;
}
FileHandler::getRemoteFile($image_url, $tmp_file);
if (!file_exists($tmp_file)) {
return false;
} else {
list($_w, $_h, $_t, $_a) = @getimagesize($tmp_file);
if (!in_array($_t, array(1, 2, 3, 6, 7, 8))) {
FileHandler::writeFile($thumbnail_file, '', 'w');
return false;
}
$source_file = $tmp_file;
}
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
FileHandler::removeFile($source_file);
if ($output) {
return $thumbnail_url;
} else {
FileHandler::writeFile($thumbnail_file, '', 'w');
}
return false;
}
示例11: recompileCache
/**
* @brief 캐시 파일 재생성
**/
function recompileCache()
{
// 레이아웃 캐시 삭제 (수정본은 지우지 않음)
$path = './files/cache/layout';
if (!is_dir($path)) {
FileHandler::makeDir($path);
return;
}
$directory = dir($path);
while ($entry = $directory->read()) {
if ($entry == "." || $entry == ".." || preg_match('/\\.html$/i', $entry)) {
continue;
}
FileHandler::removeFile($path . "/" . $entry);
}
$directory->close();
}
示例12: procAdminRecompileCacheFile
/**
* @brief 모든 캐시 파일 재생성
**/
function procAdminRecompileCacheFile()
{
$oModuleModel =& getModel('module');
$module_list = $oModuleModel->getModuleList();
// 개발 디버그 파일들 제거
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');
// 각 모듈마다 돌면서 캐시 파일 제거
foreach ($module_list as $module) {
$oModule = null;
$oModule =& getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
$this->setMessage('success_updated');
}
示例13: recompileCache
/**
* @brief 캐시 파일 재생성
**/
function recompileCache()
{
// 템플릿 컴파일 파일 삭제
FileHandler::removeFilesInDir("./files/cache/template_compiled");
// optimized 파일 삭제
FileHandler::removeFilesInDir("./files/cache/optimized");
// js_filter_compiled 파일 삭제
FileHandler::removeFilesInDir("./files/cache/js_filter_compiled");
// queries 파일 삭제
FileHandler::removeFilesInDir("./files/cache/queries");
// ./files/cache/news* 파일 삭제
$directory = dir(_XE_PATH_ . "files/cache/");
while ($entry = $directory->read()) {
if (substr($entry, 0, 11) == 'newest_news') {
FileHandler::removeFile("./files/cache/" . $entry);
}
}
$directory->close();
}
示例14: dispCommunicationNewMessage
/**
* @brief 새 쪽지 보여줌
**/
function dispCommunicationNewMessage()
{
$this->setLayoutFile('popup_layout');
// 로그인이 되어 있지 않으면 오류 표시
if (!Context::get('is_logged')) {
return $this->stop('msg_not_logged');
}
$logged_info = Context::get('logged_info');
$oCommunicationModel =& getModel('communication');
// 새 쪽지를 가져옴
$message = $oCommunicationModel->getNewMessage();
if ($message) {
Context::set('message', $message);
}
// 플래그 삭제
$flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
FileHandler::removeFile($flag_file);
$this->setTemplateFile('new_message');
}
示例15: procMagiccontentSetup
function procMagiccontentSetup()
{
$req = Context::getRequestVars();
$widget_sequence = $req->widget_sequence;
$is_complete = $req->is_complete;
unset($req->is_complete);
unset($req->widget_sequence);
unset($req->act);
foreach ($req as $key => $value) {
if ($value == '') {
unset($req->{$key});
}
}
$serialize_data = serialize($req);
$args = new stdClass();
$args->data = $serialize_data;
$args->widget_sequence = $widget_sequence;
$args->is_complete = $is_complete;
if ($is_complete == 1) {
$dargs = new stdClass();
$dargs->widget_sequence = $widget_sequence;
$dargs->is_complete = 0;
$output = executeQuery('magiccontent.deleteMagicContentData', $dargs);
}
$oMagiccontentModel =& getModel('magiccontent');
if ($oMagiccontentModel->getSetupData($widget_sequence, $is_complete) === false) {
$args->data_srl = getNextSequence();
$output = executeQuery('magiccontent.insertMagicContentData', $args);
} else {
$output = executeQuery('magiccontent.updateMagicContentData', $args);
}
$oCacheHandler = CacheHandler::getInstance('template');
if ($oCacheHandler->isSupport()) {
$key = 'widget_cache:' . $widget_sequence;
$oCacheHandler->delete($key);
}
$lang_type = Context::getLangType();
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
FileHandler::removeFile($cache_file);
return new Object(0, 'success');
}