Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/dev_index.php
<?php   
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /**
    @version $Id: dev_index.php,v 1.2 2004/01/14 15:41:27 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */

	// execute init file
	require_once 'inc/init.php';

    /***************************************************************************   
    * DEVELOPER FUNCTIONS                                                      *   
    ***************************************************************************/   

	function dev_remove($file) {
		if(substr($file, 0, 3) == '../') {
			$str_file = substr($file, 3);
		} else {
			$str_file = $file;
		}
		if(is_dir($file)) {
			if(ZZOSS_InstallerUtils::rmdir($file)) {
				$msg = 'removed directory '.$str_file."\n";
			} else {
				$msg = 'error removing directory '.$str_file."\n";
			}
		} else
		if(file_exists($file)) {
			if(@unlink($file)) {
				$msg = 'removed file '.$str_file."\n";
			} else {
				$msg = 'error removing file '.$str_file."\n";
			}
		} else {
			if($str_file[strlen($str_file)]=='/') {
				$msg = 'directory '.$str_file.' does not exist'."\n";
			} else {
				$msg = 'file '.$str_file.' does not exist'."\n";
			}
		}
		return $msg;
	}

    /***************************************************************************   
    * PAGE CONTENT                                                             *   
    ***************************************************************************/   

	if(isset($_REQUEST["action"])) {
		switch($_REQUEST["action"]) {
			// remove login data
			case 'reset_login':
                $msg .= dev_remove($GLOBALS['ZI']['installer_data_dir'].'.htpasswd');
				break;
			// reset plugin cache
			case 'clear_plugin_cache':		$msg .= dev_remove($ZZOSS_INSTALLER["application_path"].'installer/plugins.reg');
											break;
			// reset package cache
			case 'clear_package_cache':		$msg .= dev_remove($ZZOSS_INSTALLER["application_path"].'installer/packages.reg');
											$msg .= dev_remove($ZZOSS_INSTALLER["application_path"].'installer/packages_resolve.reg');
											break;
			// update developer plugins
			case 'update_dev_plugins':		// update plugin info for "_plugins" plugin
											refreshPlugins();
											// TODO: this is very application specific ...
											// TODO: maybe use group definition in config.xml of installer
											$dirs = array('../lib/', '../modules/', '../utils/');
											foreach($dirs as $dir) {
												// now check which of the modules already installed
												if($dp = @opendir($dir)) {
													while (false !== ($entry = readdir($dp))) {
														if($entry != '.' && $entry != '..'){
															//echo $dir.'<br/>';
															$plugin_dir = $dir.$entry.'/zzoss_installer/_plugins/';
															$installed_dir = 'plugins/'.$entry.'/';
															if(is_dir($dir.$entry) && is_dir($plugin_dir) && is_dir($installed_dir)) {
																if($plugin = $plugins['_plugins']) {
																	$modus = 'install';
																	ZZOSS_Plugin::exec($plugin, $plugin_dir, $entry, $modus/*, $GLOBALS['ZI_CONFIG']['installation']['mode']*/);
																	$msg .= 'refreshed installer/plugins/'.$entry.'/'."\n";
																}
															}
														}
										    		}
													closedir($dp);
												}
											}
											break;
			// reset installer
			case 'reset_installer':			$msg .= dev_remove($GLOBALS['ZI']['installer_data_dir']);
            /*
											$msg .= dev_remove($GLOBALS['ZI']['installer_data_dir'].'distributions/');
											$msg .= dev_remove($GLOBALS['ZI']['installer_data_dir'].'.htpasswd');
											System::mkdir(array('-p',$GLOBALS['ZI']['installer_data_dir'].'installer'.DIRECTORY_SEPARATOR));
											System::mkdir(array('-p',$GLOBALS['ZI']['installer_data_dir'].'distributions'.DIRECTORY_SEPARATOR));*/
											break;
		}
		$msg .= 'done.';
	}
	
	function zi_process()
	{
		// nothing to process
	}

	include 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
	
?>
<h1>Develop Applications</h1>
<?php
if(isset($msg)) {
	echo '<textarea style="width:95%;height: 100px" readonly>'.$msg.'</textarea>';
}
?>
<p>
    [<a href="applications.php?mode=dev" title="Manage Applications">Manage Applications</a>]<br/>
    Manage all applications in development.
</p>
<!--
<p>
    [<a href="dev_distribution_import.php" title="Import Distribution">Import Distribution</a>]<br/>
    Add a distribution by importing its distribution.xml.
</p>
-->
<p>
    [<a href="dev_application_import.php?mode=dev" title="Add Application">Add Application</a>]<br/>
    Add an application by importing its distribution.xml, and application.xml.
</p>
<p>
    [<a href="dev_package.php?mode=dev" title="Develop Package">Develop Package</a>]<br/>
    Tools that help creating a package.
</p>
<p>
    [<a href="<?php echo $_SERVER["PHP_SELF"].'?action=reset_login'; ?>" title="Reset Login">Reset Login</a>]<br/>
    Trigger a new autentication request.
</p>
<p>
    [<a href="<?php echo $_SERVER["PHP_SELF"].'?action=reset_installer'; ?>" title="Reset Installer">Reset Installer</a>]<br/>
    Reset installer to initial state (all data gets lost).
</p>

<!--
<table border="0" cellspacing="6" cellpadding="0" width="100%">
<?php
//addLink('build_packages.php', 'Build Packages', 'Frontend for creating packages for production mode from development mode', !$zi_registry->noApplication() );
//addLink($_SERVER["PHP_SELF"].'?action=clear_package_cache', 'Clear Package Cache', 'Refreshs cached file of parsed package infos', !$zi_registry->noApplication() );
//addLink($_SERVER["PHP_SELF"].'?action=clear_plugin_cache', 'Clear Plugin Cache', 'Refreshs info file about available plugins', !$zi_registry->noApplication() );
//addLink($_SERVER["PHP_SELF"].'?action=update_dev_plugins', 'Update Developer Plugins', 'Scans all developer modules and update installed files of "_plugins" plugins', !$zi_registry->noApplication() );
?>
</table>
-->
<?php
	/*
	if(!$zi_buttons['back']) {
		$zi_buttons['back'] = $chdir.'menu.php';
	}
	*/
	include 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';
?>
Return current item: ZZ/OSS Installer