本文整理匯總了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']));
}
}