Zikula_Core
[ class tree: Zikula_Core ] [ index: Zikula_Core ] [ all elements ]

Source for file pninit.php

Documentation is available at pninit.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright Robert Gasch
  6.  * @link http://www.zikula.org
  7.  * @version $Id: pninit.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @author Robert Gasch rgasch@gmail.com
  10.  * @package Zikula_Core
  11.  */
  12.  
  13.  
  14. /**
  15.  * initialise module
  16. */
  17. function Categories_init()
  18. {
  19.     if (!DBUtil::createTable('categories_category')) {
  20.         return false;
  21.     }
  22.  
  23.     // Create the index
  24.     if (!DBUtil::createIndex('idx_categories_parent''categories_category''parent_id'||
  25.         !DBUtil::createIndex('idx_categories_is_leaf''categories_category''is_leaf'||
  26.         !DBUtil::createIndex('idx_categories_name''categories_category''name'||
  27.         !DBUtil::createIndex('idx_categories_ipath''categories_category'array('ipath''is_leaf''status')) ||
  28.         !DBUtil::createIndex('idx_categories_status''categories_category''status'||
  29.         !DBUtil::createIndex('idx_categories_ipath_status''categories_category'array('ipath''status'))){
  30.         return false;
  31.     }
  32.  
  33.  
  34.     // Set autonumber to 10000 (for DB's that support autonumber fields)
  35.     $cat['id'9999;
  36.     DBUtil::insertObject ($cat'categories_category''id'true);
  37.  
  38.     // for postgres, we need to explicitly set the sequence value to reflect the inserted data
  39.     $dbType   DBConnectionStack::getConnectionDBType();
  40.     if ($dbType == 'postgres'{
  41.         $pntables pnDBGetTables();
  42.         $tab $pntables['categories_category'];
  43.         $col $pntables['categories_category_column'];
  44.         $seq $tab '_cat_id_seq';
  45.         $sql "SELECT setval('$seq', (SELECT MAX($col[id]) + 1 FROM $tab))";
  46.         DBUtil::executeSQL($sql);
  47.     }
  48.  
  49.     DBUtil::deleteObjectByID('categories_category'9999'id');
  50.  
  51.  
  52.     pnModSetVar ('Categories''userrootcat''/__SYSTEM__/Users');
  53.     pnModSetVar ('Categories''allowusercatedit'0);
  54.     pnModSetVar ('Categories''autocreateusercat'0);
  55.     pnModSetVar ('Categories''autocreateuserdefaultcat'0);
  56.     pnModSetVar ('Categories''userdefaultcatname''Default');
  57.  
  58.     // Initialisation successful
  59.     return true;
  60. }
  61.  
  62. /**
  63.  * create tables
  64. */
  65. {
  66.     if (!DBUtil::createTable('categories_mapmeta')) {
  67.         return false;
  68.     }
  69.  
  70.     if (!DBUtil::createIndex('idx_categories_mapmeta''categories_mapmeta''meta_id')) {
  71.         return false;
  72.     }
  73.  
  74.     if (!DBUtil::createTable('categories_mapobj')) {
  75.         return false;
  76.     }
  77.  
  78.     if (!DBUtil::createIndex('idx_categories_mapobj''categories_mapobj'array('modname''table''obj_id''obj_idcolumn'))) {
  79.         return false;
  80.     }
  81.  
  82.     if (!DBUtil::createTable('categories_registry')) {
  83.         return false;
  84.     }
  85.  
  86.     if (!DBUtil::createIndex('idx_categories_registry''categories_registry'array('modname''table''property'))){
  87.         return false;
  88.     }
  89.  
  90.     return true;
  91. }
  92.  
  93.  
  94. /**
  95.  * insert data
  96. */
  97. {
  98.     $objArray array();
  99.     $objArray[array(
  100.         'id'               => 1,
  101.         'parent_id'        => 0,
  102.         'is_locked'        => 1,
  103.         'is_leaf'          => 0,
  104.         'name'             => '__SYSTEM__',
  105.         'display_name'     => 'b:0;',
  106.         'display_desc'     => 'b:0;',
  107.         'path'             => '/__SYSTEM__',
  108.         'ipath'            => '/1',
  109.         'status'           => 'A');
  110.     $objArray[array(
  111.         'id'               => 2,
  112.         'parent_id'        => 1,
  113.         'is_locked'        => 0,
  114.         'is_leaf'          => 0,
  115.         'name'             => 'Modules',
  116.         'display_name'     => Categories_makeDisplayName(_CATDISP_MODULES),
  117.         'display_desc'     => Categories_makeDisplayDesc(),
  118.         'path'             => '/__SYSTEM__/Modules',
  119.         'ipath'            => '/1/2',
  120.         'status'           => 'A');
  121.     $objArray[array(
  122.         'id'               => 3,
  123.         'parent_id'        => 1,
  124.         'is_locked'        => 0,
  125.         'is_leaf'          => 0,
  126.         'name'             => 'General',
  127.         'display_name'     => Categories_makeDisplayName(_CATDISP_GENERAL),
  128.         'display_desc'     => Categories_makeDisplayDesc(),
  129.         'path'             => '/__SYSTEM__/General',
  130.         'ipath'            => '/1/3',
  131.         'status'           => 'A');
  132.     $objArray[array(
  133.         'id'               => 4,
  134.         'parent_id'        => 3,
  135.         'is_locked'        => 0,
  136.         'is_leaf'          => 0,
  137.         'name'             => 'YesNo',
  138.         'display_name'     => Categories_makeDisplayName(_CATDISP_YESNO),
  139.         'display_desc'     => Categories_makeDisplayDesc(),
  140.         'path'             => '/__SYSTEM__/General/YesNo',
  141.         'ipath'            => '/1/3/4',
  142.         'status'           => 'A');
  143.     $objArray[array(
  144.         'id'               => 5,
  145.         'parent_id'        => 4,
  146.         'is_locked'        => 0,
  147.         'is_leaf'          => 1,
  148.         'name'             => '1 - Yes',
  149.         'display_name'     => 'b:0;',
  150.         'display_desc'     => 'b:0;',
  151.         'path'             => '/__SYSTEM__/General/YesNo/1 - Yes',
  152.         'ipath'            => '/1/3/4/5',
  153.         'status'           => 'A',
  154.         '__ATTRIBUTES__'   => array('code' => 'Y'));
  155.     $objArray[array(
  156.         'id'               => 6,
  157.         'parent_id'        => 4,
  158.         'is_locked'        => 0,
  159.         'is_leaf'          => 1,
  160.         'name'             => '2 - No',
  161.         'display_name'     => 'b:0;',
  162.         'display_desc'     => 'b:0;',
  163.         'path'             => '/__SYSTEM__/General/YesNo/2 - No',
  164.         'ipath'            => '/1/3/4/6',
  165.         'status'           => 'A',
  166.         '__ATTRIBUTES__'   => array('code' => 'N'));
  167.     $objArray[array(
  168.         'id'               => 10,
  169.         'parent_id'        => 3,
  170.         'is_locked'        => 0,
  171.         'is_leaf'          => 0,
  172.         'name'             => 'Pending Status Extended',
  173.         'display_name'     => Categories_makeDisplayName(_CATDISP_PENDINGSTATUS),
  174.         'display_desc'     => Categories_makeDisplayDesc(),
  175.         'path'             => '/__SYSTEM__/General/Pending Status Extended',
  176.         'ipath'            => '/1/3/10',
  177.         'status'           => 'A');
  178.     $objArray[array(
  179.         'id'               => 11,
  180.         'parent_id'        => 10,
  181.         'is_locked'        => 0,
  182.         'is_leaf'          => 1,
  183.         'name'             => 'Pending',
  184.         'display_name'     => Categories_makeDisplayName(_CATDISP_PENDING),
  185.         'display_desc'     => Categories_makeDisplayDesc(),
  186.         'path'             => '/__SYSTEM__/General/Pending Status Extended/Pending',
  187.         'ipath'            => '/1/3/10/11',
  188.         'status'           => 'A',
  189.         '__ATTRIBUTES__'   => array('code' => 'P'));
  190.     $objArray[array(
  191.         'id'               => 12,
  192.         'parent_id'        => 10,
  193.         'is_locked'        => 0,
  194.         'is_leaf'          => 1,
  195.         'name'             => 'Checked',
  196.         'display_name'     => Categories_makeDisplayName(_CATDISP_CHECKED),
  197.         'display_desc'     => Categories_makeDisplayDesc(),
  198.         'path'             => '/__SYSTEM__/General/Pending Status Extended/Checked',
  199.         'ipath'            => '/1/3/10/12',
  200.         'status'           => 'A',
  201.         '__ATTRIBUTES__'   => array('code' => 'C'));
  202.     $objArray[array(
  203.         'id'               => 13,
  204.         'parent_id'        => 10,
  205.         'is_locked'        => 0,
  206.         'is_leaf'          => 1,
  207.         'name'             => 'Approved',
  208.         'display_name'     => Categories_makeDisplayName(_CATDISP_APPROVED),
  209.         'display_desc'     => Categories_makeDisplayDesc(),
  210.         'path'             => '/__SYSTEM__/General/Pending Status Extended/Approved',
  211.         'ipath'            => '/1/3/10/13',
  212.         'status'           => 'A',
  213.         '__ATTRIBUTES__'   => array('code' => 'A'));
  214.     $objArray[array(
  215.         'id'               => 14,
  216.         'parent_id'        => 10,
  217.         'is_locked'        => 0,
  218.         'is_leaf'          => 1,
  219.         'name'             => 'Online',
  220.         'display_name'     => Categories_makeDisplayName(_CATDISP_ONLINE),
  221.         'display_desc'     => Categories_makeDisplayDesc(),
  222.         'path'             => '/__SYSTEM__/General/Pending Status Extended/Online',
  223.         'ipath'            => '/1/3/10/14',
  224.         'status'           => 'A',
  225.         '__ATTRIBUTES__'   => array('code' => 'O'));
  226.     $objArray[array(
  227.         'id'               => 15,
  228.         'parent_id'        => 10,
  229.         'is_locked'        => 0,
  230.         'is_leaf'          => 1,
  231.         'name'             => 'Rejected',
  232.         'display_name'     => Categories_makeDisplayName(_CATDISP_REJECTED),
  233.         'display_desc'     => Categories_makeDisplayDesc(),
  234.         'path'             => '/__SYSTEM__/General/Pending Status Extended/Rejected',
  235.         'ipath'            => '/1/3/10/15',
  236.         'status'           => 'A',
  237.         '__ATTRIBUTES__'   => array('code' => 'R'));
  238.     $objArray[array(
  239.         'id'               => 16,
  240.         'parent_id'        => 3,
  241.         'is_locked'        => 0,
  242.         'is_leaf'          => 0,
  243.         'name'             => 'Gender',
  244.         'display_name'     => Categories_makeDisplayName(_CATDISP_GENDER),
  245.         'display_desc'     => Categories_makeDisplayDesc(),
  246.         'path'             => '/__SYSTEM__/General/Gender',
  247.         'ipath'            => '/1/3/16',
  248.         'status'           => 'A');
  249.     $objArray[array(
  250.         'id'               => 17,
  251.         'parent_id'        => 16,
  252.         'is_locked'        => 0,
  253.         'is_leaf'          => 1,
  254.         'name'             => 'Male',
  255.         'display_name'     => Categories_makeDisplayName(_CATDISP_MALE),
  256.         'display_desc'     => Categories_makeDisplayDesc(),
  257.         'path'             => '/__SYSTEM__/General/Gender/Male',
  258.         'ipath'            => '/1/3/16/17',
  259.         'status'           => 'A',
  260.         '__ATTRIBUTES__'   => array('code' => 'M'));
  261.     $objArray[array(
  262.         'id'               => 18,
  263.         'parent_id'        => 16,
  264.         'is_locked'        => 0,
  265.         'is_leaf'          => 1,
  266.         'name'             => 'Female',
  267.         'display_name'     => Categories_makeDisplayName(_CATDISP_FEMALE),
  268.         'display_desc'     => Categories_makeDisplayDesc(),
  269.         'path'             => '/__SYSTEM__/General/Gender/Female',
  270.         'ipath'            => '/1/3/16/18',
  271.         'status'           => 'A',
  272.         '__ATTRIBUTES__'   => array('code' => 'F'));
  273.     $objArray[array(
  274.         'id'               => 19,
  275.         'parent_id'        => 3,
  276.         'is_locked'        => 0,
  277.         'is_leaf'          => 0,
  278.         'name'             => 'Title',
  279.         'display_name'     => Categories_makeDisplayName(_CATDISP_TITLE),
  280.         'display_desc'     => Categories_makeDisplayDesc(),
  281.         'path'             => '/__SYSTEM__/General/Title',
  282.         'ipath'            => '/1/3/19',
  283.         'status'           => 'A');
  284.     $objArray[array(
  285.         'id'               => 20,
  286.         'parent_id'        => 19,
  287.         'is_locked'        => 0,
  288.         'is_leaf'          => 1,
  289.         'name'             => 'Dr',
  290.         'display_name'     => Categories_makeDisplayName(_CATDISP_DR),
  291.         'display_desc'     => Categories_makeDisplayDesc(),
  292.         'path'             => '/__SYSTEM__/General/Title/Dr',
  293.         'ipath'            => '/1/3/19/20',
  294.         'status'           => 'A');
  295.     $objArray[array(
  296.         'id'               => 21,
  297.         'parent_id'        => 19,
  298.         'is_locked'        => 0,
  299.         'is_leaf'          => 1,
  300.         'name'             => 'Prof',
  301.         'display_name'     => Categories_makeDisplayName(_CATDISP_PROF),
  302.         'display_desc'     => Categories_makeDisplayDesc(),
  303.         'path'             => '/__SYSTEM__/General/Title/Prof',
  304.         'ipath'            => '/1/3/19/21',
  305.         'status'           => 'A');
  306.     $objArray[array(
  307.         'id'               => 22,
  308.         'parent_id'        => 19,
  309.         'is_locked'        => 0,
  310.         'is_leaf'          => 1,
  311.         'name'             => 'Mag',
  312.         'display_name'     => Categories_makeDisplayName(_CATDISP_MAG),
  313.         'display_desc'     => Categories_makeDisplayDesc(),
  314.         'path'             => '/__SYSTEM__/General/Title/Mag',
  315.         'ipath'            => '/1/3/19/13',
  316.         'status'           => 'A');
  317.     $objArray[array(
  318.         'id'               => 23,
  319.         'parent_id'        => 3,
  320.         'is_locked'        => 0,
  321.         'is_leaf'          => 0,
  322.         'name'             => 'ActiveStatus',
  323.         'display_name'     => Categories_makeDisplayName(_CATDISP_ACTIVITYSTATUS),
  324.         'display_desc'     => Categories_makeDisplayDesc(),
  325.         'path'             => '/__SYSTEM__/General/ActiveStatus',
  326.         'ipath'            => '/1/3/22',
  327.         'status'           => 'A');
  328.     $objArray[array(
  329.         'id'               => 24,
  330.         'parent_id'        => 23,
  331.         'is_locked'        => 0,
  332.         'is_leaf'          => 1,
  333.         'name'             => 'Active',
  334.         'display_name'     => Categories_makeDisplayName(_CATDISP_ACTIVE),
  335.         'display_desc'     => Categories_makeDisplayDesc(),
  336.         'path'             => '/__SYSTEM__/General/ActiveStatus/Active',
  337.         'ipath'            => '/1/3/22/23',
  338.         'status'           => 'A',
  339.         '__ATTRIBUTES__'   => array('code' => 'A'));
  340.     $objArray[array(
  341.         'id'               => 25,
  342.         'parent_id'        => 23,
  343.         'is_locked'        => 0,
  344.         'is_leaf'          => 1,
  345.         'name'             => 'Inactive',
  346.         'display_name'     => Categories_makeDisplayName(_CATDISP_INACTIVE),
  347.         'display_desc'     => Categories_makeDisplayDesc(),
  348.         'path'             => '/__SYSTEM__/General/ActiveStatus/Inactive',
  349.         'ipath'            => '/1/3/22/24',
  350.         'status'           => 'A',
  351.         '__ATTRIBUTES__'   => array('code' => 'I'));
  352.     $objArray[array(
  353.         'id'               => 26,
  354.         'parent_id'        => 3,
  355.         'is_locked'        => 0,
  356.         'is_leaf'          => 0,
  357.         'name'             => 'Pending Status Basic',
  358.         'display_name'     => Categories_makeDisplayName(_CATDISP_PENDINGSTATUSBASIC),
  359.         'display_desc'     => Categories_makeDisplayDesc(),
  360.         'path'             => '/__SYSTEM__/General/Pending Status Basic',
  361.         'ipath'            => '/1/3/25',
  362.         'status'           => 'A');
  363.     $objArray[array(
  364.         'id'               => 27,
  365.         'parent_id'        => 26,
  366.         'is_locked'        => 0,
  367.         'is_leaf'          => 1,
  368.         'name'             => 'Pending',
  369.         'display_name'     => Categories_makeDisplayName(_CATDISP_PENDING),
  370.         'display_desc'     => Categories_makeDisplayDesc(),
  371.         'path'             => '/__SYSTEM__/General/Pending Status Basic/Pending',
  372.         'ipath'            => '/1/3/25/26',
  373.         'status'           => 'A',
  374.         '__ATTRIBUTES__'   => array('code' => 'P'));
  375.     $objArray[array(
  376.         'id'               => 28,
  377.         'parent_id'        => 26,
  378.         'is_locked'        => 0,
  379.         'is_leaf'          => 1,
  380.         'name'             => 'Approved',
  381.         'display_name'     => Categories_makeDisplayName(_CATDISP_APPROVED),
  382.         'display_desc'     => Categories_makeDisplayDesc(),
  383.         'path'             => '/__SYSTEM__/General/Pending Status Basic/Approved',
  384.         'ipath'            => '/1/3/25/27',
  385.         'status'           => 'A',
  386.         '__ATTRIBUTES__'   => array('code' => 'A'));
  387.     $objArray[array(
  388.         'id'               => 29,
  389.         'parent_id'        => 1,
  390.         'is_locked'        => 0,
  391.         'is_leaf'          => 0,
  392.         'name'             => 'Users',
  393.         'display_name'     => Categories_makeDisplayName(_CATDISP_USERS),
  394.         'display_desc'     => Categories_makeDisplayDesc(),
  395.         'path'             => '/__SYSTEM__/Users',
  396.         'ipath'            => '/1/29',
  397.         'status'           => 'A');
  398.     $objArray[array(
  399.         'id'               => 30,
  400.         'parent_id'        => 2,
  401.         'is_locked'        => 0,
  402.         'is_leaf'          => 0,
  403.         'name'             => 'Global',
  404.         'display_name'     => Categories_makeDisplayName(_CATDISP_GLOBAL),
  405.         'display_desc'     => Categories_makeDisplayDesc(),
  406.         'path'             => '/__SYSTEM__/Modules/Global',
  407.         'ipath'            => '/1/2/30',
  408.         'status'           => 'A');
  409.     $objArray[array(
  410.         'id'               => 31,
  411.         'parent_id'        => 30,
  412.         'is_locked'        => 0,
  413.         'is_leaf'          => 1,
  414.         'name'             => 'Arts & Entertainment',
  415.         'display_name'     => Categories_makeDisplayName(_CATDISP_ARTSENTERTAINMENT),
  416.         'display_desc'     => Categories_makeDisplayDesc(),
  417.         'path'             => '/__SYSTEM__/Modules/Global/Arts & Entertainment',
  418.         'ipath'            => '/1/2/30/31',
  419.         'status'           => 'A');
  420.     $objArray[array(
  421.         'id'               => 32,
  422.         'parent_id'        => 30,
  423.         'is_locked'        => 0,
  424.         'is_leaf'          => 1,
  425.         'name'             => 'Default',
  426.         'display_name'     => Categories_makeDisplayName(_CATDISP_DEFAULT),
  427.         'display_desc'     => Categories_makeDisplayDesc(),
  428.         'path'             => '/__SYSTEM__/Modules/Global/Default',
  429.         'ipath'            => '/1/2/30/32',
  430.         'status'           => 'A');
  431.     $objArray[array(
  432.         'id'               => 33,
  433.         'parent_id'        => 30,
  434.         'is_locked'        => 0,
  435.         'is_leaf'          => 1,
  436.         'name'             => 'Information Technology',
  437.         'display_name'     => Categories_makeDisplayName(_CATDISP_INFORMATIONTECHNOLOGY),
  438.         'display_desc'     => Categories_makeDisplayDesc(),
  439.         'path'             => '/__SYSTEM__/Modules/Global/Information Technology',
  440.         'ipath'            => '/1/2/30/33',
  441.         'status'           => 'A');
  442.     $objArray[array(
  443.         'id'               => 34,
  444.         'parent_id'        => 30,
  445.         'is_locked'        => 0,
  446.         'is_leaf'          => 1,
  447.         'name'             => 'Politics',
  448.         'display_name'     => Categories_makeDisplayName(_CATDISP_POLITICS),
  449.         'display_desc'     => Categories_makeDisplayDesc(),
  450.         'path'             => '/__SYSTEM__/Modules/Global/Politics',
  451.         'ipath'            => '/1/2/30/34',
  452.         'status'           => 'A');
  453.     $objArray[array(
  454.         'id'               => 35,
  455.         'parent_id'        => 30,
  456.         'is_locked'        => 0,
  457.         'is_leaf'          => 1,
  458.         'name'             => 'Science',
  459.         'display_name'     => Categories_makeDisplayName(_CATDISP_SCIENCE),
  460.         'display_desc'     => Categories_makeDisplayDesc(),
  461.         'path'             => '/__SYSTEM__/Modules/Global/Science',
  462.         'ipath'            => '/1/2/30/35',
  463.         'status'           => 'A');
  464.     $objArray[array(
  465.         'id'               => 36,
  466.         'parent_id'        => 30,
  467.         'is_locked'        => 0,
  468.         'is_leaf'          => 1,
  469.         'name'             => 'Society',
  470.         'display_name'     => Categories_makeDisplayName(_CATDISP_SOCIETY),
  471.         'display_desc'     => Categories_makeDisplayDesc(),
  472.         'path'             => '/__SYSTEM__/Modules/Global/Society',
  473.         'ipath'            => '/1/2/30/36',
  474.         'status'           => 'A');
  475.     $objArray[array(
  476.         'id'               => 37,
  477.         'parent_id'        => 30,
  478.         'is_locked'        => 0,
  479.         'is_leaf'          => 1,
  480.         'name'             => 'Sports',
  481.         'display_name'     => Categories_makeDisplayName(_CATDISP_SPORTS),
  482.         'display_desc'     => Categories_makeDisplayDesc(),
  483.         'path'             => '/__SYSTEM__/Modules/Global/Sports',
  484.         'ipath'            => '/1/2/30/37',
  485.         'status'           => 'A');
  486.  
  487.     DBUtil::insertObjectArray($objArray'categories_category''id'true);
  488. }
  489.  
  490.  
  491. /**
  492.  * update the value addons tables
  493.  */
  494. {
  495.     // Array of the modules to update
  496.     $mods array('News' => array('stories' => 'Main'),
  497.                   'Pages' => array('pages' => 'Main'),
  498.                   'FAQ' => array('faqanswer' => 'Main'),
  499.                   'Feeds' => array('feeds' => 'Main'),
  500.                   'Reviews' => array('reviews' => 'Main'),
  501.                   'Content' => array('page' => 'primary'));
  502.  
  503.     $pntables pnDBGetTables();
  504.     $regcol   $pntables['categories_registry_column'];
  505.     $mapcol   $pntables['categories_mapobj_column'];
  506.  
  507.     // Update all the items mapped if there's a Register of the module
  508.     foreach ($mods as $module => $data{
  509.         foreach ($data as $table => $property{
  510.             $where  "$regcol[modname]='$module' AND $regcol[table]='$table' AND $regcol[property]='$property'";
  511.             $reg_id DBUtil::selectObject('categories_registry'$wherearray('id'));
  512.             if ($reg_id !== false{
  513.                 $obj array('reg_id' => $reg_id['id']);
  514.                 $where "$mapcol[modname]='$module' AND $mapcol[table]='$table'";
  515.                 DBUtil::updateObject($obj'categories_mapobj'$where'sid');
  516.             }
  517.         }
  518.     }
  519.  
  520.     return true;
  521. }
  522.  
  523.  
  524. {
  525.  
  526.   return serialize(array(pnUserGetLang(=> $name));
  527. }
  528.  
  529.  
  530. {
  531.   return serialize(array('eng' => ''));
  532. }
  533.  
  534.  
  535. /**
  536.  * upgrade module
  537. */
  538. function Categories_upgrade($oldversion)
  539. {
  540.     switch ($oldversion)
  541.     {
  542.         case '1.00':
  543.             Categories_createTables_101 ();
  544.             Categories_upgrade(1.03);
  545.             break;
  546.         case '1.03':
  547.             // added the reference to the registry property
  548.             DBUtil::changeTable('categories_category');
  549.             DBUtil::changeTable('categories_mapobj');
  550.             // update the ValueAddons tables
  551.             Categories_updateValueAddons_104();
  552.             break;
  553.     }
  554.     return true;
  555. }
  556.  
  557. /**
  558.  * delete module
  559. */
  560. function Categories_delete()
  561. {
  562.     DBUtil::dropTable('categories_category');
  563.     DBUtil::dropTable('categories_mapobj');
  564.     DBUtil::dropTable('categories_mapmeta');
  565.     DBUtil::dropTable('categories_registry');
  566.  
  567.     pnModDelVar ('Categories');
  568.  
  569.     // delete other modules use of categories flag
  570.     $pntable pnDBGetTables();
  571.     $cols    $pntable['module_vars_column'];
  572.     $name    DataUtil::formatForStore('enablecategorization');
  573.     $where   "$cols[name]='$name'";
  574.     $res     = (bool)DBUtil::deleteWhere ('module_vars'$where);
  575.  
  576.     // Deletion successful
  577.     return true;
  578. }

Documentation generated on Fri, 18 Jul 2008 21:53:08 +0200 by phpDocumentor 1.4.1