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


PHP DataObject::dbdelete方法代码示例

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


在下文中一共展示了DataObject::dbdelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dbdelete

    /**
     * Update the DB based on previously recorded changes
     */
    function dbdelete()
    {
        global $DB;
        $DB->begin();
        $item_ID = $this->ID;
        if (parent::dbdelete()) {
            // Delete all custom fields of this post type
            $DB->query('DELETE FROM T_items__type_custom_field
				WHERE itcf_ityp_ID = ' . $item_ID);
        }
        $DB->commit();
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:15,代码来源:_itemtype.class.php

示例2: dbdelete

    /**
     * Trigger event AfterCommentDelete after calling parent method.
     *
     * @param boolean set true to force permanent delete, leave false otherwise
     * @return boolean true on success
     */
    function dbdelete($force_permanent_delete = false)
    {
        global $Plugins, $DB;
        $DB->begin();
        $was_published = $this->is_published();
        if ($this->status != 'trash') {
            // The comment was not recycled yet
            if ($this->has_replies()) {
                // Move the replies to the one level up
                $new_parent_ID = !empty($this->in_reply_to_cmt_ID) ? $DB->quote($this->in_reply_to_cmt_ID) : 'NULL';
                $DB->query('UPDATE T_comments
				    SET comment_in_reply_to_cmt_ID = ' . $new_parent_ID . '
				  WHERE comment_in_reply_to_cmt_ID = ' . $this->ID);
            }
        }
        if ($force_permanent_delete || $this->status == 'trash') {
            // remember ID, because parent method resets it to 0
            $old_ID = $this->ID;
            // Select comment attachment ids
            $result = $DB->get_col('
				SELECT link_file_ID
					FROM T_links
				 WHERE link_cmt_ID = ' . $this->ID);
            if ($r = parent::dbdelete()) {
                if (!empty($result)) {
                    // remove deleted comment not linked attachments
                    remove_orphan_files($result);
                }
                // re-set the ID for the Plugin event
                $this->ID = $old_ID;
                $this->delete_prerendered_content();
                $Plugins->trigger_event('AfterCommentDelete', $params = array('Comment' => &$this));
                $this->ID = 0;
            }
        } else {
            // don't delete, just move to the trash:
            $this->set('status', 'trash');
            $r = $this->dbupdate();
        }
        if ($r) {
            if ($was_published) {
                // Update last touched date of item if a published comment was deleted
                $comment_Item =& $this->get_Item();
                $comment_Item->update_last_touched_date();
            }
            $DB->commit();
        } else {
            $DB->rollback();
        }
        return $r;
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:57,代码来源:_comment.class.php

示例3: dbdelete

 /**
  * Delete a blog and dependencies from database
  *
  * Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
  *
  * @param boolean true if you want to try to delete the static file
  * @param boolean true if you want to echo progress
  */
 function dbdelete($delete_static_file = false, $echo = false)
 {
     global $DB, $Messages;
     // Note: No need to localize the status messages...
     if ($echo) {
         echo '<p>MySQL 3.23 compatibility mode!';
     }
     // Get list of cats that are going to be deleted (3.23)
     if ($echo) {
         echo '<br />Getting category list to delete... ';
     }
     $cat_list = implode(',', $DB->get_col("\r\n\t\t\t\tSELECT cat_ID\r\n\t\t\t\t  FROM T_categories\r\n\t\t\t\t WHERE cat_blog_ID = {$this->ID}"));
     if (empty($cat_list)) {
         // There are no cats to delete
         if ($echo) {
             echo 'None!';
         }
     } else {
         // Delete the cats & dependencies
         // Get list of posts that are going to be deleted (3.23)
         if ($echo) {
             echo '<br />Getting post list to delete... ';
         }
         $post_list = implode(',', $DB->get_col("\r\n\t\t\t\t\tSELECT postcat_post_ID\r\n\t\t\t\t\t  FROM T_postcats\r\n\t\t\t\t\t WHERE postcat_cat_ID IN ({$cat_list})"));
         if (empty($post_list)) {
             // There are no posts to delete
             if ($echo) {
                 echo 'None!';
             }
         } else {
             // Delete the posts & dependencies
             // TODO: There's also a constraint FK_post_parent_ID..
             // Delete postcats
             if ($echo) {
                 echo '<br />Deleting post-categories... ';
             }
             $ret = $DB->query("DELETE FROM T_postcats\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE postcat_cat_ID IN ({$cat_list})");
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted post-categories'), 'success');
             // Delete comments
             if ($echo) {
                 echo '<br />Deleting comments on blog\'s posts... ';
             }
             $ret = $DB->query("DELETE FROM T_comments\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE comment_post_ID IN ({$post_list})");
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted comments on blog\'s posts'), 'success');
             // Delete posts
             if ($echo) {
                 echo '<br />Deleting blog\'s posts... ';
             }
             $ret = $DB->query("DELETE FROM T_items__item\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE post_ID IN ({$post_list})");
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted blog\'s posts'), 'success');
         }
         // / are there posts?
         // Delete categories
         if ($echo) {
             echo '<br />Deleting blog\'s categories... ';
         }
         $ret = $DB->query("DELETE FROM T_categories\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE cat_blog_ID = {$this->ID}");
         if ($echo) {
             printf('(%d rows)', $ret);
         }
         $Messages->add(T_('Deleted blog\'s categories'), 'success');
     }
     // / are there cats?
     if ($delete_static_file) {
         // Delete static file
         if ($echo) {
             echo '<br />Trying to delete static file... ';
         }
         if (!@unlink($this->get('staticfilepath'))) {
             if ($echo) {
                 echo '<span class="error">';
                 printf(T_('ERROR! Could not delete! You will have to delete the file [%s] by hand.'), $this->get('staticfilepath'));
                 echo '</span>';
             }
             $Messages->add(sprintf(T_('Could not delete static file [%s]'), $this->get('staticfilepath')), 'error');
         } else {
             if ($echo) {
                 echo 'OK.';
             }
             $Messages->add(T_('Deleted blog\'s static file'), 'success');
         }
     }
     // Unset cache entry:
//.........这里部分代码省略.........
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_blog.class.php

示例4: dbdelete

 /**
  * Delete object from DB.
  */
 function dbdelete($Messages = NULL)
 {
     global $DB;
     $DB->begin();
     // Delete group permissions of the current group
     $GroupSettings =& $this->get_GroupSettings();
     $GroupSettings->delete($this->ID);
     $GroupSettings->dbupdate($this->ID);
     parent::dbdelete($Messages);
     $DB->commit();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:14,代码来源:_group.class.php

示例5: dbdelete

 /**
  * Delete a blog and dependencies from database
  *
  * Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
  *
  * @param boolean true if you want to echo progress
  */
 function dbdelete($echo = false)
 {
     global $DB, $Messages, $Plugins;
     // Try to obtain some serious time to do some serious processing (5 minutes)
     set_max_execution_time(300);
     // Note: No need to localize the status messages...
     if ($echo) {
         echo '<p>MySQL 3.23 compatibility mode!';
     }
     $DB->begin();
     // Get list of cats that are going to be deleted (3.23)
     if ($echo) {
         echo '<br />Getting category list to delete... ';
     }
     $cat_list = implode(',', $DB->get_col("\n\t\t\t\tSELECT cat_ID\n\t\t\t\t  FROM T_categories\n\t\t\t\t WHERE cat_blog_ID = {$this->ID}"));
     if (empty($cat_list)) {
         // There are no cats to delete
         if ($echo) {
             echo 'None!';
         }
     } else {
         // Delete the cats & dependencies
         // Get list of posts that are going to be deleted (3.23)
         if ($echo) {
             echo '<br />Getting post list to delete... ';
         }
         $post_list = implode(',', $DB->get_col("\n\t\t\t\t\tSELECT postcat_post_ID\n\t\t\t\t\t  FROM T_postcats\n\t\t\t\t\t WHERE postcat_cat_ID IN ({$cat_list})"));
         if (empty($post_list)) {
             // There are no posts to delete
             if ($echo) {
                 echo 'None!';
             }
         } else {
             // Delete the posts & dependencies
             // TODO: There's also a constraint FK_post_parent_ID..
             // Delete postcats
             if ($echo) {
                 echo '<br />Deleting post-categories... ';
             }
             $ret = $DB->query("DELETE FROM T_postcats\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE postcat_cat_ID IN ({$cat_list})");
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted post-categories'), 'success');
             // Delete comments
             if ($echo) {
                 echo '<br />Deleting comments on blog\'s posts... ';
             }
             $comments_list = implode(',', $DB->get_col("\n\t\t\t\t\t\tSELECT comment_ID\n\t\t\t\t\t\t  FROM T_comments\n\t\t\t\t\t\t WHERE comment_post_ID IN ({$post_list})"));
             if (!empty($comments_list)) {
                 // Delete the comments & dependencies
                 $DB->query("DELETE FROM T_comments__votes\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE cmvt_cmt_ID IN ({$comments_list})");
                 $ret = $DB->query("DELETE FROM T_comments\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE comment_post_ID IN ({$post_list})");
             } else {
                 // No comments in this blog
                 $ret = 0;
             }
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted comments on blog\'s posts'), 'success');
             // Delete posts
             if ($echo) {
                 echo '<br />Deleting blog\'s posts... ';
             }
             $DB->query("DELETE FROM T_items__itemtag\n\t\t\t\t\t\t\t\t\t\t\tWHERE itag_itm_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_items__item_settings\n\t\t\t\t\t\t\t\t\t\t\tWHERE iset_item_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_items__prerendering\n\t\t\t\t\t\t\t\t\t\t\tWHERE itpr_itm_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_items__status\n\t\t\t\t\t\t\t\t\t\t\tWHERE pst_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_items__subscriptions\n\t\t\t\t\t\t\t\t\t\t\tWHERE isub_item_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_items__version\n\t\t\t\t\t\t\t\t\t\t\tWHERE iver_itm_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_links\n\t\t\t\t\t\t\t\t\t\t\tWHERE link_itm_ID IN ({$post_list})");
             $DB->query("DELETE FROM T_slug\n\t\t\t\t\t\t\t\t\t\t\tWHERE slug_itm_ID IN ({$post_list})");
             $ret = $DB->query("DELETE FROM T_items__item\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE post_ID IN ({$post_list})");
             if ($echo) {
                 printf('(%d rows)', $ret);
             }
             $Messages->add(T_('Deleted blog\'s posts'), 'success');
         }
         // / are there posts?
         // Delete categories
         if ($echo) {
             echo '<br />Deleting blog\'s categories... ';
         }
         $ret = $DB->query("DELETE FROM T_categories\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE cat_blog_ID = {$this->ID}");
         if ($echo) {
             printf('(%d rows)', $ret);
         }
         $Messages->add(T_('Deleted blog\'s categories'), 'success');
     }
     // / are there cats?
     // Delete the blog cache folder - try to delete even if cache is disabled
     load_class('_core/model/_pagecache.class.php', 'PageCache');
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_blog.class.php

示例6: dbdelete

    /**
     * Trigger event AfterCommentDelete after calling parent method.
     *
     * @param boolean set true to force permanent delete, leave false otherwise
     * @param boolean TRUE to use transaction
     * @return boolean true on success
     */
    function dbdelete($force_permanent_delete = false, $use_transaction = true)
    {
        global $Plugins, $DB;
        if ($use_transaction) {
            $DB->begin();
        }
        $was_published = $this->is_published();
        if ($this->status != 'trash') {
            // The comment was not recycled yet
            if ($this->has_replies()) {
                // Move the replies to the one level up
                $new_parent_ID = !empty($this->in_reply_to_cmt_ID) ? $DB->quote($this->in_reply_to_cmt_ID) : 'NULL';
                $DB->query('UPDATE T_comments
				    SET comment_in_reply_to_cmt_ID = ' . $new_parent_ID . '
				  WHERE comment_in_reply_to_cmt_ID = ' . $this->ID);
            }
        }
        if ($force_permanent_delete || $this->status == 'trash' || $this->is_meta()) {
            // remember ID, because parent method resets it to 0
            $old_ID = $this->ID;
            if ($r = parent::dbdelete()) {
                // re-set the ID for the Plugin event
                $this->ID = $old_ID;
                $Plugins->trigger_event('AfterCommentDelete', $params = array('Comment' => &$this));
                $this->ID = 0;
            }
        } else {
            // don't delete, just move to the trash:
            $this->set('status', 'trash');
            $r = $this->dbupdate();
        }
        if ($r) {
            if ($was_published) {
                // Update last touched date of item if a published comment was deleted
                $this->update_last_touched_date();
            }
            if ($use_transaction) {
                $DB->commit();
            }
        } else {
            if ($use_transaction) {
                $DB->rollback();
            }
        }
        return $r;
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:53,代码来源:_comment.class.php

示例7: dbdelete

    /**
     * Delete message and dependencies from database
     *
     * @param Log Log object where output gets added (by reference).
     */
    function dbdelete()
    {
        global $DB;
        if ($this->ID == 0) {
            debug_die('Non persistant object cannot be deleted!');
        }
        // Remember ID, because parent method resets it to 0
        $thread_ID = $this->thread_ID;
        $DB->begin();
        // UPDATE last unread msg_ID on this thread statuses from this message ID to the next message ID or NULL if there is no next message
        $DB->query('UPDATE T_messaging__threadstatus
						SET tsta_first_unread_msg_ID =
							( SELECT msg_ID
								FROM T_messaging__message
								WHERE msg_thread_ID = ' . $thread_ID . ' AND msg_datetime > ' . $DB->quote($this->datetime) . '
								ORDER BY msg_datetime ASC
								LIMIT 1
							)
						WHERE tsta_first_unread_msg_ID = ' . $this->ID);
        // Delete Message
        if (!parent::dbdelete()) {
            $DB->rollback();
            return false;
        }
        // Get a count of the messages in the current thread
        $SQL = new SQL();
        $SQL->SELECT('COUNT( msg_ID )');
        $SQL->FROM($this->dbtablename);
        $SQL->WHERE('msg_thread_ID = ' . $DB->quote($thread_ID));
        $msg_count = $DB->get_var($SQL->get());
        if ($msg_count == 0) {
            // Last message was deleted from thread now, We should also delete this thread
            load_class('messaging/model/_thread.class.php', 'Thread');
            $ThreadCache =& get_ThreadCache();
            $Thread =& $ThreadCache->get_by_ID($thread_ID);
            $Thread->dbdelete();
        }
        $DB->commit();
        return true;
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:45,代码来源:_message.class.php

示例8: dbdelete

    /**
     * Delete user and dependencies from database
     *
     * Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
     *
     * @param Log Log object where output gets added (by reference).
     */
    function dbdelete(&$Log)
    {
        global $DB, $Plugins;
        if ($this->ID == 0) {
            debug_die('Non persistant object cannot be deleted!');
        }
        $deltype = param('deltype', 'string', '');
        // spammer
        $DB->begin();
        if ($deltype == 'spammer') {
            // If we delete user as spammer we should delete private messaged of this user
            $this->init_relations(true);
        } else {
            // If we delete user as not spammer we keep his comments as from anonymous user
            // Transform registered user comments to unregistered:
            $ret = $DB->query('UPDATE T_comments
													SET comment_author_user_ID = NULL,
															comment_author = ' . $DB->quote($this->get('preferredname')) . ',
															comment_author_email = ' . $DB->quote($this->get('email')) . ',
															comment_author_url = ' . $DB->quote($this->get('url')) . '
													WHERE comment_author_user_ID = ' . $this->ID);
            if (is_a($Log, 'log')) {
                $Log->add('Transforming user\'s comments to unregistered comments... ' . sprintf('(%d rows)', $ret), 'note');
            }
        }
        // remember ID, because parent method resets it to 0
        $old_ID = $this->ID;
        $old_email = $this->get('email');
        // Delete main object:
        if (!parent::dbdelete()) {
            $DB->rollback();
            $Log->add('User has not been deleted.', 'error');
            return false;
        }
        if ($deltype == 'spammer') {
            // User was deleted as spammer, we should mark email of this user as 'Spammer'
            $EmailAddressCache =& get_EmailAddressCache();
            $EmailAddress =& $EmailAddressCache->get_by_name($old_email, false, false);
            if (!$EmailAddress) {
                // Create new record in the T_email_address table
                $EmailAddress = new EmailAddress();
                $EmailAddress->set('address', $old_email);
            }
            if (!empty($EmailAddress)) {
                // Save status of an email address
                $EmailAddress->set('status', 'spammer');
                $EmailAddress->dbsave();
            }
        }
        $DB->commit();
        if (is_a($Log, 'log')) {
            $Log->add('Deleted User.', 'note');
        }
        // Notify plugins:
        $this->ID = $old_ID;
        $Plugins->trigger_event('AfterUserDelete', $params = array('User' => &$this));
        $this->ID = 0;
        // BLOCK CACHE INVALIDATION:
        // This User has been modified, cached content depending on it should be invalidated:
        BlockCache::invalidate_key('user_ID', $old_ID);
        return true;
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:69,代码来源:_user.class.php

示例9: dbdelete

 /**
  * Delete message and dependencies from database
  *
  * @param Log Log object where output gets added (by reference).
  */
 function dbdelete()
 {
     if ($this->ID == 0) {
         debug_die('Non persistant object cannot be deleted!');
     }
     return parent::dbdelete();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:12,代码来源:_message.class.php

示例10: dbdelete

    /**
     * Delete user and dependencies from database
     *
     * Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
     *
     * @param Log Log object where output gets added (by reference).
     */
    function dbdelete(&$Log)
    {
        global $DB, $Plugins;
        if ($this->ID == 0) {
            debug_die('Non persistant object cannot be deleted!');
        }
        $deltype = param('deltype', 'string', '');
        // spammer
        $DB->begin();
        if ($deltype == 'spammer') {
            // If we delete user as spammer we should delete private messaged of this user
            $this->delete_messages();
        } else {
            // If we delete user as not spammer we keep his comments as from anonymous user
            // Transform registered user comments to unregistered:
            $ret = $DB->query('UPDATE T_comments
													SET comment_author_ID = NULL,
															comment_author = ' . $DB->quote($this->get('preferredname')) . ',
															comment_author_email = ' . $DB->quote($this->get('email')) . ',
															comment_author_url = ' . $DB->quote($this->get('url')) . '
													WHERE comment_author_ID = ' . $this->ID);
            if (is_a($Log, 'log')) {
                $Log->add('Transforming user\'s comments to unregistered comments... ' . sprintf('(%d rows)', $ret), 'note');
            }
        }
        // Get list of posts that are going to be deleted (3.23)
        $post_list = implode(',', $DB->get_col('
				SELECT post_ID
				  FROM T_items__item
				 WHERE post_creator_user_ID = ' . $this->ID));
        if (!empty($post_list)) {
            // Delete comments
            $ret = $DB->query("DELETE FROM T_comments\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE comment_post_ID IN ({$post_list})");
            if (is_a($Log, 'log')) {
                $Log->add(sprintf('Deleted %d comments on user\'s posts.', $ret), 'note');
            }
            // Delete post extracats
            $ret = $DB->query("DELETE FROM T_postcats\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE postcat_post_ID IN ({$post_list})");
            if (is_a($Log, 'log')) {
                $Log->add(sprintf('Deleted %d extracats of user\'s posts\'.', $ret));
                // TODO: geeky wording.
            }
            // Posts will we auto-deleted by parent method
        } else {
            // no posts
            if (is_a($Log, 'log')) {
                $Log->add('No posts to delete.', 'note');
            }
        }
        // Get list of sessions that are going to be deleted
        $sessions_SQL = new SQL();
        $sessions_SQL->SELECT('sess_ID');
        $sessions_SQL->FROM('T_sessions');
        $sessions_SQL->WHERE('sess_user_ID = ' . $this->ID);
        $sessions_list = $DB->get_col($sessions_SQL->get());
        if (!empty($sessions_list)) {
            // Delete all hit logs of this user
            $DB->query('DELETE FROM T_hitlog
					WHERE hit_sess_ID IN ( ' . $DB->quote($sessions_list) . ' )');
        }
        // delete user involved ophan threads
        delete_orphan_threads($this->ID);
        // Remove this user from posts where it was as last edit user
        $DB->query('UPDATE T_items__item
								    SET post_lastedit_user_ID = NULL
								  WHERE post_lastedit_user_ID = ' . $this->ID);
        $DB->query('UPDATE T_items__version
								    SET iver_edit_user_ID = NULL
								  WHERE iver_edit_user_ID = ' . $this->ID);
        // Remove this user from links where it was as last edit user
        $DB->query('UPDATE T_links
								    SET link_lastedit_user_ID = NULL
								  WHERE link_lastedit_user_ID = ' . $this->ID);
        // remember ID, because parent method resets it to 0
        $old_ID = $this->ID;
        $old_email = $this->get('email');
        // Delete main object:
        if (!parent::dbdelete()) {
            $DB->rollback();
            $Log->add('User has not been deleted.', 'error');
            return false;
        }
        // user was deleted, also delete this user's media folder recursively
        $FileRootCache =& get_FileRootCache();
        $root_directory = $FileRootCache->get_root_dir('user', $old_ID);
        rmdir_r($root_directory);
        if ($deltype == 'spammer') {
            // User was deleted as spammer, we should mark email of this user as 'Spammer'
            load_class('tools/model/_emailblocked.class.php', 'EmailBlocked');
            $EmailBlockedCache =& get_EmailBlockedCache();
            $EmailBlocked =& $EmailBlockedCache->get_by_name($old_email, false, false);
            if (!$EmailBlocked) {
                // Create new record in the T_email_blocked table
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_user.class.php

示例11: dbdelete

    /**
     * Delete thread and dependencies from database
     */
    function dbdelete()
    {
        global $DB;
        if ($this->ID == 0) {
            debug_die('Non persistant object cannot be deleted!');
        }
        $DB->begin();
        // Delete Messages
        $ret = $DB->query('DELETE FROM T_messaging__message
												WHERE msg_thread_ID=' . $this->ID);
        // Delete Statuses
        $ret = $DB->query('DELETE FROM T_messaging__threadstatus
												WHERE tsta_thread_ID=' . $this->ID);
        // Delete Thread
        if (!parent::dbdelete()) {
            $DB->rollback();
            return false;
        }
        $DB->commit();
        return true;
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:24,代码来源:_thread.class.php

示例12: dbdelete

 /**
  * Delete a blog and dependencies from database
  *
  * @param boolean true if you want to echo progress
  */
 function dbdelete($echo = false)
 {
     global $DB, $Messages, $Plugins, $Settings;
     // Try to obtain some serious time to do some serious processing (5 minutes)
     set_max_execution_time(300);
     if ($echo) {
         echo 'Delete collection with all of it\'s content... ';
     }
     // remember ID, because parent method resets it to 0
     $old_ID = $this->ID;
     // Delete main (blog) object:
     if (!parent::dbdelete()) {
         $Messages->add('Blog has not been deleted.', 'error');
         return false;
     }
     // Delete the blog cache folder - try to delete even if cache is disabled
     load_class('_core/model/_pagecache.class.php', 'PageCache');
     $PageCache = new PageCache($this);
     $PageCache->cache_delete();
     // Delete blog's media folder recursively:
     $FileRootCache =& get_FileRootCache();
     if ($root_directory = $FileRootCache->get_root_dir('collection', $old_ID)) {
         // Delete the folder only when it is detected
         rmdir_r($root_directory);
         $Messages->add(T_('Deleted blog\'s files'), 'success');
     }
     // re-set the ID for the Plugin event
     $this->ID = $old_ID;
     $Plugins->trigger_event('AfterCollectionDelete', $params = array('Blog' => &$this));
     $this->ID = 0;
     if (isset($Settings)) {
         // Reset settings related to the deleted blog
         if ($Settings->get('default_blog_ID') == $old_ID) {
             // Reset default blog ID
             $Settings->set('default_blog_ID', 0);
         }
         if ($Settings->get('info_blog_ID') == $old_ID) {
             // Reset info blog ID
             $Settings->set('info_blog_ID', 0);
         }
         if ($Settings->get('login_blog_ID') == $old_ID) {
             // Reset login blog ID
             $Settings->set('login_blog_ID', 0);
         }
         if ($Settings->get('msg_blog_ID') == $old_ID) {
             // Reset messaging blog ID
             $Settings->set('msg_blog_ID', 0);
         }
         $Settings->dbupdate();
     }
     if ($echo) {
         echo '<br />Done.</p>';
     }
     return true;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:60,代码来源:_blog.class.php

示例13: dbdelete

 /**
  * Delete object from DB.
  *
  * @return boolean true on success, false on failure to update
  */
 function dbdelete()
 {
     global $DB;
     // Save old extensions and old mimetype to update file types after deleting
     $this->old_extensions = $this->extensions;
     $this->extensions = '';
     $this->old_mimetype = $this->mimetype;
     $this->mimetype = '';
     $DB->begin();
     if (($r = parent::dbdelete()) !== false) {
         // Update types of the Files
         $this->update_file_types();
         $DB->commit();
     } else {
         $DB->rollback();
     }
     return $r;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:23,代码来源:_filetype.class.php

示例14: dbdelete

 /**
  * Trigger event AfterCommentDelete after calling parent method.
  *
  * @return boolean true on success
  */
 function dbdelete()
 {
     global $Plugins;
     // remember ID, because parent method resets it to 0
     $old_ID = $this->ID;
     if ($r = parent::dbdelete()) {
         // re-set the ID for the Plugin event
         $this->ID = $old_ID;
         $Plugins->trigger_event('AfterCommentDelete', $params = array('Comment' => &$this));
         $this->ID = 0;
     }
     return $r;
 }
开发者ID:LFSF,项目名称:oras,代码行数:18,代码来源:_comment.class.php

示例15: dbdelete

    /**
     * Delete user and dependencies from database
     *
     * Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
     *
     * @param Log Log object where output gets added (by reference).
     */
    function dbdelete(&$Log)
    {
        global $DB, $Plugins;
        if ($this->ID == 0) {
            debug_die('Non persistant object cannot be deleted!');
        }
        $DB->begin();
        // Transform registered user comments to unregistered:
        $ret = $DB->query('UPDATE T_comments
												SET comment_author_ID = NULL,
														comment_author = ' . $DB->quote($this->get('preferredname')) . ',
														comment_author_email = ' . $DB->quote($this->get('email')) . ',
														comment_author_url = ' . $DB->quote($this->get('url')) . '
												WHERE comment_author_ID = ' . $this->ID);
        if (is_a($Log, 'log')) {
            $Log->add('Transforming user\'s comments to unregistered comments... ' . sprintf('(%d rows)', $ret), 'note');
        }
        // Get list of posts that are going to be deleted (3.23)
        $post_list = implode(',', $DB->get_col('
				SELECT post_ID
				  FROM T_items__item
				 WHERE post_creator_user_ID = ' . $this->ID));
        if (!empty($post_list)) {
            // Delete comments
            $ret = $DB->query("DELETE FROM T_comments\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE comment_post_ID IN ({$post_list})");
            if (is_a($Log, 'log')) {
                $Log->add(sprintf('Deleted %d comments on user\'s posts.', $ret), 'note');
            }
            // Delete post extracats
            $ret = $DB->query("DELETE FROM T_postcats\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE postcat_post_ID IN ({$post_list})");
            if (is_a($Log, 'log')) {
                $Log->add(sprintf('Deleted %d extracats of user\'s posts\'.', $ret));
                // TODO: geeky wording.
            }
            // Posts will we auto-deleted by parent method
        } else {
            // no posts
            if (is_a($Log, 'log')) {
                $Log->add('No posts to delete.', 'note');
            }
        }
        // remember ID, because parent method resets it to 0
        $old_ID = $this->ID;
        // Delete main object:
        if (!parent::dbdelete()) {
            $DB->rollback();
            $Log->add('User has not been deleted.', 'error');
            return false;
        }
        $DB->commit();
        if (is_a($Log, 'log')) {
            $Log->add('Deleted User.', 'note');
        }
        // Notify plugins:
        $this->ID = $old_ID;
        $Plugins->trigger_event('AfterUserDelete', $params = array('User' => &$this));
        $this->ID = 0;
        return true;
    }
开发者ID:LFSF,项目名称:oras,代码行数:66,代码来源:_user.class.php


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