예제 #1
0
 /**
  * clean orphan links from database
  * 
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     return parent::cleanOrphan($this->db->prefix("tag_tag"), "tag_id");
 }
예제 #2
0
 /**
  * clean orphan items from database
  *
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     return parent::cleanOrphan($this->db->prefix("bb_topics"), "topic_id");
 }
예제 #3
0
 /**
  * clean orphan items from database
  *
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     return parent::cleanOrphan($this->db->prefix("bb_posts"), "post_id");
 }
예제 #4
0
 /**
  * clean orphan items from database
  * 
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     parent::cleanOrphan($this->db->prefix("bb_categories"), "cat_id");
     if (version_compare(mysql_get_server_info(), "4.1.0", "ge")) {
         /*
         $sql = "DELETE FROM ".$this->table.
                 " WHERE (parent_forum >0 AND parent_forum NOT IN ( SELECT DISTINCT forum_id FROM ".$this->table.") )";
         */
         $sql = "    DELETE {$this->table} FROM {$this->table}" . "    LEFT JOIN {$this->table} AS aa ON {$this->table}.parent_forum = aa.forum_id " . "    WHERE {$this->table}.parent_forum>0 AND (aa.forum_id IS NULL)";
         if (!($result = $this->db->queryF($sql))) {
             //xoops_error("cleanOrphan error:". $sql);
         }
     } else {
         $this->identifierName = "parent_forum";
         $forum_list = $this->getList(new Criteria("parent_forum", 0, ">"));
         $this->identifierName = "forum_name";
         if ($parent_forums = @array_values($forum_list)) {
             $parent_list = $this->getIds(new Criteria("forum_id", "(" . implode(", ", $parent_forums) . ")", "IN"));
             foreach ($forum_list as $forum_id => $parent_forum) {
                 if (in_array($parent_forum, $parent_list)) {
                     continue;
                 }
                 $forum_obj =& $this->get($forum_id);
                 $this->delete($forum_obj);
                 unset($forum_obj);
             }
         }
     }
     return true;
 }
예제 #5
0
 /**
  * clean orphan items from database
  *
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     $this->deleteAll(new Criteria("topic_time", 0), true, true);
     parent::cleanOrphan($this->db->prefix("bb_forums"), "forum_id");
     parent::cleanOrphan($this->db->prefix("bb_posts"), "topic_id");
     return true;
 }
예제 #6
0
 /**
  * clean orphan items from database
  *
  * @return     bool    true on success
  */
 function cleanOrphan()
 {
     $this->deleteAll(new Criteria("post_time", 0), true, true);
     parent::cleanOrphan($this->db->prefix("bb_topics"), "topic_id");
     parent::cleanOrphan($this->db->prefix("bb_posts_text"), "post_id");
     /* for MySQL 4.1+ */
     if (version_compare(mysql_get_server_info(), "4.1.0", "ge")) {
         $sql = "DELETE FROM " . $this->db->prefix("bb_posts_text") . " WHERE (post_id NOT IN ( SELECT DISTINCT post_id FROM {$this->table}) )";
     } else {
         // for 4.0+
         /* */
         $sql = "DELETE " . $this->db->prefix("bb_posts_text") . " FROM " . $this->db->prefix("bb_posts_text") . " LEFT JOIN {$this->table} AS aa ON " . $this->db->prefix("bb_posts_text") . ".post_id = aa.post_id " . " WHERE (aa.post_id IS NULL)";
         /* */
         // Alternative for 4.1+
         /*
         $sql =     "DELETE bb FROM ".$this->db->prefix("bb_posts_text")." AS bb".
         " LEFT JOIN ".$this->table." AS aa ON bb.post_id = aa.post_id ".
         " WHERE (aa.post_id IS NULL)";
         */
     }
     if (!($result = $this->db->queryF($sql))) {
         //xoops_error($this->db->error());
         return false;
     }
     return true;
 }