Пример #1
0
 /**
  * Method used to remove all issues associated with a specific list of
  * projects.
  *
  * XXX: this is dangerous, maybe remove such methods?
  *
  * @param   array $ids The list of projects to look for
  * @return  boolean
  */
 public static function removeByProjects($ids)
 {
     $stmt = 'SELECT
                 iss_id
              FROM
                 {{%issue}}
              WHERE
                 iss_prj_id IN (' . DB_Helper::buildList($ids) . ')';
     try {
         $res = DB_Helper::getInstance()->getColumn($stmt, $ids);
     } catch (DbException $e) {
         return false;
     }
     if (count($res) > 0) {
         self::deleteAssociations($res);
         Attachment::removeByIssues($res);
         SCM::removeByIssues($res);
         Impact_Analysis::removeByIssues($res);
         self::deleteUserAssociations($res);
         Note::removeByIssues($res);
         Time_Tracking::removeTimeEntriesByIssues($res);
         Notification::removeByIssues($res);
         Custom_Field::removeByIssues($res);
         Phone_Support::removeByIssues($res);
         History::removeByIssues($res);
         // now really delete the issues
         $items = implode(', ', $res);
         $stmt = "DELETE FROM\n                        {{%issue}}\n                     WHERE\n                        iss_id IN ({$items})";
         DB_Helper::getInstance()->query($stmt);
     }
     return true;
 }
Пример #2
0
 /**
  * Method used to remove all issues associated with a specific list of
  * projects.
  *
  * @access  public
  * @param   array $ids The list of projects to look for
  * @return  boolean
  */
 function removeByProjects($ids)
 {
     $items = @implode(", ", Misc::escapeInteger($ids));
     $stmt = "SELECT\n                    iss_id\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                 WHERE\n                    iss_prj_id IN ({$items})";
     $res = $GLOBALS["db_api"]->dbh->getCol($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return false;
     } else {
         if (count($res) > 0) {
             Issue::deleteAssociations($res);
             Attachment::removeByIssues($res);
             SCM::removeByIssues($res);
             Impact_Analysis::removeByIssues($res);
             Issue::deleteUserAssociations($res);
             Note::removeByIssues($res);
             Time_Tracking::removeByIssues($res);
             Notification::removeByIssues($res);
             Custom_Field::removeByIssues($res);
             Phone_Support::removeByIssues($res);
             History::removeByIssues($res);
             // now really delete the issues
             $items = implode(", ", $res);
             $stmt = "DELETE FROM\n                            " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                         WHERE\n                            iss_id IN ({$items})";
             $GLOBALS["db_api"]->dbh->query($stmt);
         }
         return true;
     }
 }