HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Stuck on an error in the importer.

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#80634 (In Topic #16358)
Avatar

Community saint

Ok I have wokred ou tmost of the kinks in this new importer but I am at a loss to whats going on with this final error and could use some guidance:

Here is Stack Trace:

Code

PHP NOTICE [8] Undefined index: vote_cast in sources\hooks\modules\admin_import\ravenuke2_4.php on line 1560 (version: 7.1.5, PHP version: 5.3.0, URL: /rn24Test/adminzone/index.php?page=admin_import&type=import&session=5117145&importer=ravenuke2_4)

Here is the stack trace:Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check ocPortal website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File'C:\\wamp\\www\\rn24Test\\sources\\failure.php'Line'674'Function'get_html_trace'Args
File'C:\\wamp\\www\\rn24Test\\sources\\global2.php'Line'969'Function'_fatal_exit'Args
'PHP NOTICE [8] Undefined index: vote_cast in sources\\hooks\\modules\\admin_import\\ravenuke2_4.php on line 1560'


File'C:\\wamp\\www\\rn24Test\\sources\\failure.php'Line'214'Function'fatal_exit'Args
'PHP NOTICE [8] Undefined index: vote_cast in sources\\hooks\\modules\\admin_import\\ravenuke2_4.php on line 1560'


File'C:\\wamp\\www\\rn24Test\\sources\\global2.php'Line'843'Function'_ocportal_error_handler'Args
'notice'

8

'Undefined index: vote_cast'

'sources\\hooks\\modules\\admin_import\\ravenuke2_4.php'

1560


File'C:\\wamp\\www\\rn24Test\\sources\\hooks\\modules\\admin_import\\ravenuke2_4.php'Line'1,560'Function'ocportal_error_handler'Args...
Function'import_ocf_polls_and_votes'Class'Hook_ravenuke2_4'ObjectHook_ravenuke2_4::__set_state(array( ))Type'->'Args...'nuke'

'C:\\wamp\\www\\rn24Test'


File'C:\\wamp\\www\\rn24Test\\adminzone\\pages\\modules\\admin_import.php'Line'612'Function'call_user_func_array'Args...
File'C:\\wamp\\www\\rn24Test\\adminzone\\pages\\modules\\admin_import.php'Line'156'Function'do_import'Class'Module_admin_import'ObjectModule_admin_import::__set_state(array( ))Type'->'Args
File'C:\\wamp\\www\\rn24Test\\sources\\zones.php'Line'386'Function'run'Class'Module_admin_import'ObjectModule_admin_import::__set_state(array( ))Type'->'Args
File'C:\\wamp\\www\\rn24Test\\sources\\site.php'Line'970'Function'load_module_page'Args
'adminzone/pages/modules/admin_import.php'

'admin_import'


File'C:\\wamp\\www\\rn24Test\\sources\\site.php'Line'753'Function'request_page'Args
'admin_import'

true


File'C:\\wamp\\www\\rn24Test\\adminzone\\index.php'Line'51'Function'do_site'Args 

And here is the section of Code pertaining to it:

Code

    /**
     * Standard import function.
     *
     * @param  object            The DB connection to import from
     * @param  string            The table prefix the target prefix is using
     * @param  PATH            The base directory we are importing from
     */
    function import_ocf_polls_and_votes($db,$table_prefix,$file_base)
    {
        $rows=$db->query('SELECT * FROM '.$table_prefix.'_bbvote_desc');
        foreach ($rows as $row)
        {
            if (import_check_if_imported('poll',strval($row['vote_id']))) continue;

            $topic_id=import_id_remap_get('topic',strval($row['topic_id']),true);
            if (is_null($topic_id))
            {
                import_id_remap_put('poll',strval($row['vote_id']),-1);
                continue;
            }

            $is_open=($row['vote_start']>time()) && (($row['vote_length']==0) || (($row['vote_start']+$row['vote_length'])<time()));

            $rows2=$db->query('SELECT * FROM '.$table_prefix.'_bbvote_results WHERE vote_id='.$row['vote_id'].' ORDER BY vote_option_id');
            $answers=array();
            foreach ($rows2 as $answer)
            {
                $answers[]=$answer['vote_option_text'];
            }
            $maximum=1;

            $rows2=$db->query('SELECT * FROM '.$table_prefix.'_bbvote_voters WHERE vote_id='.$row['vote_id']);
            foreach ($rows2 as $row2)
            {
                $row2['vote_user_id']=import_id_remap_get('member',strval($row2['vote_user_id']),true);
            }

            $id_new=ocf_make_poll($topic_id,$row['vote_text'],0,$is_open?1:0,1,$maximum,0,$answers,false);

            $answers=collapse_1d_complexity('id',$GLOBALS['FORUM_DB']->query_select('f_poll_answers',array('id'),array('pa_poll_id'=>$id_new))); // Effectively, a remapping from IPB vote number to ocP vote number

            foreach ($rows2 as $row2)
            {
                $member_id=$row2['vote_user_id'];
                if ((!is_null($member_id)) && ($member_id!=0))
                {
                    if (($row2['vote_cast']==0) || (!array_key_exists($row2['vote_cast']-1,$answers)))
                    {
                        $answer=-1;
                    } else
                    {
                        $answer=$answers[$row2['vote_cast']-1];
                    }
                    $GLOBALS['FORUM_DB']->query_insert('f_poll_votes',array('pv_poll_id'=>$id_new,'pv_member_id'=>$member_id,'pv_answer_id'=>$answer));
                }
            }

            import_id_remap_put('poll',strval($row['vote_id']),$id_new);
        }
    }

Any help wold be appreciated. Thanks
Back to the top
 
Posted
Rating:
#80637
Avatar

Obvious question, is vote_cast in bbvote_voters? Or maybe a different table?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#80640
Avatar

Community saint

no vote_cast does not exist in bbvoters but I wasn't sure if it was something on ocPortals side cause $answers looks to be rebuilt with ocPortal data no?
Back to the top
 
Posted
Rating:
#80641
Avatar

The

Code

              $row2['vote_user_id']=import_id_remap_get('member',strval($row2['vote_user_id']),true);
line is just there to patch up the table's vote_user_id field according to the new user ID subsequent to import.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#80646
Avatar

Community saint

Ok so here is the dilemma Nuke does not record the users answer with the user. It records the total answers next to the poll answer option and just records the user as having voted in the poll in another table. ocPortal however records the users answer alongside the user.

Nuke poll tables (in terms of bb)

vote_desc:
vote_id
topic_id
vote_text
vote_start
vote_length

vote_results:
vote_id
vote_option_id
vote_option_text
vote_result

vote_voters
vote_id
vote_user_id
vote_user_ip

Now ocP does it this way

(I'll skip the main polls table as its obvious)

f_poll_answers:
id
pa_poll_id
pa_answer
pa_cache_num_votes

f_poll_votes:
pv_poll_id
pv_member_id
pv_answer_id

So here is the dilemma how to properly populate ocPortals tables since I can't be sure what answer the nuke user voted on? only that they did indeed vote.

I suppose I could get a total of votes for each answer in nuke and then randomly assign that answer to each user until the limit is reach for a particular answer then move on to the next answer until that limit is reached but in the end the results of user and their answers won't be accurate anyway so I dunno what do you think my be the best course of action to at least get the closest representation of accurate vote results we can?
Back to the top
 
Posted
Rating:
#80647
Avatar

Yes in the past I've had this problem and I've done as you said.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: