From 3e77bae728f6e1d12434681010590465455fc2b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 20 Jun 2008 16:28:38 +0000 Subject: [PATCH] Deprecated methods and exceptions removed --- .gitattributes | 4 - .../personell/class_SimulatorPersonell.php | 44 +------ .../ship-simu/main/ships/class_BaseShip.php | 7 - .../class_ExceptionNotChangedException.php | 46 ------- ...s_InvalidTemplateVariableNameException.php | 49 ------- inc/classes/interfaces/extended/.htaccess | 1 - .../extended/class_LimitableObject.php | 41 ------ .../databases/class_LocalFileDatabase.php | 124 ------------------ 8 files changed, 2 insertions(+), 314 deletions(-) delete mode 100644 inc/classes/exceptions/main/class_ExceptionNotChangedException.php delete mode 100644 inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php delete mode 100644 inc/classes/interfaces/extended/.htaccess delete mode 100644 inc/classes/interfaces/extended/class_LimitableObject.php diff --git a/.gitattributes b/.gitattributes index 7a90d3b..be0e286 100644 --- a/.gitattributes +++ b/.gitattributes @@ -222,7 +222,6 @@ inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php -text inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text inc/classes/exceptions/main/class_EmptyVariableException.php -text -inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text inc/classes/exceptions/main/class_FatalErrorException.php -text inc/classes/exceptions/main/class_GetterNotFoundException.php -text @@ -248,7 +247,6 @@ inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text -inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text @@ -285,8 +283,6 @@ inc/classes/interfaces/database/middleware/.htaccess -text inc/classes/interfaces/database/middleware/class_DatabaseConnector.php -text inc/classes/interfaces/debug/.htaccess -text inc/classes/interfaces/debug/class_Debugger.php -text -inc/classes/interfaces/extended/.htaccess -text -inc/classes/interfaces/extended/class_LimitableObject.php -text inc/classes/interfaces/filter/.htaccess -text inc/classes/interfaces/filter/class_Filterable.php -text inc/classes/interfaces/helper/.htaccess -text diff --git a/application/ship-simu/main/personell/class_SimulatorPersonell.php b/application/ship-simu/main/personell/class_SimulatorPersonell.php index f0b33b8..76d8ecf 100644 --- a/application/ship-simu/main/personell/class_SimulatorPersonell.php +++ b/application/ship-simu/main/personell/class_SimulatorPersonell.php @@ -412,48 +412,8 @@ class SimulatorPersonell extends BasePersonell { * of a class. */ public function loadPersonellList ($idNumber) { - // Get database instance - $dbInstance = $this->getDatabaseInstance(); - - // Get the serialization container within the personell list from - // the database layer - $containerInstance = $dbInstance->getObjectFromCachedData($idNumber); - - // Iterate through the whole container - for ($idx = $containerInstance->getIterator(); $idx->valid(); $idx->next()) { - // Get current item from container - $item = $idx->current(); - - // Validate it a bit - if (is_null($item)) { - // Is null - throw new ContainerItemIsNullException($this, self::EXCEPTION_CONTAINER_ITEM_IS_NULL); - } elseif (!is_array($item)) { - // Is not an array - throw new ContainerItemIsNoArrayException($this, self::EXCEPTION_ITEM_IS_NO_ARRAY); - } elseif ((!isset($item['name'])) || (!isset($item['value']))) { - // Missing elements - throw new ContainerMaybeDamagedException($this, self::EXCEPTION_CONTAINER_MAYBE_DAMAGED); - } - - // Okay, now we can get the item and generate a valid command for eval(). - // We need to convert the first letter to lower-case but keep all others intact - $eval = sprintf("\$this->%s = \$item['value'];", - strtolower(substr($item['name'], 0, 1)) - . - substr($item['name'], 1) - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", - __CLASS__, - __LINE__, - htmlentities($eval) - )); - - // Run the command - @eval($eval); - } + // Cleared because old code + $this->partialStub("Clear because of old lost code was usaged."); } } diff --git a/application/ship-simu/main/ships/class_BaseShip.php b/application/ship-simu/main/ships/class_BaseShip.php index a37bdb0..c047627 100644 --- a/application/ship-simu/main/ships/class_BaseShip.php +++ b/application/ship-simu/main/ships/class_BaseShip.php @@ -122,13 +122,6 @@ class BaseShip extends BaseSimulator { $e->getMessage() )); return false; - } catch (ExceptionNotChangedException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht geändert. Details: %s
\n", - __CLASS__, - __LINE__, - $e->getMessage() - )); - return false; } catch (ExceptionNotFoundException $e) { if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht gefunden. Details: %s
\n", __CLASS__, diff --git a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php deleted file mode 100644 index 6fe9445..0000000 --- a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @deprecated - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ExceptionNotChangedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct (BaseFrameworkSystem $class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.", - $class, - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php deleted file mode 100644 index b309f7b..0000000 --- a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @deprecated - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidTemplateVariableNameException extends FrameworkException { - /** - * The constructor - * - * @param $classArray An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $classArray, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] The template %s contains an invalid variable called %s. Valid variable names are only %s.", - $classArray[0]->__toString(), - $this->getLine(), - basename($classArray[1]), - $classArray[2], - $classArray[3]->readConfig('tpl_valid_var') - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/inc/classes/interfaces/extended/.htaccess b/inc/classes/interfaces/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/inc/classes/interfaces/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/inc/classes/interfaces/extended/class_LimitableObject.php b/inc/classes/interfaces/extended/class_LimitableObject.php deleted file mode 100644 index 9c03202..0000000 --- a/inc/classes/interfaces/extended/class_LimitableObject.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * @deprecated - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface LimitableObject extends FrameworkInterface { - /** - * Reduces the volume of a processed object. - * - * @param $limitInstance An instance to ObjectLimits which holds - * attribute names that we want to include - * in the processing phase. Other attributes - * except $uniqueID and $realClass will be - * ignored and keept out. - * @return void - */ - function limitObject (ObjectLimits $limitInstance); -} - -// [EOF] -?> diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 417c861..f9e67a9 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -301,130 +301,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend return $this->fileExtension; } - /** - * Get cached (last fetched) data from the local file database - * - * @param $uniqueID The ID number for looking up the data - * @return $object The restored object from the maybe compressed - * serialized data - * @throws MismatchingCompressorsException If the compressor from - * the loaded file - * mismatches with the - * current used one. - * @throws NullPointerException If the restored object - * is null - * @throws NoObjectException If the restored "object" - * is not an object instance - * @throws MissingMethodException If the required method - * toString() is missing - * @deprecated - */ - public final function getObjectFromCachedData ($uniqueID) { - // Get instance for file handler - $inputHandler = $this->getFileIoInstance(); - - // Get last file's name and contents - $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID); - $contents = $this->repairContents($this->getLastContents(), $fqfn); - - // Let's decompress it. First we need the instance - $compressInstance = $this->getCompressorChannel(); - - // Is the compressor's extension the same as the one from the data? - if ($compressInstance->getCompressorExtension() != $contents['header'][0]) { - /** - * @todo For now we abort here but later we need to make this a little more dynamic. - */ - throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS); - } - - // Decompress the data now - $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']); - - // And unserialize it... - $object = unserialize($serialized); - - // This must become a valid object, so let's check it... - if (is_null($object)) { - // Is null, throw exception - throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($object)) { - // Is not an object, throw exception - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$object instanceof FrameworkInterface) { - // A highly required method was not found... :-( - throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); - } - - // And return the object - return $object; - } - - /** - * Private method for re-gathering (repairing) the FQFN - * - * @param $fqfn The current FQFN we shall validate - * @param $uniqueID The unique ID number - * @return $fqfn The repaired FQFN when it is empty - * @throws NoArrayCreatedException If explode() has not - * created an array - * @throws InvalidArrayCountException If the array count is not - * as the expected - * @deprecated - */ - private function repairFQFN ($fqfn, $uniqueID) { - // Cast both strings - $fqfn = (string) $fqfn; - $uniqueID = (string) $uniqueID; - - // Is there pre-cached data available? - if (empty($fqfn)) { - // Split the unique ID up in path and file name - $pathFile = explode("@", $uniqueID); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Create full path name - $pathName = $this->getSavePath() . $pathFile[0]; - - // Nothing cached, so let's create a FQFN first - $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension()); - $this->setLastFile($fqfn); - } - - // Return repaired FQFN - return $fqfn; - } - - /** - * Private method for re-gathering the contents of a given file - * - * @param $contents The (maybe) already cached contents as an array - * @param $fqfn The current FQFN we shall validate - * @return $contents The repaired contents from the given file - * @deprecated - */ - private function repairContents ($contents, $fqfn) { - // Is there some content and header (2 indexes) in? - if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) { - // No content found so load the file again - $contents = $inputHandler->loadFileContents($fqfn); - - // And remember all data for later usage - $this->setLastContents($contents); - } - - // Return the repaired contents - return $contents; - } - /** * Reads a local data file and returns it's contents in an array * -- 2.39.5