protected function _clearDir($timeNow = null) {
		$clearPath = $this->getUploadDir();
		$storageTime = $this->_getStorageTimeUpload();

		$result = true;
		$oFolder = new Folder($clearPath, true);
		$uploadedFiles = $oFolder->find('.*', false);
		if (empty($uploadedFiles)) {
			return $result;
		}

		if (!empty($timeNow)) {
			$timeNow = (int)$timeNow;
		} else {
			$timeNow = time();
		}

		$uploadedFilesPath = $oFolder->pwd();
		foreach ($uploadedFiles as $uploadedFile) {
			$oFile = new File($uploadedFilesPath . DS . $uploadedFile);
			$lastChangeTime = $oFile->lastChange();
			if ($lastChangeTime === false) {
				continue;
			}

			if (($timeNow - $lastChangeTime) > $storageTime) {
				if (!$oFile->delete()) {
					$result = false;
				}
			}
		}

		return true;
	}
protected function _clearDir($timeNow = null) {
		$clearPath = $this->getUploadDir();
		$storageTime = $this->_getStorageTimeUpload();

		$result = true;
		$oFolder = new Folder($clearPath, true);
		$uploadedFiles = $oFolder->find('.*', false);
		if (empty($uploadedFiles)) {
			return $result;
		}

		if (!empty($timeNow)) {
			$timeNow = (int)$timeNow;
		} else {
			$timeNow = time();
		}

		$uploadedFilesPath = $oFolder->pwd();
		foreach ($uploadedFiles as $uploadedFile) {
			$oFile = new File($uploadedFilesPath . DS . $uploadedFile);
			$lastChangeTime = $oFile->lastChange();
			if ($lastChangeTime === false) {
				continue;
			}

			if (($timeNow - $lastChangeTime) > $storageTime) {
				if (!$oFile->delete()) {
					$result = false;
				}
			}
		}

		return true;
	}
protected function _clearDir ( $ timeNow = null ) { $ clearPath = $ this -> getUploadDir ( ) ; $ storageTime = $ this -> _getStorageTimeUpload ( ) ; $ result = true ; $ oFolder = new Folder ( $ clearPath , true ) ; $ uploadedFiles = $ oFolder -> find ( '.*' , false ) ; if ( empty ( $ uploadedFiles ) ) { return $ result ; } if ( ! empty ( $ timeNow ) ) { $ timeNow = ( int ) $ timeNow ; } else { $ timeNow = time ( ) ; } $ uploadedFilesPath = $ oFolder -> pwd ( ) ; foreach ( $ uploadedFiles as $ uploadedFile ) { $ oFile = new File ( $ uploadedFilesPath . DS . $ uploadedFile ) ; $ lastChangeTime = $ oFile -> lastChange ( ) ; if ( $ lastChangeTime === false ) { continue ; } if ( ( $ timeNow - $ lastChangeTime ) > $ storageTime ) { if ( ! $ oFile -> delete ( ) ) { $ result = false ; } } } return true ; }
Cleanup the upload directory from old files

@param int $timeNow Timestamp of current date and time.
@return bool Success
Cleanup the upload directory from old files