Tools Class

Files

/engine/class.www-tools.php

Introduction

This class holds various functionality that also the /tools/ folder has itself. This allows the system to implement some of the tools functionality within the actual website itself, such as things like clearing cache in bulk, or returning an index of files from a folder.

Using Tools Class

It is not recommended to use Tools class outside Wave Framework internal use, but it is certainly possible as long as the filesystem default folder structure is the same. To use the class, it is recommended to load Tools class and then call the methods of that class. For example, to delete all cache filesystem directory, then you can do it like this:

	
	require('/engine/class.www-tools.php');
	// Assign the filesystem folder directory with the construction
	$tool=new WWW_Tools('/filesystem/');
	// Deleting all cache
	$tool->cleaner('cache');
	

Tools Class Parameters

public $filesystemDirectory=false

This is the filesystem directory of the project.

Tools Class Methods

public function __construct($filesystemDirectory=false)

This creates the Tools object. If the filesystem is not sent during the object creation, then it attempts to find one by default based on requesting script folder.

public function cleaner($mode='maintenance',$cutoff=false)

This method cleans certain folders in filesystem. A cut-off timestamp can be set, which tells the cleaner not to delete certain files if their modification timestamp is newer.

public function indexer($directory,$mode='both')

This function returns an index of files, folders or both recursively from the requested folder.

public function counter($directory)

This function counts the amount of files in a folder.

public function sizer($directory)

This function calculates the total file size in a folder and all of its subfolders.