Source for file pninit.php
Documentation is available at pninit.php
* Zikula Application Framework
* @copyright Robert Gasch
* @link http://www.zikula.org
* @version $Id: pninit.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @author Robert Gasch rgasch@gmail.com
if (!DBUtil::createIndex('idx_categories_parent', 'categories_category', 'parent_id') ||
!DBUtil::createIndex('idx_categories_ipath', 'categories_category', array('ipath', 'is_leaf', 'status')) ||
!DBUtil::createIndex('idx_categories_ipath_status', 'categories_category', array('ipath', 'status'))){
// Set autonumber to 10000 (for DB's that support autonumber fields)
// for postgres, we need to explicitly set the sequence value to reflect the inserted data
if ($dbType == 'postgres') {
$tab = $pntables['categories_category'];
$col = $pntables['categories_category_column'];
$seq = $tab . '_cat_id_seq';
$sql = "SELECT setval('$seq', (SELECT MAX($col[id]) + 1 FROM $tab))";
pnModSetVar ('Categories', 'userrootcat', '/__SYSTEM__/Users');
pnModSetVar ('Categories', 'autocreateuserdefaultcat', 0);
pnModSetVar ('Categories', 'userdefaultcatname', 'Default');
// Initialisation successful
if (!DBUtil::createIndex('idx_categories_mapmeta', 'categories_mapmeta', 'meta_id')) {
if (!DBUtil::createIndex('idx_categories_mapobj', 'categories_mapobj', array('modname', 'table', 'obj_id', 'obj_idcolumn'))) {
if (!DBUtil::createIndex('idx_categories_registry', 'categories_registry', array('modname', 'table', 'property'))){
'display_name' => 'b:0;',
'display_desc' => 'b:0;',
'path' => '/__SYSTEM__/Modules',
'path' => '/__SYSTEM__/General',
'path' => '/__SYSTEM__/General/YesNo',
'display_name' => 'b:0;',
'display_desc' => 'b:0;',
'path' => '/__SYSTEM__/General/YesNo/1 - Yes',
'__ATTRIBUTES__' => array('code' => 'Y'));
'display_name' => 'b:0;',
'display_desc' => 'b:0;',
'path' => '/__SYSTEM__/General/YesNo/2 - No',
'__ATTRIBUTES__' => array('code' => 'N'));
'name' => 'Pending Status Extended',
'path' => '/__SYSTEM__/General/Pending Status Extended',
'path' => '/__SYSTEM__/General/Pending Status Extended/Pending',
'__ATTRIBUTES__' => array('code' => 'P'));
'path' => '/__SYSTEM__/General/Pending Status Extended/Checked',
'__ATTRIBUTES__' => array('code' => 'C'));
'path' => '/__SYSTEM__/General/Pending Status Extended/Approved',
'__ATTRIBUTES__' => array('code' => 'A'));
'path' => '/__SYSTEM__/General/Pending Status Extended/Online',
'__ATTRIBUTES__' => array('code' => 'O'));
'path' => '/__SYSTEM__/General/Pending Status Extended/Rejected',
'__ATTRIBUTES__' => array('code' => 'R'));
'path' => '/__SYSTEM__/General/Gender',
'path' => '/__SYSTEM__/General/Gender/Male',
'__ATTRIBUTES__' => array('code' => 'M'));
'path' => '/__SYSTEM__/General/Gender/Female',
'__ATTRIBUTES__' => array('code' => 'F'));
'path' => '/__SYSTEM__/General/Title',
'path' => '/__SYSTEM__/General/Title/Dr',
'path' => '/__SYSTEM__/General/Title/Prof',
'path' => '/__SYSTEM__/General/Title/Mag',
'name' => 'ActiveStatus',
'path' => '/__SYSTEM__/General/ActiveStatus',
'path' => '/__SYSTEM__/General/ActiveStatus/Active',
'__ATTRIBUTES__' => array('code' => 'A'));
'path' => '/__SYSTEM__/General/ActiveStatus/Inactive',
'__ATTRIBUTES__' => array('code' => 'I'));
'name' => 'Pending Status Basic',
'path' => '/__SYSTEM__/General/Pending Status Basic',
'path' => '/__SYSTEM__/General/Pending Status Basic/Pending',
'__ATTRIBUTES__' => array('code' => 'P'));
'path' => '/__SYSTEM__/General/Pending Status Basic/Approved',
'__ATTRIBUTES__' => array('code' => 'A'));
'path' => '/__SYSTEM__/Users',
'path' => '/__SYSTEM__/Modules/Global',
'name' => 'Arts & Entertainment',
'path' => '/__SYSTEM__/Modules/Global/Arts & Entertainment',
'path' => '/__SYSTEM__/Modules/Global/Default',
'name' => 'Information Technology',
'path' => '/__SYSTEM__/Modules/Global/Information Technology',
'path' => '/__SYSTEM__/Modules/Global/Politics',
'path' => '/__SYSTEM__/Modules/Global/Science',
'path' => '/__SYSTEM__/Modules/Global/Society',
'path' => '/__SYSTEM__/Modules/Global/Sports',
* update the value addons tables
// Array of the modules to update
$mods = array('News' => array('stories' => 'Main'),
'Pages' => array('pages' => 'Main'),
'FAQ' => array('faqanswer' => 'Main'),
'Feeds' => array('feeds' => 'Main'),
'Reviews' => array('reviews' => 'Main'),
'Content' => array('page' => 'primary'));
$regcol = $pntables['categories_registry_column'];
$mapcol = $pntables['categories_mapobj_column'];
// Update all the items mapped if there's a Register of the module
foreach ($mods as $module => $data) {
foreach ($data as $table => $property) {
$where = "$regcol[modname]='$module' AND $regcol[table]='$table' AND $regcol[property]='$property'";
$obj = array('reg_id' => $reg_id['id']);
$where = "$mapcol[modname]='$module' AND $mapcol[table]='$table'";
// added the reference to the registry property
// update the ValueAddons tables
// delete other modules use of categories flag
$cols = $pntable['module_vars_column'];
$where = "$cols[name]='$name'";
|