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

Problem with extension

Development and Programming

precision's avatar
precision
95 posts
16 years ago
precision's avatar precision

Hey, does anyone see what’s wrong with this….when I move it into the extensions directory and try to go to the extension Manager I get a blank page… I don’t see any syntax errors… etc… What am I missing here? I’m not really trying to do anything with it yet… just trying to get it hooked in.

Thanks,

<?php


if ( ! defined('EXT'))
{
  exit('Invalid file request');
}

class rsync_automation {

    var $settings = array();
    var $name            = 'Rsync Automation';
    var $version         = '1.0.0';
    var $description     = 'Kick off Rsync Automation Script';
    var $settings_exist  = 'n';
    var $docs_url        = '';
    

   function rsync_automation($settings='') {
      $this->settings = $settings;
   } //end constructor

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

    function activate_extension()
    {
        global $DB;

        $DB->query($DB->insert_string('exp_extensions',
            array(
                 'extension_id' => '',
                 'class'        => "rsync_automation",
                 'method'       => "build_rsync_tab",
                 'hook'         => "cp_display_page_navigation",
                 'settings'     => $this->settings,
                 'priority'     => 10,
                 'version'      => $this->version,
                 'enabled'      => "n")));
    }

    // --------------------------------
    //  Update Extension
    // --------------------------------

    function update_extension($current='')
    {
        global $DB;

        if ($current == '' OR $current == $this->version)
        {
            return FALSE;
        }

        if ($current < '1.0.1')
        {
            // Update to next version 1.0.1
        }

        if ($current < '1.0.2')
        {
            // Update to next version 1.0.2
        }

        $DB->query("UPDATE exp_extensions
                    SET version = '".$DB->escape_str($this->version).
                    "' WHERE class = 'rsync_automation'");
    }

    // --------------------------------
    //  Disable Extension
    // --------------------------------

    function disable_extension()
    {
        global $DB;
        $DB->query("DELETE FROM exp_extensions WHERE class = 'rsync_automation'");
    }


    /** -------------------------
    /**  Build Rsync Tab
    /** ------------------------- */
    function build_rsync_tab($this)
    {
           global $EXT,$SESS;
           if ($SESS->userdata['group_id'] == 1)  //super admin group
           {
                 if($EXT->last_call)
                 {
                    $EXT->last_call['rp'] = 'Rsync push';
                    return $EXT->last_call;
                 }
                 else
                 {
                    ;//$SESS->userdata['quicktabs']['rsync'] = 'Rsync Push|./index.php/?S=0&C=rsync';
                 }
          }
          return;
    }

} //end class

Ok, I did find one logic mistake which referenced a setting which didn’t exist, but I’ve corrected that in the above listed code and I still get a blank screen when trying to bring up the extensions manager.

Ok, I found out why it wasn’t working,but I’m not quite sure exactly what it means… I thought you need to match the parameters in the hook call ($this) for this entry point, but it seems that defining build_rsync_tab($this) was causing the issue… needs to be build_rsync_tab()….

       
gridonic's avatar
gridonic
231 posts
16 years ago
gridonic's avatar gridonic

Have you turned on errors in and in the CP?

Try editing your _SYSTEM/index.php and setting error_reporting to E_ALL.

       
precision's avatar
precision
95 posts
16 years ago
precision's avatar precision

Ok, I’ve managed to tie in the extension and the tab now shows up on the main navigation as “Rsync Push”…
The link points to …./index.php?S=0&C=rsync This basically matches the links of the other tabs….but I’m not sure how to actually tie in the page that is connected to the tab.

What’s the correct way to tie in the actual page?? Thanks

       

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.