/**
  * Delete a preview associated with a release and update the release to indicate it doesnt have one.
  */
 public function deletePreview($guid)
 {
     $this->updateHasPreview($guid, 0);
     $ri = new ReleaseImage();
     $ri->delete($guid);
 }
Exemplo n.º 2
0
    /**
     * Deletes a single release by GUID, and all the corresponding files.
     *
     * @param array        $identifiers ['g' => Release GUID(mandatory), 'id => ReleaseID(optional, pass false)]
     * @param NZB          $nzb
     * @param ReleaseImage $releaseImage
     */
    public function deleteSingle($identifiers, $nzb, $releaseImage)
    {
        // Delete NZB from disk.
        $nzbPath = $nzb->getNZBPath($identifiers['g']);
        if ($nzbPath) {
            @unlink($nzbPath);
        }
        // Delete images.
        $releaseImage->delete($identifiers['g']);
        //Delete from sphinx.
        $this->sphinxSearch->deleteRelease($identifiers, $this->pdo);
        // Delete from DB.
        $this->pdo->queryDelete(sprintf('
				DELETE r, rn, rc, uc, rf, ra, rs, rv, re
				FROM releases r
				LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
				LEFT OUTER JOIN releasecomment rc ON rc.releaseid = r.id
				LEFT OUTER JOIN usercart uc ON uc.releaseid = r.id
				LEFT OUTER JOIN releasefiles rf ON rf.releaseid = r.id
				LEFT OUTER JOIN releaseaudio ra ON ra.releaseid = r.id
				LEFT OUTER JOIN releasesubs rs ON rs.releaseid = r.id
				LEFT OUTER JOIN releasevideo rv ON rv.releaseid = r.id
				LEFT OUTER JOIN releaseextrafull re ON re.releaseid = r.id
				WHERE r.guid = %s', $this->pdo->escapeString($identifiers['g'])));
    }
Exemplo n.º 3
0
 public function delete($id, $isGuid = false)
 {
     $db = new DB();
     $users = new Users();
     $s = new Sites();
     $nfo = new Nfo();
     $site = $s->get();
     $rf = new ReleaseFiles();
     $re = new ReleaseExtra();
     $rc = new ReleaseComments();
     $ri = new ReleaseImage();
     if (!is_array($id)) {
         $id = array($id);
     }
     foreach ($id as $identifier) {
         //
         // delete from disk.
         //
         $rel = $isGuid ? $this->getByGuid($identifier) : $this->getById($identifier);
         if ($rel && file_exists($site->nzbpath . $rel["guid"] . ".nzb.gz")) {
             unlink($site->nzbpath . $rel["guid"] . ".nzb.gz");
         }
         $nfo->deleteReleaseNfo($rel['ID']);
         $rc->deleteCommentsForRelease($rel['ID']);
         $users->delCartForRelease($rel['ID']);
         $rf->delete($rel['ID']);
         $re->delete($rel['ID']);
         $re->deleteFull($rel['ID']);
         $ri->delete($rel['guid']);
         $db->query(sprintf("delete from releases where id = %d", $rel['ID']));
     }
 }