ImportModel::deleteOverwriteTables PHP Method

deleteOverwriteTables() public method

Remove the data from the appropriate tables when we are overwriting the forum.
    public function deleteOverwriteTables()
    {
        $Tables = array('Activity', 'Category', 'Comment', 'Conversation', 'ConversationMessage', 'Discussion', 'Draft', 'Invitation', 'Media', 'Message', 'Photo', 'Permission', 'Rank', 'Poll', 'PollOption', 'PollVote', 'Role', 'UserAuthentication', 'UserComment', 'UserConversation', 'UserDiscussion', 'UserMeta', 'UserRole');
        // Execute the SQL.
        $CurrentSubstep = val('CurrentSubstep', $this->Data, 0);
        for ($i = $CurrentSubstep; $i < count($Tables); $i++) {
            $Table = $Tables[$i];
            // Make sure the table exists.
            $Exists = Gdn::structure()->table($Table)->tableExists();
            Gdn::structure()->reset();
            if (!$Exists) {
                continue;
            }
            $this->Data['CurrentStepMessage'] = $Table;
            if ($Table == 'Permission') {
                $this->SQL->delete($Table, array('RoleID <>' => 0));
            } else {
                $this->SQL->truncate($Table);
            }
            if ($this->Timer->elapsedTime() > $this->MaxStepTime) {
                // The step's taken too long. Save the state and return.
                $this->Data['CurrentSubstep'] = $i + 1;
                return false;
            }
        }
        if (isset($this->Data['CurrentSubstep'])) {
            unset($this->Data['CurrentSubstep']);
        }
        $this->Data['CurrentStepMessage'] = '';
        return true;
    }