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


PHP Artists::delete_artist方法代码示例

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


在下文中一共展示了Artists::delete_artist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:Kufirc,项目名称:Gazelle,代码行数:68,代码来源:torrents.class.php

示例2: while

    while (list($RequestName, $RequestID) = $DB->next_record(MYSQLI_NUM, true)) {
        ?>
				<li>
					<a href="requests.php?action=view&amp;id=<?php 
        echo $RequestID;
        ?>
" class="tooltip" title="View request" dir="ltr"><?php 
        echo $RequestName;
        ?>
</a>
				</li>
<?php 
    }
    ?>
			</ul>
		</div>
	</div>
<?php 
}
if ($Count == 0) {
    Artists::delete_artist($ArtistID);
    ?>
	<div class="thin box pad">
		Artist "<?php 
    echo $Name;
    ?>
" deleted!
	</div>
<?php 
}
View::show_footer();
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:delete.php


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