We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Unable to locate the files needed to install this module

Development and Programming

eeart's avatar
eeart
257 posts
16 years ago
eeart's avatar eeart

I am trying to convert a module to work with EE 2.0 but it is not going very well. When I click Install I immediately get the error “Unable to locate the files needed to install this module”.

Is there a way to find out what file it cannot locate?

I followed the instructions from http://expressionengine.com/public_beta/docs/development/conversion/modules.html and I created the upd file. Does this error indicate that there is something wrong in my upd file? Or can it not find something else?

       
eeart's avatar
eeart
257 posts
16 years ago
eeart's avatar eeart

Is there someone who can help me with this?

Thanks.

       
Hop Studios's avatar
Hop Studios
500 posts
16 years ago
Hop Studios's avatar Hop Studios

eeart,

Probably you need to make sure there’s an upd.MODULE.EXT file even if it’s an initial version. That has to be there.

Otherwise, look at Addons_installer.php and figure out which instance of “module_can_not_be_found” is being triggered.

TTFN Travis

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
16 years ago
ErwinVanLun's avatar ErwinVanLun

.

       
eeart's avatar
eeart
257 posts
16 years ago
eeart's avatar eeart

Thank you Hop Studios. Today we figured out that we had to put the module files in the third_party folder instead of the modules folder. That fixed the “Unable to locate the files needed to install this module” error.

However, it still is not working very well. It looks like it is installed now, but it still says “Not installed” on the modules page. When I click Install again it says that the tables already exist, so it is somehow installed. When using the module in a template it also says that the tag cannot be processed. Looks like it needs some more work. 😉

I wish I had an empty template module for EE 2.0 with all the files needed and install/uninstall functions where I can fill in my own code. That would be handy to start with and check if I am missing anything.

       
Gwarrior's avatar
Gwarrior
40 posts
16 years ago
Gwarrior's avatar Gwarrior

Below is a sample of a working module I have built. Specifically, it is the upd.contactmanager.php file. In it, I create two databases (one for contact information, one for metadata about the contacts). Do a CTRL-F (find) and select all “contactmanager“‘s, then replace with the name of your module.

Also, please read the code as it’s thoroughly documented:

<?php

class Contactmanager_upd { 

    var $version        = '1.0'; 
    

    // constructor initiates on load, loading the EE super global
    function Contactmanager_upd() 
    { 
        $this->EE =& get_instance();
    }
    
    // upon hitting "install" on the module manager, this next function executes
    // by creating 2 databases for the module and inserts your module into
    // the "exp_modules" db
    function install() {
        
        // define type of module by assigning array keys
        $data = array(
        'module_name' => 'Contactmanager' ,
        'module_version' => $this->version,
        'has_cp_backend' => 'y',
        'has_publish_fields' => 'y'
    );
        
        // insert array above into modules to register your module as installed
    $this->EE->db->insert('modules', $data);
    
    $data = array(
        'class'        => 'Contactmanager' ,
        'method'    => 'accept_contact'
    );
      
        // assign your "class actions"
    $this->EE->db->insert('actions', $data);

        // define fields in an array by key
    $fields = array(
        'contact_id'    => array('type' => 'int', 'constraint' => '10', 'unsigned' => TRUE, 'auto_increment' => TRUE),
        'contact_type'    => array('type' => 'varchar', 'constraint' => '70'),
        'contact_name'    => array('type' => 'varchar', 'constraint' => '70'),
        'contact_company'    => array('type' => 'varchar', 'constraint' => '70', 'null' => TRUE, 'default' => NULL),
        'contact_phone'    => array('type' => 'varchar', 'constraint' => '35', 'null' => TRUE, 'default' => NULL),
        'contact_email'    => array('type' => 'varchar', 'constraint' => '250', 'null' => TRUE, 'default' => NULL),
        'contact_message'    => array('type' => 'varchar', 'constraint' => '2000', 'null' => TRUE, 'default' => NULL),
        'member_access'    => array('type' => 'varchar', 'constraint' => '250', 'default' => 'all')
        );

    $this->EE->load->dbforge();

    $this->EE->dbforge->add_field($fields);
    $this->EE->dbforge->add_key('contact_id', TRUE);
  
        // after dbforge is loaded, create the table with fields data above
    $this->EE->dbforge->create_table('contacts');
    
    $fields2 = array(
        'contact_meta_id'    => array('type' => 'int', 'constraint' => '10', 'unsigned' => TRUE, 'auto_increment' => TRUE),
        'contact_id'    => array('type' => 'int', 'constraint' => '10'),
        'notes'    => array('type' => 'varchar', 'constraint' => '2000', 'null' => TRUE, 'default' => NULL),
        'member_access'    => array('type' => 'varchar', 'constraint' => '250', 'default' => 'all')
        );
        
    $this->EE->dbforge->add_field($fields2);
    $this->EE->dbforge->add_key('contact_meta_id', TRUE);

    $this->EE->dbforge->create_table('contacts_meta');
    
    return TRUE;
        
    }
    
    // when you uninstall, this function is executed. it essentially deletes any records
    // of your module that you created. make sure it foils your "install" function
    function uninstall() {
        
        $this->EE->load->dbforge();

        $this->EE->db->select('module_id');
        $query = $this->EE->db->get_where('modules', array('module_name' => 'Contactmanager'));
    
        $this->EE->db->where('module_id', $query->row('module_id'));
        $this->EE->db->delete('module_member_groups');
    
        $this->EE->db->where('module_name', 'Contactmanager');
        $this->EE->db->delete('modules');
    
        $this->EE->db->where('class', 'Contactmanager');
        $this->EE->db->delete('actions');
    
        $this->EE->dbforge->drop_table('contacts');        
        
        $this->EE->dbforge->drop_table('contacts_meta');        
    
        // Required if your module includes fields on the publish page
    
        return TRUE;

    }
    
}
    
?>

Hope that helps.

       
Gwarrior's avatar
Gwarrior
40 posts
16 years ago
Gwarrior's avatar Gwarrior

Also, use phpMyAdmin to get into your expression engine database and delete whatever database you created before. In this case, it would have been “contacts” and “contacts_meta”.

       
eeart's avatar
eeart
257 posts
16 years ago
eeart's avatar eeart

Thank you Gwarrior. My upd file has this structure. After I click “Install” it correctly creates the table and adds a row to exp_modules, but then it returns to the Modules page with status still set to “Not installed”. If I click Install again it will add another row to exp_modules and will try to create the table again, which isn’t good.

Also the version column doesn’t get filled in even though I do have the $version set at the top of the upd class. I don’t understand why this doesn’t work. What needs to happen for EE to see a module as installed?

       
eeart's avatar
eeart
257 posts
16 years ago
eeart's avatar eeart

This is fixed … I found out that the module_name inserted into exp_modules was not correct. Now it recognizes it as installed.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.