本文整理汇总了PHP中GDSRHelper::clean_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP GDSRHelper::clean_cache方法的具体用法?PHP GDSRHelper::clean_cache怎么用?PHP GDSRHelper::clean_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDSRHelper
的用法示例。
在下文中一共展示了GDSRHelper::clean_cache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clean_cache
/**
* Removes all files from cache
*
* @param string $path Path to the cache folder
*/
function clean_cache($path)
{
if (!file_exists($path)) {
return;
}
if (is_file($path)) {
unlink($path);
return;
}
foreach (glob($path . "/*") as $fn) {
GDSRHelper::clean_cache($fn);
}
}
示例2: clean_cache
/**
* Removes all files from cache
*
* @param string $path Path to the cache folder
*/
function clean_cache($path)
{
if (!file_exists($path)) {
return;
}
if (is_file($path)) {
unlink($path);
return;
}
$res = glob($path . "/*");
if (is_array($res) && count($res) > 0) {
foreach ($res as $fn) {
GDSRHelper::clean_cache($fn);
}
}
}
示例3: cache_cleanup
function cache_cleanup()
{
if ($this->o["cache_cleanup_auto"] == 1) {
$clean = false;
$pdate = strtotime($this->o["cache_cleanup_last"]);
$next_clean = mktime(date("H", $pdate), date("i", $pdate), date("s", $pdate), date("m", $pdate) + $this->o["cache_cleanup_days"], date("j", $pdate), date("Y", $pdate));
if (intval($next_clean) < intval(mktime())) {
$clean = true;
}
if ($clean) {
GDSRHelper::clean_cache(substr(STARRATING_CACHE_PATH, 0, strlen(STARRATING_CACHE_PATH) - 1));
$this->o["cache_cleanup_last"] = date("r");
update_option('gd-star-rating', $this->o);
}
}
}
示例4: init_operations
function init_operations()
{
$msg = "";
if ($_POST["gdsr_multi_review_form"] == "review") {
$mur_all = $_POST['gdsrmulti'];
$set_id = $this->o["mur_review_set"];
foreach ($mur_all as $post_id => $data) {
$mur = $data[0];
$values = explode("X", $mur);
$set = gd_get_multi_set($set_id);
$record_id = GDSRDBMulti::get_vote($post_id, $set_id, count($set->object));
GDSRDBMulti::save_review($record_id, $values);
GDSRDBMulti::recalculate_multi_review($record_id, $values, $set);
}
$this->custom_actions('init_save_review');
wp_redirect_self();
exit;
}
if (isset($_POST["gdsr_editcss_rating"])) {
$rating_css = STARRATING_XTRA_PATH . "css/rating.css";
if (is_writeable($rating_css)) {
$newcontent = stripslashes($_POST['gdsr_editcss_contents']);
$f = fopen($rating_css, 'w+');
fwrite($f, $newcontent);
fclose($f);
}
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_debug_clean'])) {
wp_gdsr_debug_clean();
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_cache_clean'])) {
GDSRHelper::clean_cache(substr(STARRATING_CACHE_PATH, 0, strlen(STARRATING_CACHE_PATH) - 1));
$this->o["cache_cleanup_last"] = date("r");
update_option('gd-star-rating', $this->o);
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_preview_scan'])) {
$this->g = $this->gfx_scan();
update_option('gd-star-rating-gfx', $this->g);
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_t2_import'])) {
GDSRDB::insert_extras_templates(STARRATING_XTRA_PATH, false);
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_upgrade_tool'])) {
gdDBInstallGDSR::delete_tables(STARRATING_PATH);
gdDBInstallGDSR::create_tables(STARRATING_PATH);
gdDBInstallGDSR::upgrade_tables(STARRATING_PATH);
gdDBInstallGDSR::alter_tables(STARRATING_PATH);
$this->o["database_upgrade"] = date("r");
update_option('gd-star-rating', $this->o);
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_mulitrecalc_tool'])) {
$set_id = $_POST['gdsr_mulitrecalc_set'];
if ($set_id > 0) {
GDSRDBMulti::recalculate_set($set_id);
} else {
GDSRDBMulti::recalculate_all_sets();
}
wp_redirect_self();
exit;
}
if (isset($_POST['gdsr_cleanup_tool'])) {
if (isset($_POST['gdsr_tools_clean_invalid_log'])) {
$count = GDSRDBTools::clean_invalid_log_articles();
if ($count > 0) {
$msg .= $count . " " . __("articles records from log table removed.", "gd-star-rating") . " ";
}
$count = GDSRDBTools::clean_invalid_log_comments();
if ($count > 0) {
$msg .= $count . " " . __("comments records from log table removed.", "gd-star-rating") . " ";
}
}
if (isset($_POST['gdsr_tools_clean_invalid_trend'])) {
$count = GDSRDBTools::clean_invalid_trend_articles();
if ($count > 0) {
$msg .= $count . " " . __("articles records from trends log table removed.", "gd-star-rating") . " ";
}
$count = GDSRDBTools::clean_invalid_trend_comments();
if ($count > 0) {
$msg .= $count . " " . __("comments records from trends log table removed.", "gd-star-rating") . " ";
}
}
if (isset($_POST['gdsr_tools_clean_old_posts'])) {
$count = GDSRDBTools::clean_dead_articles();
if ($count > 0) {
$msg .= $count . " " . __("dead articles records from articles table.", "gd-star-rating") . " ";
}
$count = GDSRDBTools::clean_revision_articles();
if ($count > 0) {
//.........这里部分代码省略.........