EllisLab text mark
Advanced Search
     
FATAL ERROR on enabling extensions in EE2
Posted: 05 May 2010 08:00 PM   [ Ignore ]
Avatar
Joined: 2006-11-20
162 posts

I’m trying to create an extension for EE2 and get a fatal error when I try to enable my new extension.

The error is:

Fatal errorCall to a member function insert_string() on a non-object in /path/to/expressionengine/third_party/[extension_name]/ext.[extension_name].php  on line 33 

That line corresponds to the activate_extension function:

function activate_extension() {
            
global $DB;
            
            
$DB->query($DB->insert_string('exp_extensions',
                                          array(
                                                
'extension_id' => '',
                                                
'class'        => $this->class_name,
                                                
'method'       => "add_libraries",
                                                
'hook'         => "publish_form_headers",
                                                
'settings'     => "",
                                                
'priority'     => 10,
                                                
'version'      => $this->version,
                                                
'enabled'      => "y"
                                              
)
                                         )
                      );
        

Line 33 is the $DB->query($DB->insert_string(‘exp_extensions’... line.

Anyone had this happen?

Thanks in advance!

-Brett

 
Posted: 05 May 2010 09:22 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-11-20
162 posts

Ah, apparently the EE2 version of this is:

$this->EE->db->insert('exp_extensions'

Problem solved.  Documentation for EE2 should probably be updated with this though.

 
Posted: 05 May 2010 09:38 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-03
121 posts

The documentation is good smile
Maybe you where looking at the wrong one.
http://expressionengine.com/public_beta/docs/
http://expressionengine.com/public_beta/docs/development/usage/database.html#inserting

bdewoody - 06 May 2010 01:22 AM

Ah, apparently the EE2 version of this is:

$this->EE->db->insert('exp_extensions'

Problem solved.  Documentation for EE2 should probably be updated with this though.

 Signature 

http://www.devdemon.com
http://twitter.com/devdemon


Updater - Update EE & Addon
Channel Images - Best Image Management Available
Channel Files - Upload multiple files with progressbar! S3/Cloudfiles support.
Channel Ratings - Rate Entries & Comments, Like/Unlike also supported
Forms - Best Forms Module (Drag & Drop)

 
Posted: 05 May 2010 09:44 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-11-20
162 posts

I was looking at the Extension Development docs (http://expressionengine.com/public_beta/docs/development/extensions.html) which gave an example as:

// --------------------------------
//  Activate Extension
// --------------------------------

function activate_extension()
{
    
global $DB;
    
    
$DB->query($DB->insert_string('exp_extensions',
                                  array(
                                        
'extension_id' => '',
                                        
'class'        => "Example_ext",
                                        
'method'       => "rewrite_admin_home",
                                        
'hook'         => "admin_home_page_start",
                                        
'settings'     => "",
                                        
'priority'     => 10,
                                        
'version'      => $this->version,
                                        
'enabled'      => "y"
                                      
)
                                 )
              );
}
// END