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


PHP BackendModel::invalidateFrontendCache方法代码示例

本文整理汇总了PHP中BackendModel::invalidateFrontendCache方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::invalidateFrontendCache方法的具体用法?PHP BackendModel::invalidateFrontendCache怎么用?PHP BackendModel::invalidateFrontendCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackendModel的用法示例。


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

示例1: updateCategory

 /**
  * Update a certain category
  *
  * @param array $item
  */
 public static function updateCategory(array $item)
 {
     BackendModel::getDB(true)->update('faq_categories', $item, 'id = ?', array($item['id']));
     BackendModel::invalidateFrontendCache('faq', BL::getWorkingLanguage());
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:10,代码来源:model.php

示例2: updateCommentStatuses

    /**
     * Updates one or more comments' status
     *
     * @return	void
     * @param	array $ids			The id(s) of the comment(s) to change the status for.
     * @param	string $status		The new status.
     */
    public static function updateCommentStatuses($ids, $status)
    {
        // make sure $ids is an array
        $ids = (array) $ids;
        // loop and cast to integers
        foreach ($ids as &$id) {
            $id = (int) $id;
        }
        // create an array with an equal amount of questionmarks as ids provided
        $idPlaceHolders = array_fill(0, count($ids), '?');
        // get ids
        $itemIds = (array) BackendModel::getDB()->getColumn('SELECT i.post_id
																FROM blog_comments AS i
																WHERE i.id IN (' . implode(', ', $idPlaceHolders) . ')', $ids);
        // update record
        BackendModel::getDB(true)->execute('UPDATE blog_comments
											SET status = ?
											WHERE id IN (' . implode(', ', $idPlaceHolders) . ')', array_merge(array((string) $status), $ids));
        // recalculate the comment count
        if (!empty($itemIds)) {
            self::reCalculateCommentCount($itemIds);
        }
        // invalidate the cache for blog
        BackendModel::invalidateFrontendCache('blog', BL::getWorkingLanguage());
    }
开发者ID:netconstructor,项目名称:forkcms,代码行数:32,代码来源:model.php

示例3: updateCommentStatuses

    /**
     * Updates one or more comments' status
     *
     * @param array $ids The id(s) of the comment(s) to change the status for.
     * @param string $status The new status.
     */
    public static function updateCommentStatuses($ids, $status)
    {
        // make sure $ids is an array
        $ids = (array) $ids;
        // loop and cast to integers
        foreach ($ids as &$id) {
            $id = (int) $id;
        }
        // create an array with an equal amount of questionmarks as ids provided
        $idPlaceHolders = array_fill(0, count($ids), '?');
        // get the items and their languages
        $items = (array) BackendModel::getDB()->getPairs('SELECT i.post_id, i.language
			 FROM blog_comments AS i
			 WHERE i.id IN (' . implode(', ', $idPlaceHolders) . ')', $ids, 'post_id');
        // only proceed if there are items
        if (!empty($items)) {
            // get the ids
            $itemIds = array_keys($items);
            // get the unique languages
            $languages = array_unique(array_values($items));
            // update records
            BackendModel::getDB(true)->execute('UPDATE blog_comments
				 SET status = ?
				 WHERE id IN (' . implode(', ', $idPlaceHolders) . ')', array_merge(array((string) $status), $ids));
            // recalculate the comment count
            self::reCalculateCommentCount($itemIds);
            // invalidate the cache for blog
            foreach ($languages as $language) {
                BackendModel::invalidateFrontendCache('blog', $language);
            }
        }
    }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:38,代码来源:model.php


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