当前位置: 首页>>代码示例>>PHP>>正文


PHP cache_clear函数代码示例

本文整理汇总了PHP中cache_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_clear函数的具体用法?PHP cache_clear怎么用?PHP cache_clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cache_clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DoClean

 function DoClean()
 {
     $type = get_param('type');
     if (!$type) {
         $this->Messager("请先选择要清理的缓存对象");
     }
     $this->_removeTopicAttach();
     $this->_removeTopicLongtext();
     $this->_removeVoteImage();
     if (in_array('data', $type)) {
         cache_db('clear');
         jtable('failedlogins')->truncate();
         DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'");
     }
     if (in_array('tpl', $type)) {
         cache_clear();
         jconf::set('validate_category', array());
         jlogic('credits')->rule_conf(true);
     }
     if (in_array('channel', $type)) {
         jlogic('channel')->update_data();
     }
     if (in_array('album', $type)) {
         jlogic('image')->update_data();
     }
     $this->Messager("已清空所有缓存");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:27,代码来源:cache.mod.php

示例2: user_create

/**
 * user_create
 * 
 * creates a new user in the database with the
 * given parameters
 * 
 * $data    -   an array of items to be JSON encoded in
 *              the data field
 * $options -   an array of options to be added to the
 *              options database table for the user
 * $mail    -   an array with the keys 'subject', 'message',
 *              for the users notification email         
 * 
 * @param string $name
 * @param string $email
 * @param string $password
 * @param array $groups
 * @param array $data optional
 * @param array $options optional
 * @param array $mail optional
 * @return int|bool $id
 */
function user_create($name, $email, $password, $groups, $data = array(), $options = array(), $mail = true)
{
    /**
     * if email is in use, return false
     * note; one account per email
     */
    if (num('select id from ' . DB_USERS . ' where email="' . $email . '"') != 0) {
        return false;
    }
    /**
     * add to users table
     */
    $hash = md5(mt_rand());
    query('insert into ' . DB_USERS . ' values (' . '"",' . '"' . $name . '",' . '"' . $email . '",' . '"' . md5($password) . '",' . '"' . $hash . '",' . '"",' . '"' . json_encode($data) . '"' . ')');
    $id = mysql_insert_id();
    /**
     * add to groups table for each group
     */
    foreach ($groups as $group) {
        query('insert into ' . DB_USERS_GROUPS . ' values( ' . $id . ', ' . $group . ' )');
    }
    /**
     * create user files directory
     */
    $FileManager = FileManager::getInstance();
    $FileManager->addDir('users/' . $id);
    /**
     * add options to options table if nessecary
     */
    if (!empty($options)) {
        foreach ($options as $name => $value) {
            query('insert into ' . DB_OPTIONS . ' values( "' . $name . '", "' . $value . '", "user_' . $id . '"');
        }
    }
    // default email
    if ($mail) {
        $mail = array();
        $mail['subject'] = 'User Activation - Furasta.Org';
        $mail['message'] = $name . ',<br/>
		<br/>
		Please activate your new user by clicking on the link below:<br/>
		<br/>
		<a href="' . SITE_URL . 'admin/users/activate.php?hash=' . $hash . '">' . $url . '/admin/users/activate.php?hash=' . $hash . '</a><br/>
		<br/>
		If you are not the person stated above please ignore this email.<br/>
		';
    }
    // send notification email to user
    email($email, $mail['subject'], $mail['message']);
    cache_clear('DB_USERS');
    return $id;
}
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:74,代码来源:users.php

示例3: exec

 public function exec($sql, $cache_file = false)
 {
     $this->queryCount++;
     try {
         $this->queryHistory[] = $sql;
         if ($cache_file) {
             cache_clear($cache_file);
         }
         return PDO::exec($sql);
     } catch (Exception $e) {
         exit('<h3>Error while executing SQL query!</h3><code>Code: ' . end($this->errorInfo()) . '</code><p><em>For more information check log file.</em></p>');
     }
 }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:13,代码来源:MyPDO.class.php

示例4: cache_clear

function cache_clear($type = '')
{
    if (!is_dir(USERBASE . '/ww.cache/' . $type)) {
        return;
    }
    $d = new DirectoryIterator(USERBASE . '/ww.cache/' . $type);
    foreach ($d as $f) {
        $f = $f->getFilename();
        if ($f == '.' || $f == '..') {
            continue;
        }
        if (is_dir(USERBASE . '/ww.cache/' . $type . '/' . $f)) {
            cache_clear($type . '/' . $f);
            rmdir(USERBASE . '/ww.cache/' . $type . '/' . $f);
        } else {
            unlink(USERBASE . '/ww.cache/' . $type . '/' . $f);
        }
    }
}
开发者ID:AmandaSyachri,项目名称:webworks-webme,代码行数:19,代码来源:basics.php

示例5: update

    public static function update($holder)
    {
        global $blocks, $cfg, $sql, $form, $lang_system, $lang_admin;
        if ($form['blocks'] !== false) {
            $form['blocks'] = implode(', ', $form['blocks']);
        }
        foreach ($form as $key => $value) {
            if (isset($cfg->{$holder}[$key]) && $cfg->{$holder}[$key] != $value) {
                $value ? $sql->exec('
						UPDATE ' . DB_PREFIX . 'config
						SET content = ' . (is_numeric($value) ? $value : '"' . $value . '"') . '
						WHERE name = "' . $key . '" AND holder = "' . $holder . '"') : $sql->exec('DELETE FROM ' . DB_PREFIX . 'config WHERE name = "' . $key . '" AND holder = "' . $holder . '"');
            } elseif (!isset($cfg->{$holder}[$key]) && $value) {
                $sql->exec('
					INSERT INTO ' . DB_PREFIX . 'config (holder, name, content)
					VALUES ("' . $holder . '", "' . $key . '", ' . (is_numeric($value) ? (int) $value : '"' . $value . '"') . ')');
            }
            cache_clear('config.txt');
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:20,代码来源:Settings.class.php

示例6: cache_load

function cache_load($srcpath, $thumbw, $thumbh)
{
    global $cfg, $imgIsRemote;
    cache_clear();
    // Setup
    if ($imgIsRemote) {
        $srctime = time();
    } else {
        $srctime = @filemtime($srcpath);
    }
    if (!$srctime) {
        return false;
    }
    // Get data
    $data = fr("cache/cacheData.txt");
    if ($data) {
        $data = explode("####\r\n", $data);
    } else {
        $data = array();
    }
    // Search data
    for ($i = count($data); $i >= 0; $i--) {
        $values = explode("##", $data[$i]);
        if ($srcpath == $values[0] && $thumbw == $values[2] && $thumbh == $values[3]) {
            if ($srctime >= $values[4]) {
                cache_log("CACHE_RENEW :: " . $srcpath);
                cache_remove($srcpath);
                return false;
            }
            if (!file_exists($values[1])) {
                cache_remove($srcpath);
                return false;
            }
            cache_log("CACHE_LOAD :: " . $srcpath);
            return $values[1];
        }
    }
    return false;
}
开发者ID:rejhgadellaa,项目名称:icerrr,代码行数:39,代码来源:rgt.functions.cache.php

示例7: DoModifyRewrite

 function DoModifyRewrite()
 {
     $reserved_keys = array('api' => 1, 'backup' => 1, 'cache' => 1, 'data' => 1, 'log' => 1, 'iis_rewrite' => 1, 'images' => 1, 'include' => 1, 'install' => 1, 'modules' => 1, 'setting' => 1, 'templates' => 1, 'uc_server' => 1, 'uc_client' => 1, 'wap' => 1, 'blacklist' => 1, 'get_password' => 1, 'imjiqiren' => 1, 'login' => 1, 'master' => 1, 'member' => 1, 'other' => 1, 'pm' => 1, 'profile' => 1, 'report' => 1, 'search' => 1, 'settings' => 1, 'share' => 1, 'show' => 1, 'tag' => 1, 'theme' => 1, 'topic' => 1, 'url' => 1, 'user_tag' => 1, 'weather' => 1, 'xwb' => 1, 'htaccess' => 1, 'admin' => 1, 'ajax' => 1, 'changelog' => 1, 'favicon' => 1, 'index' => 1, 'license' => 1, 'public' => 1, 'robots' => 1, 'server' => 1, 'test' => 1, 'upgrade' => 1, 'plugin' => 1, 'channel' => 1, 'attach' => 1, 'live' => 1, 'talk' => 1, 'company' => 1, 'department' => 1, 'job' => 1);
     $mod_alias = array();
     foreach ((array) $this->Post['mod_alias'] as $old_name => $new_name) {
         $new_name = trim($new_name);
         if (!empty($new_name) && $old_name != $new_name && preg_match("~^[A-Za-z0-9_]+\$~", $new_name) && !isset($reserved_keys[$new_name])) {
             $mod_alias[$old_name] = $new_name;
         }
     }
     $_rewrite = jconf::get('rewrite');
     if (isset($this->Post['_rewrite_extention']) && (!$this->Post['_rewrite_extention'] || preg_match('~^[\\w\\d\\/\\-\\_\\.]+$~', $this->Post['_rewrite_extention']))) {
         $_rewrite['extention'] = $this->Post['_rewrite_extention'];
     }
     $_rewrite['mode'] = $this->Post['mode'];
     $_rewrite['abs_path'] = preg_replace("/\\/+/", '/', str_replace("\\", '/', dirname($_SERVER['PHP_SELF'])) . "/");
     $gateway = array("stand" => "", "apache_path" => "index.php/", "normal" => "?", "" => "");
     $_rewrite['gateway'] = $gateway[$_rewrite['mode']];
     if (!empty($mod_alias)) {
         $_rewrite['value_replace_list']['mod'] = $mod_alias;
     } else {
         unset($_rewrite['value_replace_list']['mod']);
     }
     jconf::set('rewrite', $_rewrite);
     if ($_rewrite['mode'] == 'stand') {
         $this->_writeHtaccess($_rewrite['abs_path']);
     }
     jconf::update('rewrite_enable', $_rewrite['mode'] ? 1 : 0);
     cache_clear();
     $this->Messager("修改成功,正在更新缓存");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:31,代码来源:setting.mod.php

示例8: cache_clear

                         if ($step == 6) {
                             cache_clear('fields');
                             cache_fields();
                             cache_clear('option');
                             msg('自定义字段更新成功', '?action=' . $action . '&step=' . ($step + 1));
                         } else {
                             if ($step == 7) {
                                 cache_clear_ad();
                                 tohtml('index');
                                 msg('全部缓存更新成功');
                             } else {
                                 cache_clear('group');
                                 cache_group();
                                 cache_clear('type');
                                 cache_type();
                                 cache_clear('keylink');
                                 cache_keylink();
                                 cache_pay();
                                 cache_banip();
                                 cache_banword();
                                 cache_bancomment();
                                 msg('正在开始更新缓存', '?action=' . $action . '&step=' . ($step + 1));
                             }
                         }
                     }
                 }
             }
         }
     }
     break;
 case 'cacheclear':
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:index.inc.php

示例9: DoModify

 function DoModify()
 {
     if (isset($this->Post['show'])) {
         jconf::set('show', $this->Post['show']);
     }
     if (isset($this->Post['cache'])) {
         jconf::set('cache', $this->Post['cache']);
     }
     cache_clear();
     $config = array();
     if ($this->Post['template_path'] != "" && $this->Post['template_path'] != $this->Config['template_path']) {
         $this->Post['template_path'] = dir_safe($this->Post['template_path']);
         $config['template_path'] = $this->Post['template_path'];
     }
     if (isset($this->Post['templatedeveloper']) && $this->Post['templatedeveloper'] != $this->Config['templatedeveloper']) {
         $config['templatedeveloper'] = $this->Post['templatedeveloper'] ? 1 : 0;
     }
     if (isset($this->Post['style_three_tol']) && $this->Post['style_three_tol'] != $this->Config['style_three_tol']) {
         $config['style_three_tol'] = $this->Post['style_three_tol'] ? 1 : 0;
     }
     if ($config) {
         jconf::update($config);
     }
     $this->Messager("设置成功");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:25,代码来源:show.mod.php

示例10: header

    header('location: users.php');
}
/**
 * set up javascript and php form validation
 */
$conds = array('Name' => array('required' => true, 'pattern' => "^[A-Z a-z]{1,50}\$"), 'Email' => array('required' => true, 'email' => true));
$valid = validate($conds, "#users-edit", 'Edit-User');
/**
 * read post information and edit page if applicable
 */
if (isset($_POST['Edit-User']) && $valid == true) {
    $name = addslashes($_POST['Name']);
    $email = addslashes($_POST['Email']);
    $group = addslashes($_POST['Group']);
    query('update ' . DB_USERS . ' set name="' . $name . '",email="' . $email . '", user_group="' . $group . '" where id=' . $id);
    cache_clear('USERS');
}
$user = User::getInstance($id);
$Template->loadJavascript('admin/users/edit-user.js');
$content = '
<span style="float:right" id="change-password"><span id="header-Login" class="header-img"></span><h1 class="image-left link">Reset Password</h1></span>
<span id="header-Users" class="header-img"></span><h1 class="image-left">Edit User</h1>

<br/>
	<form method="post" id="users-edit">
		<div id="tabs">
			<ul>
				<li><a href="#Options">General</a></li>
			</ul>
			<div id="#Options">
                                <table class="row-color">
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:31,代码来源:edit-user.php

示例11: explode

<?php

require '../../ww.incs/basics.php';
if (!is_admin()) {
    exit;
}
$id = (int) $_REQUEST['id'];
$to = (int) $_REQUEST['parent_id'];
$order = explode(',', $_REQUEST['order']);
dbQuery("update pages set parent={$to} where id={$id}");
for ($i = 0; $i < count($order); ++$i) {
    $pid = (int) $order[$i];
    dbQuery("update pages set ord={$i} where id={$pid}");
    echo "update pages set ord={$i} where id={$pid}\n";
}
cache_clear('pages');
cache_clear('menus');
dbQuery('update page_summaries set rss=""');
开发者ID:AmandaSyachri,项目名称:webworks-webme,代码行数:18,代码来源:move_page.php

示例12: delete

 function delete()
 {
     $_tmp_arr = (array) ($this->Get['id'] ? $this->Get['id'] : $this->Post['delete']);
     $id_arr = array();
     foreach ($_tmp_arr as $_id) {
         $_id = (int) $_id;
         if ($_id > 0) {
             $id_arr[$_id] = $_id;
         }
     }
     if (!$id_arr) {
         $this->Messager("未指定删除的标签");
     }
     $sql = "SELECT * FROM `" . TABLE_PREFIX . "tag` WHERE `id` in('" . implode("','", $id_arr) . "')";
     $query = $this->DatabaseHandler->Query($sql);
     $tag_id_list = $tag_list = array();
     while (false != ($row = $query->GetRow())) {
         $id = (int) $row['id'];
         if ($id < 1) {
             continue;
         }
         $tag_id_list[$id] = $id;
         $tag_list[$id] = $row['name'];
     }
     if (!$tag_id_list) {
         $this->Messager("请指定删除的标签");
     }
     $ids = "'" . implode("','", $tag_id_list) . "'";
     $sql = "DELETE FROM `" . TABLE_PREFIX . "tag` WHERE `id` IN({$ids})";
     DB::query($sql, "SKIP_ERROR");
     $sql = "DELETE FROM `" . TABLE_PREFIX . "my_tag` WHERE `tag_id` IN({$ids})";
     DB::query($sql, "SKIP_ERROR");
     $item_list = jconf::get('tag', 'item_list');
     foreach ($item_list as $item) {
         $sql = "DELETE FROM `" . $item['table_name'] . "_tag` WHERE `tag_id` IN({$ids})";
         DB::query($sql, "SKIP_ERROR");
         $sql = "DELETE FROM `" . TABLE_PREFIX . "my_{$item['value']}_tag` WHERE `tag_id` IN({$ids})";
         DB::query($sql, "SKIP_ERROR");
         foreach ($tag_list as $tag) {
             if (!$tag) {
                 continue;
             }
             $sql = "UPDATE `{$item['table_name']}` SET `tag`=TRIM(LEADING ',' FROM REPLACE(CONCAT_WS('',',',tag),',{$tag}','')) , `tag_count`=if(`tag_count`>1,`tag_count`-1,0) WHERE `tag` LIKE '%{$tag}%'";
             DB::query($sql, "SKIP_ERROR");
         }
     }
     cache_clear();
     $this->Messager("删除成功");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:49,代码来源:tag.mod.php

示例13: batch_process


//.........这里部分代码省略.........
                             //}
                         } else {
                             $content_items_from_file = @unserialize($batch_file_content);
                             if (!empty($content_items_from_file)) {
                                 foreach ($content_items_from_file as $content_from_x) {
                                     $content_items[] = $content_from_x;
                                 }
                             }
                         }
                         if ($batch_file != false and is_file($batch_file)) {
                             @unlink($batch_file);
                         }
                     }
                     $i++;
                 }
             }
             $remaining = $i;
         }
     } else {
         $total = count($content_items);
     }
     // dd($content_items);
     if ($content_items != false and is_array($content_items)) {
         if (!empty($content_items)) {
             $parent = get_content('one=true&subtype=dynamic&is_deleted=0&is_active=1');
             if ($parent == false) {
                 $parent = get_content('one=true&content_type=page&is_deleted=0&is_active=1');
             }
             if ($parent == false) {
                 $parent = 0;
             }
             $content_items = $this->map_array($content_items);
             $parent_id = $parent['id'];
             $restored_items = array();
             foreach ($content_items as $content) {
                 if (isset($content['title'])) {
                     $is_saved = get_content('one=true&title=' . $content['title']);
                     if (isset($content['description']) and (!isset($content['content']) or $content['content'] == false)) {
                         //$content['content'] = $content['description'];
                     }
                     if (!isset($content['parent'])) {
                         $content['parent'] = $parent_id;
                     }
                     if (isset($content['parent'])) {
                         $par = get_content_by_id($content['parent']);
                         if ($par != false) {
                             if (isset($par['is_shop']) and $par['is_shop'] == 1) {
                                 $content['content_type'] = 'product';
                                 $content['subtype'] = 'product';
                             }
                         }
                     }
                     if (!isset($content['content_type'])) {
                         $content['content_type'] = 'post';
                     }
                     if (!isset($content['subtype'])) {
                         $content['subtype'] = 'post';
                     }
                     // $content['subtype'] = 'post';
                     $content['is_active'] = 1;
                     if (isset($content['debug'])) {
                         unset($content['debug']);
                     }
                     //  $content['debug'] = 'y';
                     //  $content['download_remote_images'] = true;
                     if ($is_saved != false) {
                         $content['id'] = $is_saved['id'];
                         if (!isset($content['content_type'])) {
                             $content['content_type'] = $is_saved['content_type'];
                             $content['subtype'] = $is_saved['subtype'];
                         }
                     }
                     $import = save_content($content);
                     $restored_items[] = $import;
                 }
             }
             cache_clear('categories');
             cache_clear('content');
             $remaining = $remaining - 1;
             if ($remaining <= 0) {
                 file_put_contents($index_file, '0');
             }
             if ($total < $remaining) {
                 $total = 0;
                 $dir = $chunks_folder;
                 if ($handle = opendir($dir)) {
                     while (($file = readdir($handle)) !== false) {
                         if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
                             $total++;
                         }
                     }
                 }
                 file_put_contents($index_file, $total);
             }
             $ret = array('success' => count($restored_items) . " items restored", 'total' => $total, 'remaining' => $remaining);
             return $ret;
         }
     }
     return false;
 }
