ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

I can't enable extension

January 12, 2012 2:17pm

Subscribe [1]
  • #1 / Jan 12, 2012 2:17pm

    hava

    2 posts

    Hello, I have created extension and it seems to be working on localhost but I can’t enable it on client website. I press enable and it again displays that it disabled. EE version v2.3.1. Ext code below

    class Wiki_comments_ext {
     
     public $settings   = array();
     public $description  = 'Enables comments for wiki module';
     public $docs_url  = '';
     public $name   = 'Wiki Comments';
     public $settings_exist = 'n';
     public $version   = '1.0';
     
     public $channel_id  = '';
     public $entry_id  = '';
     public $required_by  = array('module'); 
     
     private $EE;
     
     /**
      * Constructor
      *
      * @param  mixed Settings array or empty string if none exist.
      */
     public function __construct($settings = '')
     {
      $this->EE =& get_instance();
     }
     
     /**
      * add_to_content
      *
      * @param 
      * @return 
      */
     public function add_to_content($obj)
     {
        return $obj->return_data ;
     }
    
     private function _wiki_page_exists($url) 
     {
      return $this->EE->wiki_comments_model->wiki_page_exists($url);
     }
     
     private function _channel_exists() 
     {
      return $this->EE->wiki_comments_model->channel_exists();
     }
     
     private function _channel_title_exists($url) 
     {
      $url = $this->_validate_url_title($url);
      return  $this->EE->wiki_comments_model->channel_title_exists($url);
     }
    
     public function delete_content()
     {
      $this->EE->load->model('wiki_comments_model');
      $this->EE->wiki_comments_model->delete_content($this->channel_id, $this->EE->config->item('site_id'));
     }
     
     private function _create_wiki_channel()
     {
      return $this->EE->wiki_comments_model->create_wiki_channel($data);
     }
    
     private function _create_wiki_channel_title($url)
     {
      return  $this->EE->wiki_comments_model->create_wiki_channel_title($data);
     }
    
     private function _create_wiki_channel_data()
     {
      $this->EE->wiki_comments_model->create_wiki_channel_data($data);
     }
     
     private function _validate_url_title($url_title = '')
     {
      $word_separator = $this->EE->config->item('word_separator');
      
      $this->EE->load->helper('url');
    
      // Remove extraneous characters
      $url_title = url_title($url_title, $word_separator);
      return $url_title;
     }
    
     // ---------------------------------------------------------------------- 
     /**
      * Activate Extension
      *
      * This function enters the extension into the exp_extensions table
      *
      * @return void
      */
     public function activate_extension()
     {
      // Setup custom settings in this array.
      $this->settings = array();
      
      $data = array(
       'class'  => __CLASS__,
       'method' => 'add_to_content',
       'hook'  => 'wiki_start',
       'settings' => serialize($this->settings),
       'version' => $this->version,
       'enabled' => 'y'
      );
    
      $this->EE->db->insert('extensions', $data); 
     } 
    
     // ----------------------------------------------------------------------
    
     /**
      * Disable Extension
      *
      * This method removes information from the exp_extensions table
      *
      * @return void
      */
     function disable_extension()
     {
      $this->EE->db->where('class', __CLASS__);
      $this->EE->db->delete('extensions');
     }
    
     // ----------------------------------------------------------------------
    
     /**
      * Update Extension
      *
      * This function performs any necessary db updates when the extension
      * page is visited
      *
      * @return  mixed void on update / false if none
      */
     function update_extension($current = '')
     {
      if ($current == '' OR $current == $this->version)
      {
       return FALSE;
      }
     } 
     
     // ----------------------------------------------------------------------
    }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases