<?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
	header("location: index.php");
	exit;
}

/**
 * @param $installer
 */
function upgrade_20170127_remove_templates_c_tiki($installer)
{
	$dirname = 'templates_c';
	if (is_dir($dirname)) {
		$dir_handle = opendir($dirname);
	}
	if (!$dir_handle) {
		return false;
	}
	while($file = readdir($dir_handle)) {
		if ($file != "." && $file != "..") {
			if (!is_dir($dirname."/".$file))
				unlink($dirname."/".$file);
			else
				delete_directory($dirname.'/'.$file);
		}
	}
	closedir($dir_handle);
	rmdir($dirname);
}


<?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
	header("location: index.php");
	exit;
}

/**
 * @param $installer
 * @return void|bool
 */
function upgrade_20170127_remove_templates_c_tiki($installer)
{
	$dir_handle = false;
	$dirname = 'templates_c';
	if (is_dir($dirname)) {
		$dir_handle = opendir($dirname);
	}
	if (! $dir_handle) {
		return false;
	}
	while ($file = readdir($dir_handle)) {
		if ($file != "." && $file != "..") {
			if (! is_dir($dirname . "/" . $file)) {
				unlink($dirname . "/" . $file);
			} else {
				delete_directory($dirname . '/' . $file);
			}
		}
	}
	closedir($dir_handle);
	rmdir($dirname);
}

Fix notice with $dir_handle not being defined, improve code formatting
[REF] Fix notice with $dir_handle not being defined, improve code formatting


git-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@64294 b456876b-0849-0410-b77d-98878d47e9d5
