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()….
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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.