All pastes #343507 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-07 02:19 UTC
rendered paste body
<?php
/**
 * File: $Id: xarinit.php,v 1.3 2007/01/28 14:17:45 frank Exp $
 * 
 * Xaraya xyzHelper
 * 
 * 
 * @package Xaraya eXtensible Management System
 * @subpackage xyzhelper
*/

function xyzhelper_init() 
{

    // Set up module variables
    //
    // Set up module hooks

    // Initialisation successful
    return xyzhelper_upgrade('.2');;
}

function xyzhelper_upgrade($oldversion) 
{
	$dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();
    $xyzhelpertable = $xartable['xyzhelperimages'];
    $datadict =& xarDBNewDataDict($dbconn, 'ALTERTABLE');
    switch ($oldversion) {
    		case '.2':
    			$fields = "xar_photoid    C(32)     NotNull    PRIMARY,
               		  	   xar_photoname  C(255)    NotNull	   DEFAULT '',
               		       xar_processing L         NotNull    DEFAULT '0'
              		  ";
            $result = $datadict->changeTable($xyzhelpertable, $fields);
    			if (!$result) {return;}
		case "0.3.0":
			xarTplRegisterTag('xyzhelper','xyzimage',array(),'xyzhelper_userapi_handle_xyzimage_tag');
			
		case "0.3.1":
			//drop the table
			$result = $datadict->dropTable($xyzhelpertable);		
			$fields = "xar_photoid    C(32)     NotNull    PRIMARY,
               		   xar_photoname  C(255)    NotNull	   DEFAULT '',
               	       xar_processing L         NotNull    DEFAULT '0',
					   xar_width      F			NotNull    DEFAULT '0',
					   xar_height     F			NotNull	   DEFAULT '0',
					   xar_week       F			NotNull	   DEFAULT '0'
					  ";
    		$result = $datadict->changeTable($xyzhelpertable, $fields);
    		if (!$result) {return;}
		case "0.3.2":
			break;
    }
    return true;
}

function xyzhelper_delete() 
{
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();
    $xyzhelpertable = $xartable['xyzhelperimages'];
    /* Get a data dictionary object with item create and delete methods */
    $datadict =& xarDBNewDataDict($dbconn, 'ALTERTABLE');

    /* Drop the example tables */
    $result = $datadict->dropTable($xyzhelpertable);
    // Remove module hooks
/**    if (!xarModUnregisterHook('item',
                             'transform-input',
                             'API',
                             'xyzarticle',
                             'user',
                             'transforminput')) return;
*/
	//unregister tags
	xarTplUnregisterTag('xyzimage');
	xarTplUnregisterTag('imagerealm');
    // Deletion successful
    return true;
}

?>