History of PortingTikiWikiPackages
Version 11
This is documentation of the process used while porting Trackers V2 from TikiWiki 1.9 to bitweaver.
mkdir trackers2
mkdir trackers2/admin
mkdir trackers2/icons
mkdir trackers2/modules
mkdir trackers2/plugins
mkdir trackers2/templates
...tiki-view_tracker_item.php
...tiki-view_tracker_more_info.php
...tiki-view_tracker.php
...tiki-admin_tracker_fields.php
...tiki-admin_trackers.php
...mod-last_tracker_items.php
...mod-last_tracker_items.tpl
...mod-usergroup_tracker.tpl
...wikiplugin_trackerlist.php
...tiki-admin_tracker_fields.tpl
...tiki-admin_trackers.tpl
...tiki-list_trackers.tpl
...tiki-plugin_trackerlist.tpl
...tiki-view_tracker_item.tpl
...tiki-view_tracker_more_info.tpl
...tiki-view_tracker.tpl
mv trackers2/tiki-list_trackers.php trackers2/index.php
perl -i -pe 's/tiki-setup.php/..\/tiki_setup_inc.php/g' `find trackers2 -type f -name '*.php'`
Now create a tiki_setup_inc.php file in the trackers2 directory. I've used the trackers/tiki_setup_inc.php file as a template.
{CODE(colors=>php)}<?php
// Initialise global variables
global $gTikiSystem, $userlib;
// Register package with kernel
$gTikiSystem->registerPackage( 'Trackers v2', dirname( FILE ).'/' );
// If package is installed
if( $gTikiSystem->isPackageActive( 'TRACKERS2_PKG_PATH' ) )
{
// Register user menu
$gTikiSystem->registerAppMenu( TRACKERS2_PKG_DIR, TRACKERS2_PKG_NAME, TRACKERS2_PKG_URL.'index.php',
'tikipackage:trackers2/menu_trackers.tpl', true );
if( $userlib->user_has_permission($user, 'tiki_p_admin_trackers') )
{
$perms = $userlib->get_permissions(0, -1, 'perm_name_desc', '', 'trackers');
foreach ($perms"data" as $perm)
{
$perm = $perm"perm_name";
$smarty->assign("$perm", 'y');
$$perm = 'y';
}
}
$smarty->assign('t_use_db', 'y');
$smarty->assign('t_use_dir', '');
}
?>{CODE}
perl -i -pe "s/\'lib\/trackers\//TRACKERS2_PKG_PATH.\'/g" `find trackers2 -type f -name '*.php'`
Create the Directories
Well, first thing I'll do is create sub-dirs under my bitweaver install as per Fire's Tutorial_Custom_package.mkdir trackers2
mkdir trackers2/admin
mkdir trackers2/icons
mkdir trackers2/modules
mkdir trackers2/plugins
mkdir trackers2/templates
Copying the Files
First thing I'll do is copy the trackers library, root php files, modules and templates. I've used the '...' to indicate the previous command but with a different filename for brevity.Libraries
cp ../tw-1.9/lib/trackers/trackerlib.php trackers2Root files (non-admin)
cp ../tw-1.9/tiki-list_trackers.php trackers2...tiki-view_tracker_item.php
...tiki-view_tracker_more_info.php
...tiki-view_tracker.php
Root files (admin)
cp ../tw-1.9/tiki-admin_include_trackers.php trackers2/admin...tiki-admin_tracker_fields.php
...tiki-admin_trackers.php
Icons
cp ../tw-1.9/img/icons/admin_trackers.png trackers2/iconsModules
cp ../tw-1.9/modules/mod-last_modif_tracker_items.php trackers2/modules...mod-last_tracker_items.php
Templates (modules)
cp ../tw-1.9/templates/modules/mod-last_modif_tracker_items.tpl trackers2/modules...mod-last_tracker_items.tpl
...mod-usergroup_tracker.tpl
Wiki Plugins
cp ../tw-1.9/lib/wiki-plugins/wikiplugin_tracker.php trackers2/plugins...wikiplugin_trackerlist.php
Templates (non-modules)
cp ../tw-1.9/templates/tiki-admin-include-trackers.tpl trackers2/templates...tiki-admin_tracker_fields.tpl
...tiki-admin_trackers.tpl
...tiki-list_trackers.tpl
...tiki-plugin_trackerlist.tpl
...tiki-view_tracker_item.tpl
...tiki-view_tracker_more_info.tpl
...tiki-view_tracker.tpl
Templates (notifications)
cp ../tw-1.9/templates/mail/tracker_changed_notification.tpl trackers2/templatesindex.php
Lets start with an index page. By default, we want list trackers to be the index page - so renamemv trackers2/tiki-list_trackers.php trackers2/index.php
bit_setup_inc.php
Okay - all references to tiki-setup.php must be changed to ../tiki_setup_inc.php. I've used a PERL command that will find and replace all instances of tiki-setup.php to ../tiki_setup_inc.php in all *.php files under trackers2 directory.perl -i -pe 's/tiki-setup.php/..\/tiki_setup_inc.php/g' `find trackers2 -type f -name '*.php'`
Now create a tiki_setup_inc.php file in the trackers2 directory. I've used the trackers/tiki_setup_inc.php file as a template.
{CODE(colors=>php)}<?php
// Initialise global variables
global $gTikiSystem, $userlib;
// Register package with kernel
$gTikiSystem->registerPackage( 'Trackers v2', dirname( FILE ).'/' );
// If package is installed
if( $gTikiSystem->isPackageActive( 'TRACKERS2_PKG_PATH' ) )
{
// Register user menu
$gTikiSystem->registerAppMenu( TRACKERS2_PKG_DIR, TRACKERS2_PKG_NAME, TRACKERS2_PKG_URL.'index.php',
'tikipackage:trackers2/menu_trackers.tpl', true );
if( $userlib->user_has_permission($user, 'tiki_p_admin_trackers') )
{
$perms = $userlib->get_permissions(0, -1, 'perm_name_desc', '', 'trackers');
foreach ($perms"data" as $perm)
{
$perm = $perm"perm_name";
$smarty->assign("$perm", 'y');
$$perm = 'y';
}
}
$smarty->assign('t_use_db', 'y');
$smarty->assign('t_use_dir', '');
}
?>{CODE}
Libraries
Okay - all references to lib/trackers/trackerlib.php must be changed to TRACKERS2_PKG_PATH.'tracker_lib.php'. Once again, we will use a PERL find and replace.perl -i -pe "s/\'lib\/trackers\//TRACKERS2_PKG_PATH.\'/g" `find trackers2 -type f -name '*.php'`