예제 #1
0
 /**
  * @param      $id
  * @param bool $isGuid
  */
 public function delete($id, $isGuid = false)
 {
     $users = new Users();
     $s = new Settings();
     $nfo = new Nfo();
     $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);
         $nzbpath = "";
         if ($isGuid) {
             $nzbpath = $s->getSetting('nzbpath') . substr($identifier, 0, 1) . "/" . $identifier . ".nzb.gz";
         } elseif ($rel) {
             $nzbpath = $s->getSetting('nzbpath') . substr($rel["guid"], 0, 1) . "/" . $rel["guid"] . ".nzb.gz";
         }
         if ($nzbpath != "" && file_exists($nzbpath)) {
             unlink($nzbpath);
         }
         $audiopreviewpath = "";
         if ($isGuid) {
             $audiopreviewpath = WWW_DIR . 'covers/audio/' . $identifier . ".mp3";
         } elseif ($rel) {
             $audiopreviewpath = WWW_DIR . 'covers/audio/' . $rel["guid"] . ".mp3";
         }
         if ($audiopreviewpath && file_exists($audiopreviewpath)) {
             unlink($audiopreviewpath);
         }
         if ($rel) {
             $nfo->deleteReleaseNfo($rel['id']);
             $rc->deleteCommentsForRelease($rel['id']);
             $users->delCartForRelease($rel['id']);
             $users->delDownloadRequestsForRelease($rel['id']);
             $rf->delete($rel['id']);
             $re->delete($rel['id']);
             $re->deleteFull($rel['id']);
             $ri->delete($rel['guid']);
             $this->pdo->queryExec(sprintf("DELETE FROM releases WHERE id = %d", $rel['id']));
         }
     }
 }
예제 #2
0
 public function delete($id, $isGuid = false)
 {
     $db = new DB();
     $users = new Users();
     $s = new Sites();
     $nfo = new Nfo();
     $site = $s->get();
     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']);
         $this->deleteCommentsForRelease($rel['ID']);
         $users->delCartForRelease($rel['ID']);
         $db->query(sprintf("delete from releases where id = %d", $rel['ID']));
     }
 }