开发者ID:newaltcoin,项目名称:microweber,代码行数:101,代码来源:Import.php

示例14: Copyright

<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
defined('DT_ADMIN') or exit('Access Denied');
$menus = array(array('重建缓存', '?file=' . $file . '&action=cache'), array('模板管理', '?file=template'), array('风格管理', '?file=skin'), array('标签向导', '?file=' . $file));
switch ($action) {
    case 'cache':
        cache_clear('htm', 'dir', 'tag');
        dmsg('更新成功', '?file=' . $file);
        break;
    case 'find':
        $mid or $mid = '';
        $tb = isset($tb) ? trim($tb) : '';
        if (isset($MODULE[$mid]) && $mid > 3) {
            $table = get_table($mid);
            $note = urlencode($MODULE[$mid]['name']);
        } else {
            $table = $DT_PRE . $tb;
            $note = '';
        }
        dheader('?file=' . $file . '&action=dict&table=' . $table . '&note=' . $note);
        break;
    case 'dict':
        isset($table) && $table or exit;
        $table = strip_sql($table, 0);
        if (strpos($table, $DT_PRE) === false) {
            $rtable = $table;
        } else {
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:tag.inc.php

示例15: cache_clear_sql

function cache_clear_sql($dir, $all = false)
{
    global $DT_TIME;
    if ($dir) {
        $globs = glob(DT_CACHE . '/sql/' . $dir . '/*.php');
        if ($globs) {
            foreach ($globs as $v) {
                if ($all) {
                    file_del($v);
                } else {
                    $exptime = intval(substr(file_get($v), 8, 18));
                    if ($exptime && $DT_TIME > $exptime) {
                        file_del($v);
                    }
                }
            }
        }
    } else {
        cache_clear('php', 'dir', 'sql');
    }
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:21,代码来源:cache.func.php


注:本文中的cache_clear函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。