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

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 15 08:44:17 GMT 2008


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

 The solution is not found with adding global declarations to scheme.php,
 but in the functions that include scheme.php from within that function's
 scope. The only reason you would have to declare $wpdb global is if
 wpdb.php hasn't been included yet and $wpdb doesn't exist, or it is within
 function or method scope.

 The short term solution of adding global definition (when the scope is
 already global) is hackish at best and points the source of the problem
 away from the root of the problem.

 I would suggest that if it is a problem, then search for scheme.php in the
 files and write a patch which solves the problem (the better long term
 solution).

 I think the best solution would be to just move that function out of
 scheme.php into functions.php since it is useful enough to plugin
 developers that it should be available without having to require_once()
 the file. I would love to have that function, but I usually build a custom
 solution myself.

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


More information about the wp-trac mailing list