[wp-trac] Re: [WordPress Trac] #5860: Activating plugin that uses upgrade functions (dbDelta) fails

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 14 22:11:17 GMT 2008


#5860: Activating plugin that uses upgrade functions (dbDelta) fails
----------------------------+-----------------------------------------------
 Reporter:  jhodgdon        |        Owner:  anonymous
     Type:  defect          |       Status:  new      
 Priority:  normal          |    Milestone:  2.5      
Component:  Administration  |      Version:  2.5      
 Severity:  critical        |   Resolution:           
 Keywords:                  |  
----------------------------+-----------------------------------------------
Comment (by jhodgdon):

 Ah, that explains it!

 I am now able to fix the issue with my plugin (the real one, which creates
 tables) loading. To do this, I had to add two global declarations in the
 plugin file (for variables defined at global scope and used within the
 activation function), and also one line to the top of schema.php saying:

     global $wpdb;

 I'll put in a patch for that, as it should be innocuous for normal use.

 Thanks for the clue! I never would have figured out it was non-global
 scope causing the problems... this seems like a major change, but I think
 I understand why.

 By the way, if there *is* an error during the calling of the plugin
 activation function, the plugin does get loaded twice. Do you want me to
 file a separate bug report on that? It means the error message is bogus
 (as in my report, above).

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5860#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list