本文整理汇总了PHP中Comments::delete_page方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::delete_page方法的具体用法?PHP Comments::delete_page怎么用?PHP Comments::delete_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::delete_page方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_group
/**
* Delete a group, called after all of its torrents have been deleted.
* IMPORTANT: Never call this unless you're certain the group is no longer used by any torrents
*
* @param int $GroupID
*/
public static function delete_group($GroupID)
{
$QueryID = G::$DB->get_query_id();
Misc::write_log("Group {$GroupID} automatically deleted (No torrents have this group).");
G::$DB->query("\n\t\t\tSELECT CategoryID\n\t\t\tFROM torrents_group\n\t\t\tWHERE ID = '{$GroupID}'");
list($Category) = G::$DB->next_record();
if ($Category == 1) {
G::$Cache->decrement('stats_album_count');
}
G::$Cache->decrement('stats_group_count');
// Collages
G::$DB->query("\n\t\t\tSELECT CollageID\n\t\t\tFROM collages_torrents\n\t\t\tWHERE GroupID = '{$GroupID}'");
if (G::$DB->has_results()) {
$CollageIDs = G::$DB->collect('CollageID');
G::$DB->query("\n\t\t\t\tUPDATE collages\n\t\t\t\tSET NumTorrents = NumTorrents - 1\n\t\t\t\tWHERE ID IN (" . implode(', ', $CollageIDs) . ')');
G::$DB->query("\n\t\t\t\tDELETE FROM collages_torrents\n\t\t\t\tWHERE GroupID = '{$GroupID}'");
foreach ($CollageIDs as $CollageID) {
G::$Cache->delete_value("collage_{$CollageID}");
}
G::$Cache->delete_value("torrent_collages_{$GroupID}");
}
// Artists
// Collect the artist IDs and then wipe the torrents_artist entry
G::$DB->query("\n\t\t\tSELECT ArtistID\n\t\t\tFROM torrents_artists\n\t\t\tWHERE GroupID = {$GroupID}");
$Artists = G::$DB->collect('ArtistID');
G::$DB->query("\n\t\t\tDELETE FROM torrents_artists\n\t\t\tWHERE GroupID = '{$GroupID}'");
foreach ($Artists as $ArtistID) {
if (empty($ArtistID)) {
continue;
}
// Get a count of how many groups or requests use the artist ID
G::$DB->query("\n\t\t\t\tSELECT COUNT(ag.ArtistID)\n\t\t\t\tFROM artists_group AS ag\n\t\t\t\t\tLEFT JOIN requests_artists AS ra ON ag.ArtistID = ra.ArtistID\n\t\t\t\tWHERE ra.ArtistID IS NOT NULL\n\t\t\t\t\tAND ag.ArtistID = '{$ArtistID}'");
list($ReqCount) = G::$DB->next_record();
G::$DB->query("\n\t\t\t\tSELECT COUNT(ag.ArtistID)\n\t\t\t\tFROM artists_group AS ag\n\t\t\t\t\tLEFT JOIN torrents_artists AS ta ON ag.ArtistID = ta.ArtistID\n\t\t\t\tWHERE ta.ArtistID IS NOT NULL\n\t\t\t\t\tAND ag.ArtistID = '{$ArtistID}'");
list($GroupCount) = G::$DB->next_record();
if ($ReqCount + $GroupCount == 0) {
//The only group to use this artist
Artists::delete_artist($ArtistID);
} else {
//Not the only group, still need to clear cache
G::$Cache->delete_value("artist_groups_{$ArtistID}");
}
}
// Requests
G::$DB->query("\n\t\t\tSELECT ID\n\t\t\tFROM requests\n\t\t\tWHERE GroupID = '{$GroupID}'");
$Requests = G::$DB->collect('ID');
G::$DB->query("\n\t\t\tUPDATE requests\n\t\t\tSET GroupID = NULL\n\t\t\tWHERE GroupID = '{$GroupID}'");
foreach ($Requests as $RequestID) {
G::$Cache->delete_value("request_{$RequestID}");
}
// comments
Comments::delete_page('torrents', $GroupID);
G::$DB->query("\n\t\t\tDELETE FROM torrents_group\n\t\t\tWHERE ID = '{$GroupID}'");
G::$DB->query("\n\t\t\tDELETE FROM torrents_tags\n\t\t\tWHERE GroupID = '{$GroupID}'");
G::$DB->query("\n\t\t\tDELETE FROM torrents_tags_votes\n\t\t\tWHERE GroupID = '{$GroupID}'");
G::$DB->query("\n\t\t\tDELETE FROM bookmarks_torrents\n\t\t\tWHERE GroupID = '{$GroupID}'");
G::$DB->query("\n\t\t\tDELETE FROM wiki_torrents\n\t\t\tWHERE PageID = '{$GroupID}'");
G::$Cache->delete_value("torrents_details_{$GroupID}");
G::$Cache->delete_value("torrent_group_{$GroupID}");
G::$Cache->delete_value("groups_artists_{$GroupID}");
G::$DB->set_query_id($QueryID);
}
示例2: error
if (!is_number($CollageID) || !$CollageID) {
error(404);
}
$DB->query("\n\tSELECT Name, CategoryID, UserID\n\tFROM collages\n\tWHERE ID = '{$CollageID}'");
list($Name, $CategoryID, $UserID) = $DB->next_record(MYSQLI_NUM, false);
if (!check_perms('site_collages_delete') && $UserID !== $LoggedUser['ID']) {
error(403);
}
$Reason = trim($_POST['reason']);
if (!$Reason) {
error('You must enter a reason!');
}
$DB->query("\n\tSELECT GroupID\n\tFROM collages_torrents\n\tWHERE CollageID = '{$CollageID}'");
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value("torrents_details_{$GroupID}");
$Cache->delete_value("torrent_collages_{$GroupID}");
$Cache->delete_value("torrent_collages_personal_{$GroupID}");
}
//Personal collages have CategoryID 0
if ($CategoryID == 0) {
$DB->query("\n\t\tDELETE FROM collages\n\t\tWHERE ID = '{$CollageID}'");
$DB->query("\n\t\tDELETE FROM collages_torrents\n\t\tWHERE CollageID = '{$CollageID}'");
Comments::delete_page('collages', $CollageID);
} else {
$DB->query("\n\t\tUPDATE collages\n\t\tSET Deleted = '1'\n\t\tWHERE ID = '{$CollageID}'");
Subscriptions::flush_subscriptions('collages', $CollageID);
Subscriptions::flush_quote_notifications('collages', $CollageID);
}
Misc::write_log("Collage {$CollageID} ({$Name}) was deleted by " . $LoggedUser['Username'] . ": {$Reason}");
$Cache->delete_value("collage_{$CollageID}");
header('Location: collages.php');
示例3: delete_artist
/**
* Deletes an artist and their requests, wiki, and tags.
* Does NOT delete their torrents.
*
* @param int $ArtistID
*/
public static function delete_artist($ArtistID)
{
$QueryID = G::$DB->get_query_id();
G::$DB->query("\n\t\t\tSELECT Name\n\t\t\tFROM artists_group\n\t\t\tWHERE ArtistID = " . $ArtistID);
list($Name) = G::$DB->next_record(MYSQLI_NUM, false);
// Delete requests
G::$DB->query("\n\t\t\tSELECT RequestID\n\t\t\tFROM requests_artists\n\t\t\tWHERE ArtistID = {$ArtistID}\n\t\t\t\tAND ArtistID != 0");
$Requests = G::$DB->to_array();
foreach ($Requests as $Request) {
list($RequestID) = $Request;
G::$DB->query('DELETE FROM requests WHERE ID=' . $RequestID);
G::$DB->query('DELETE FROM requests_votes WHERE RequestID=' . $RequestID);
G::$DB->query('DELETE FROM requests_tags WHERE RequestID=' . $RequestID);
G::$DB->query('DELETE FROM requests_artists WHERE RequestID=' . $RequestID);
}
// Delete artist
G::$DB->query('DELETE FROM artists_group WHERE ArtistID=' . $ArtistID);
G::$DB->query('DELETE FROM artists_alias WHERE ArtistID=' . $ArtistID);
G::$Cache->decrement('stats_artist_count');
// Delete wiki revisions
G::$DB->query('DELETE FROM wiki_artists WHERE PageID=' . $ArtistID);
// Delete tags
G::$DB->query('DELETE FROM artists_tags WHERE ArtistID=' . $ArtistID);
// Delete artist comments, subscriptions and quote notifications
Comments::delete_page('artist', $ArtistID);
G::$Cache->delete_value('artist_' . $ArtistID);
G::$Cache->delete_value('artist_groups_' . $ArtistID);
// Record in log
if (!empty(G::$LoggedUser['Username'])) {
$Username = G::$LoggedUser['Username'];
} else {
$Username = 'System';
}
Misc::write_log("Artist {$ArtistID} ({$Name}) was deleted by {$Username}");
G::$DB->set_query_id($QueryID);
}