本文整理汇总了PHP中PSU::cdn_expire方法的典型用法代码示例。如果您正苦于以下问题:PHP PSU::cdn_expire方法的具体用法?PHP PSU::cdn_expire怎么用?PHP PSU::cdn_expire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSU
的用法示例。
在下文中一共展示了PSU::cdn_expire方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
*
*/
public static function update($files, $wpid = null)
{
// LAST_INSERT_ID(id) is magic to make last insert id available whether we inserted OR updated. http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
static $sql_path = "INSERT INTO http_resources (path, version) VALUES (?, 1) ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id), version = version + 1";
static $sql_id = "UPDATE http_resources SET version = version + 1 WHERE id = ?";
static $sql_revs = "INSERT INTO http_resources_revs (res_id, wpid, version) VALUES (?, ?, ?)";
static $sql_version = "SELECT path, version FROM http_resources WHERE id = ?";
foreach ((array) $files as $file) {
if (is_numeric($file) || is_int($file)) {
// updating
PSU::db('myplymouth')->Execute($sql_id, array($file));
$id = (int) $file;
} else {
// inserting, with a possible update
PSU::db('myplymouth')->Execute($sql_path, array($file));
$id = PSU::db('myplymouth')->Insert_ID();
}
// pull most recent version number
$resource = PSU::db('myplymouth')->GetRow($sql_version, array($id));
PSU::cdn_expire($resource['path']);
PSU::db('myplymouth')->Execute($sql_revs, array($id, $wpid, $resource['version']));
}
}