Skip to content

Loading…

Remove deprecated methods in JLog + additional fixes #1183

Merged
merged 8 commits into from

2 participants

Showing with 79 additions and 319 deletions.
  1. +4 −5 libraries/joomla/database/database.php
  2. +1 −2 libraries/joomla/database/database/mysql.php
  3. +1 −2 libraries/joomla/database/database/mysqlexporter.php
  4. +1 −2 libraries/joomla/database/database/mysqli.php
  5. +1 −2 libraries/joomla/database/database/mysqliexporter.php
  6. +1 −2 libraries/joomla/database/database/mysqliimporter.php
  7. +1 −2 libraries/joomla/database/database/mysqlimporter.php
  8. +1 −2 libraries/joomla/database/database/mysqliquery.php
  9. +1 −2 libraries/joomla/database/database/mysqlquery.php
  10. +1 −2 libraries/joomla/database/database/sqlazure.php
  11. +1 −2 libraries/joomla/database/database/sqlazurequery.php
  12. +1 −2 libraries/joomla/database/database/sqlsrv.php
  13. +1 −2 libraries/joomla/database/database/sqlsrvquery.php
  14. +0 −1 libraries/joomla/html/html/select.php
  15. +0 −118 libraries/joomla/log/log.php
  16. +2 −6 libraries/joomla/plugin/helper.php
  17. +0 −1 libraries/joomla/user/user.php
  18. +2 −2 libraries/joomla/utilities/xmlelement.php
  19. +0 −7 libraries/legacy/base/node.php
  20. +0 −4 libraries/legacy/base/tree.php
  21. +24 −21 libraries/legacy/controller/controller.php
  22. +1 −2 libraries/legacy/database/exception.php
  23. +9 −30 libraries/legacy/error/error.php
  24. +8 −6 libraries/legacy/exception/exception.php
  25. +3 −1 libraries/legacy/log/logexception.php
  26. +12 −0 libraries/legacy/module/helper.php
  27. +2 −3 libraries/legacy/simplecrypt/simplecrypt.php
  28. +0 −88 tests/suites/unit/joomla/log/JLogTest.php
View
9 libraries/joomla/database/database.php
@@ -29,7 +29,7 @@
*/
public function query()
{
- JLog::add('JDatabase::query() is deprecated, use JDatabaseDriver::execute() instead.', JLog::NOTICE, 'deprecated');
+ JLog::add('JDatabase::query() is deprecated, use JDatabaseDriver::execute() instead.', JLog::WARNING, 'deprecated');
return $this->execute();
}
@@ -46,8 +46,7 @@ public function query()
*/
public static function getConnectors()
{
- // Deprecation warning.
- JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::NOTICE, 'deprecated');
+ JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::WARNING, 'deprecated');
return JDatabaseDriver::getConnectors();
}
@@ -110,7 +109,7 @@ public function getErrorNum()
*/
public static function getInstance($options = array())
{
- JLog::add('JDatabase::getInstance() is deprecated, use JDatabaseDriver::getInstance() instead.', JLog::NOTICE, 'deprecated');
+ JLog::add('JDatabase::getInstance() is deprecated, use JDatabaseDriver::getInstance() instead.', JLog::WARNING, 'deprecated');
return JDatabaseDriver::getInstance($options);
}
@@ -127,7 +126,7 @@ public static function getInstance($options = array())
*/
public static function splitSql($sql)
{
- JLog::add('JDatabase::splitSql() is deprecated, use JDatabaseDriver::splitSql() instead.', JLog::NOTICE, 'deprecated');
+ JLog::add('JDatabase::splitSql() is deprecated, use JDatabaseDriver::splitSql() instead.', JLog::WARNING, 'deprecated');
return JDatabaseDriver::splitSql($sql);
}
View
3 libraries/joomla/database/database/mysql.php
@@ -9,8 +9,7 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseMysql is deprecated, use JDatabaseDriverMysql instead.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseMysql is deprecated, use JDatabaseDriverMysql instead.', JLog::WARNING, 'deprecated');
/**
* MySQL database driver
View
3 libraries/joomla/database/database/mysqlexporter.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseExporterMysql has moved to the database/exporter directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseExporterMysql has moved to the database/exporter directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/mysqli.php
@@ -9,8 +9,7 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseMysqli is deprecated, use JDatabaseDriverMysqli instead.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseMysqli is deprecated, use JDatabaseDriverMysqli instead.', JLog::WARNING, 'deprecated');
/**
* MySQLi database driver
View
3 libraries/joomla/database/database/mysqliexporter.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseExporterMysqli has moved to the database/exporter directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseExporterMysqli has moved to the database/exporter directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/mysqliimporter.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseImporterMysqli has moved to the database/importer directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseImporterMysqli has moved to the database/importer directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/mysqlimporter.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseImporterMysql has moved to the database/importer directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseImporterMysql has moved to the database/importer directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/mysqliquery.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseQueryMysqli has moved to the database/query directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseQueryMysqli has moved to the database/query directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/mysqlquery.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseQueryMysql has moved to the database/query directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseQueryMysql has moved to the database/query directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/sqlazure.php
@@ -9,8 +9,7 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseSqlazure is deprecated, use JDatabaseDriverSqlazure instead.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseSqlazure is deprecated, use JDatabaseDriverSqlazure instead.', JLog::WARNING, 'deprecated');
/**
* SQL Server database driver
View
3 libraries/joomla/database/database/sqlazurequery.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseQuerySqlazure has moved to the database/query directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseQuerySqlazure has moved to the database/query directory.', JLog::WARNING, 'deprecated');
View
3 libraries/joomla/database/database/sqlsrv.php
@@ -9,8 +9,7 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseSqlsrv is deprecated, use JDatabaseDriverSqlsrv instead.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseSqlsrv is deprecated, use JDatabaseDriverSqlsrv instead.', JLog::WARNING, 'deprecated');
JLoader::register('JDatabaseQuerySQLSrv', __DIR__ . '/sqlsrvquery.php');
/**
View
3 libraries/joomla/database/database/sqlsrvquery.php
@@ -9,5 +9,4 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseQuerySqlsrv has moved to the database/query directory.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseQuerySqlsrv has moved to the database/query directory.', JLog::WARNING, 'deprecated');
View
1 libraries/joomla/html/html/select.php
@@ -328,7 +328,6 @@ public static function integerlist($start, $end, $inc, $name, $attribs = null, $
*/
public static function optgroup($text, $optKey = 'value', $optText = 'text')
{
- // Deprecation warning.
JLog::add('JSelect::optgroup is deprecated.', JLog::WARNING, 'deprecated');
// Set initial state
View
118 libraries/joomla/log/log.php
@@ -13,9 +13,6 @@
JLoader::discover('JLogger', __DIR__ . '/loggers');
-// @deprecated 12.1
-jimport('joomla.filesystem.path');
-
/**
* Joomla! Log Class
*
@@ -210,65 +207,6 @@ public static function addLogger(array $options, $priorities = self::ALL, $categ
}
/**
- * Returns a JLog object for a given log file/configuration, only creating it if it doesn't already exist.
- *
- * This method must be invoked as:
- * <code>$log = JLog::getInstance($file, $options, $path);</code>
- *
- * @param string $file The filename of the log file.
- * @param array $options The object configuration array.
- * @param string $path The base path for the log file.
- *
- * @return JLog
- *
- * @since 11.1
- *
- * @deprecated 12.1
- */
- public static function getInstance($file = 'error.php', $options = null, $path = null)
- {
- self::add('JLog::getInstance() is deprecated. See JLog::addLogger().', self::WARNING, 'deprecated');
-
- // Get the system configuration object.
- $config = JFactory::getConfig();
-
- // Set default path if not set and sanitize it.
- if (!$path)
- {
- $path = $config->get('log_path');
- }
-
- // If no options were explicitly set use the default from configuration.
- if (empty($options))
- {
- $options = (array) $config->get('log_options');
- }
-
- // Fix up the options so that we use the w3c format.
- $options['text_entry_format'] = empty($options['format']) ? null : $options['format'];
- $options['text_file'] = $file;
- $options['text_file_path'] = $path;
- $options['logger'] = 'w3c';
-
- // Generate a unique signature for the JLog instance based on its options.
- $signature = md5(serialize($options));
-
- // Only create the object if not already created.
- if (empty(self::$legacy[$signature]))
- {
- self::$legacy[$signature] = new JLog;
-
- // Register the configuration.
- self::$legacy[$signature]->configurations[$signature] = $options;
-
- // Setup the lookup to catch all.
- self::$legacy[$signature]->lookup[$signature] = (object) array('priorities' => self::ALL, 'categories' => array());
- }
-
- return self::$legacy[$signature];
- }
-
- /**
* Returns a reference to the a JLog object, only creating it if it doesn't already exist.
* Note: This is principally made available for testing and internal purposes.
*
@@ -287,62 +225,6 @@ public static function setInstance($instance)
}
/**
- * Method to add an entry to the log file.
- *
- * @param array $entry Array of values to map to the format string for the log file.
- *
- * @return mixed null|boolean
- *
- * @since 11.1
- *
- * @deprecated 12.1 Use JLog::add() instead.
- */
- public function addEntry($entry)
- {
- // Deprecation warning.
- self::add('JLog::addEntry() is deprecated, use JLog::add() instead.', self::WARNING, 'deprecated');
-
- // Easiest case is we already have a JLogEntry object to add.
- if ($entry instanceof JLogEntry)
- {
- return $this->addLogEntry($entry);
- }
- // We have either an object or array that needs to be converted to a JLogEntry.
- elseif (is_array($entry) || is_object($entry))
- {
- $tmp = new JLogEntry('');
- foreach ((array) $entry as $k => $v)
- {
- switch ($k)
- {
- case 'c-ip':
- $tmp->clientIP = $v;
- break;
- case 'status':
- $tmp->category = $v;
- break;
- case 'level':
- $tmp->priority = $v;
- break;
- case 'comment':
- $tmp->message = $v;
- break;
- default:
- $tmp->$k = $v;
- break;
- }
- }
- }
- // Unrecognized type.
- else
- {
- return false;
- }
-
- return $this->addLogEntry($tmp);
- }
-
- /**
* Method to add an entry to the appropriate loggers.
*
* @param JLogEntry $entry The JLogEntry object to send to the loggers.
View
8 libraries/joomla/plugin/helper.php
@@ -156,16 +156,12 @@ protected static function _import($plugin, $autocreate = true, JEventDispatcher
$plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type);
$plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name);
- $legacypath = JPATH_PLUGINS . '/' . $plugin->type . '/' . $plugin->name . '.php';
$path = JPATH_PLUGINS . '/' . $plugin->type . '/' . $plugin->name . '/' . $plugin->name . '.php';
- if (!isset($paths[$path]) || !isset($paths[$legacypath]))
+ if (!isset($paths[$path]))
{
- $pathExists = file_exists($path);
- if ($pathExists || file_exists($legacypath))
+ if (file_exists($path))
{
- $path = $pathExists ? $path : $legacypath;
-
if (!isset($paths[$path]))
{
require_once $path;
View
1 libraries/joomla/user/user.php
@@ -446,7 +446,6 @@ public function setLastVisit($timestamp = null)
public function getParameters($loadsetupfile = false, $path = null)
{
// @codeCoverageIgnoreStart
- // Deprecation warning.
JLog::add('JUser::getParameters() is deprecated.', JLog::WARNING, 'deprecated');
return $this->_params;
View
4 libraries/joomla/utilities/xmlelement.php
@@ -29,7 +29,7 @@ class JXMLElement extends SimpleXMLElement
*/
public function name()
{
- JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', self::WARNING, 'deprecated');
+ JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', JLog::WARNING, 'deprecated');
return (string) $this->getName();
}
@@ -47,7 +47,7 @@ public function name()
*/
public function asFormattedXML($compressed = false, $indent = "\t", $level = 0)
{
- JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', self::WARNING, 'deprecated');
+ JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', JLog::WARNING, 'deprecated');
$out = '';
// Start a new line, indent by the number indicated in $level
View
7 libraries/legacy/base/node.php
@@ -43,7 +43,6 @@ class JNode extends JObject
*/
public function __construct()
{
- // Deprecation warning.
JLog::add('JNode::__construct() is deprecated.', JLog::WARNING, 'deprecated');
return true;
@@ -62,7 +61,6 @@ public function __construct()
*/
public function addChild(&$child)
{
- // Deprecation warning.
JLog::add('JNode::addChild() is deprecated.', JLog::WARNING, 'deprecated');
if ($child instanceof Jnode)
@@ -84,7 +82,6 @@ public function addChild(&$child)
*/
public function setParent(&$parent)
{
- // Deprecation warning.
JLog::add('JNode::setParent() is deprecated.', JLog::WARNING, 'deprecated');
if ($parent instanceof JNode || is_null($parent))
@@ -111,7 +108,6 @@ public function setParent(&$parent)
*/
public function &getChildren()
{
- // Deprecation warning.
JLog::add('JNode::getChildren() is deprecated.', JLog::WARNING, 'deprecated');
return $this->_children;
@@ -126,7 +122,6 @@ public function &getChildren()
*/
public function &getParent()
{
- // Deprecation warning.
JLog::add('JNode::getParent() is deprecated.', JLog::WARNING, 'deprecated');
return $this->_parent;
@@ -141,7 +136,6 @@ public function &getParent()
*/
public function hasChildren()
{
- // Deprecation warning.
JLog::add('JNode::hasChildren() is deprecated.', JLog::WARNING, 'deprecated');
return (bool) count($this->_children);
@@ -156,7 +150,6 @@ public function hasChildren()
*/
public function hasParent()
{
- // Deprecation warning.
JLog::add('JNode::hasParent() is deprecated.', JLog::WARNING, 'deprecated');
return $this->getParent() != null;
View
4 libraries/legacy/base/tree.php
@@ -43,7 +43,6 @@ class JTree extends JObject
*/
public function __construct()
{
- // Deprecation warning.
JLog::add('JTree::__construct() is deprecated.', JLog::WARNING, 'deprecated');
$this->_root = new JNode('ROOT');
@@ -62,7 +61,6 @@ public function __construct()
*/
public function addChild(&$node, $setCurrent = false)
{
- // Deprecation warning.
JLog::add('JTree::addChild() is deprecated.', JLog::WARNING, 'deprecated');
$this->_current->addChild($node);
@@ -81,7 +79,6 @@ public function addChild(&$node, $setCurrent = false)
*/
public function getParent()
{
- // Deprecation warning.
JLog::add('JTree::getParent() is deprecated.', JLog::WARNING, 'deprecated');
$this->_current = &$this->_current->getParent();
@@ -96,7 +93,6 @@ public function getParent()
*/
public function reset()
{
- // Deprecation warning.
JLog::add('JTree::reset() is deprecated.', JLog::WARNING, 'deprecated');
$this->_current = &$this->_root;
View
45 libraries/legacy/controller/controller.php
@@ -316,6 +316,11 @@ public function __construct($config = array())
$this->redirect = null;
$this->taskMap = array();
+ if (JDEBUG)
+ {
+ JLog::addLogger(array('text_file' => 'jcontroller.log.php'), JLog::ALL, array('controller'));
+ }
+
// Determine the methods to exclude from the base class.
$xMethods = get_class_methods('JController');
@@ -502,17 +507,13 @@ protected function checkEditId($context, $id)
if (JDEBUG)
{
- JLog::getInstance('jcontroller.log.php')->addEntry(
- array(
- 'comment' => sprintf(
- 'Checking edit ID %s.%s: %d %s',
- $context,
- $id,
- (int) $result,
- str_replace("\n", ' ', print_r($values, 1))
- )
- )
- );
+ JLog::add(sprintf(
+ 'Checking edit ID %s.%s: %d %s',
+ $context,
+ $id,
+ (int) $result,
+ str_replace("\n", ' ', print_r($values, 1))
+ ), JLog::INFO, 'controller');
}
return $result;
@@ -872,11 +873,12 @@ protected function holdEditId($context, $id)
if (JDEBUG)
{
- JLog::getInstance('jcontroller.log.php')->addEntry(
- array(
- 'comment' => sprintf('Holding edit ID %s.%s %s', $context, $id, str_replace("\n", ' ', print_r($values, 1)))
- )
- );
+ JLog::add(sprintf(
+ 'Holding edit ID %s.%s %s',
+ $context,
+ $id,
+ str_replace("\n", ' ', print_r($values, 1))
+ ), JLog::INFO, 'controller');
}
}
}
@@ -976,11 +978,12 @@ protected function releaseEditId($context, $id)
if (JDEBUG)
{
- JLog::getInstance('jcontroller.log.php')->addEntry(
- array(
- 'comment' => sprintf('Releasing edit ID %s.%s %s', $context, $id, str_replace("\n", ' ', print_r($values, 1)))
- )
- );
+ JLog::add(sprintf(
+ 'Releasing edit ID %s.%s %s',
+ $context,
+ $id,
+ str_replace("\n", ' ', print_r($values, 1))
+ ), JLog::INFO, 'controller');
}
}
}
View
3 libraries/legacy/database/exception.php
@@ -9,8 +9,7 @@
defined('JPATH_PLATFORM') or die;
-// Deprecation warning.
-JLog::add('JDatabaseException is deprecated, use SPL Exceptions instead.', JLog::NOTICE, 'deprecated');
+JLog::add('JDatabaseException is deprecated, use SPL Exceptions instead.', JLog::WARNING, 'deprecated');
/**
* Exception class definition for the Database subpackage.
View
39 libraries/legacy/error/error.php
@@ -73,7 +73,6 @@
*/
public static function getError($unset = false)
{
- // Deprecation warning.
JLog::add('JError::getError() is deprecated.', JLog::WARNING, 'deprecated');
if (!isset(self::$stack[0]))
@@ -102,7 +101,6 @@ public static function getError($unset = false)
*/
public static function getErrors()
{
- // Deprecation warning.
JLog::add('JError::getErrors() is deprecated.', JLog::WARNING, 'deprecated');
return self::$stack;
@@ -120,7 +118,6 @@ public static function getErrors()
*/
public static function addToStack(JException &$e)
{
- // Deprecation warning.
JLog::add('JError::addToStack() is deprecated.', JLog::WARNING, 'deprecated');
self::$stack[] = &$e;
@@ -147,7 +144,6 @@ public static function addToStack(JException &$e)
*/
public static function raise($level, $code, $msg, $info = null, $backtrace = false)
{
- // Deprecation warning.
JLog::add('JError::raise() is deprecated.', JLog::WARNING, 'deprecated');
// Build error object
@@ -168,7 +164,6 @@ public static function raise($level, $code, $msg, $info = null, $backtrace = fal
*/
public static function throwError(&$exception)
{
- // Deprecation warning.
JLog::add('JError::throwError() is deprecated.', JLog::WARNING, 'deprecated');
static $thrown = false;
@@ -225,7 +220,6 @@ public static function throwError(&$exception)
*/
public static function raiseError($code, $msg, $info = null)
{
- // Deprecation warning.
JLog::add('JError::raiseError() is deprecated.', JLog::WARNING, 'deprecated');
return self::raise(E_ERROR, $code, $msg, $info, true);
@@ -250,7 +244,6 @@ public static function raiseError($code, $msg, $info = null)
*/
public static function raiseWarning($code, $msg, $info = null)
{
- // Deprecation warning.
JLog::add('JError::raiseWarning() is deprecated.', JLog::WARNING, 'deprecated');
return self::raise(E_WARNING, $code, $msg, $info);
@@ -274,7 +267,6 @@ public static function raiseWarning($code, $msg, $info = null)
*/
public static function raiseNotice($code, $msg, $info = null)
{
- // Deprecation warning.
JLog::add('JError::raiseNotice() is deprecated.', JLog::WARNING, 'deprecated');
return self::raise(E_NOTICE, $code, $msg, $info);
@@ -293,7 +285,6 @@ public static function raiseNotice($code, $msg, $info = null)
*/
public static function getErrorHandling($level)
{
- // Deprecation warning.
JLog::add('JError::getErrorHandling() is deprecated.', JLog::WARNING, 'deprecated');
return self::$handlers[$level];
@@ -328,7 +319,6 @@ public static function getErrorHandling($level)
*/
public static function setErrorHandling($level, $mode, $options = null)
{
- // Deprecation warning.
JLog::add('JError::setErrorHandling() is deprecated.', JLog::WARNING, 'deprecated');
$levels = self::$levels;
@@ -399,7 +389,6 @@ public static function setErrorHandling($level, $mode, $options = null)
*/
public static function attachHandler()
{
- // Deprecation warning.
JLog::add('JError::getErrorHandling() is deprecated.', JLog::WARNING, 'deprecated');
set_error_handler(array('JError', 'customErrorHandler'));
@@ -416,7 +405,6 @@ public static function attachHandler()
*/
public static function detachHandler()
{
- // Deprecation warning.
JLog::add('JError::detachHandler() is deprecated.', JLog::WARNING, 'deprecated');
restore_error_handler();
@@ -441,7 +429,6 @@ public static function detachHandler()
*/
public static function registerErrorLevel($level, $name, $handler = 'ignore')
{
- // Deprecation warning.
JLog::add('JError::registerErrorLevel() is deprecated.', JLog::WARNING, 'deprecated');
if (isset(self::$levels[$level]))
@@ -469,7 +456,6 @@ public static function registerErrorLevel($level, $name, $handler = 'ignore')
public static function translateErrorLevel($level)
{
- // Deprecation warning.
JLog::add('JError::translateErrorLevel() is deprecated.', JLog::WARNING, 'deprecated');
if (isset(self::$levels[$level]))
@@ -495,7 +481,6 @@ public static function translateErrorLevel($level)
*/
public static function handleIgnore(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleIgnore() is deprecated.', JLog::WARNING, 'deprecated');
return $error;
@@ -516,7 +501,6 @@ public static function handleIgnore(&$error, $options)
*/
public static function handleEcho(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleEcho() is deprecated.', JLog::WARNING, 'deprecated');
$level_human = self::translateErrorLevel($error->get('level'));
@@ -590,7 +574,6 @@ public static function handleEcho(&$error, $options)
*/
public static function handleVerbose(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleVerbose() is deprecated.', JLog::WARNING, 'deprecated');
$level_human = self::translateErrorLevel($error->get('level'));
@@ -637,7 +620,6 @@ public static function handleVerbose(&$error, $options)
*/
public static function handleDie(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleDie() is deprecated.', JLog::WARNING, 'deprecated');
$level_human = self::translateErrorLevel($error->get('level'));
@@ -679,7 +661,6 @@ public static function handleDie(&$error, $options)
*/
public static function handleMessage(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::hanleMessage() is deprecated.', JLog::WARNING, 'deprecated');
$appl = JFactory::getApplication();
@@ -704,22 +685,24 @@ public static function handleMessage(&$error, $options)
*/
public static function handleLog(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleLog() is deprecated.', JLog::WARNING, 'deprecated');
static $log;
if ($log == null)
{
- $fileName = date('Y-m-d') . '.error.log';
+ $options['text_file'] = date('Y-m-d') . '.error.log';
$options['format'] = "{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}";
- $log = JLog::getInstance($fileName, $options);
+ JLog::addLogger($options, JLog::ALL, array('error'));
}
- $entry['level'] = $error->get('level');
- $entry['code'] = $error->get('code');
- $entry['message'] = str_replace(array("\r", "\n"), array('', '\\n'), $error->get('message'));
- $log->addEntry($entry);
+ $entry = new JLogEntry(
+ str_replace(array("\r", "\n"), array('', '\\n'), $error->get('message')),
+ $error->get('level'),
+ 'error'
+ );
+ $entry->code = $error->get('code');
+ JLog::add($entry);
return $error;
}
@@ -739,7 +722,6 @@ public static function handleLog(&$error, $options)
*/
public static function handleCallback(&$error, $options)
{
- // Deprecation warning.
JLog::add('JError::handleCallback() is deprecated.', JLog::WARNING, 'deprecated');
return call_user_func($options, $error);
@@ -757,7 +739,6 @@ public static function handleCallback(&$error, $options)
*/
public static function customErrorPage(&$error)
{
- // Deprecation warning.
JLog::add('JError::customErrorPage() is deprecated.', JLog::WARNING, 'deprecated');
// Initialise variables.
@@ -815,7 +796,6 @@ public static function customErrorPage(&$error)
*/
public static function customErrorHandler($level, $msg)
{
- // Deprecation warning.
JLog::add('JError::customErrorHandler() is deprecated.', JLog::WARNING, 'deprecated');
self::raise($level, '', $msg);
@@ -833,7 +813,6 @@ public static function customErrorHandler($level, $msg)
*/
public static function renderBacktrace($error)
{
- // Deprecation warning.
JLog::add('JError::renderBacktrace() is deprecated.', JLog::WARNING, 'deprecated');
$contents = null;
View
14 libraries/legacy/exception/exception.php
@@ -114,7 +114,6 @@ class JException extends Exception
*/
public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false)
{
- // Deprecation warning.
JLog::add('JException is deprecated.', JLog::WARNING, 'deprecated');
$this->level = $level;
@@ -180,6 +179,8 @@ public function __construct($msg, $code = 0, $level = null, $info = null, $backt
*/
public function __toString()
{
+ JLog::add('JException::__toString is deprecated.', JLog::WARNING, 'deprecated');
+
return $this->message;
}
@@ -193,6 +194,8 @@ public function __toString()
*/
public function toString()
{
+ JLog::add('JException::toString is deprecated.', JLog::WARNING, 'deprecated');
+
return (string) $this;
}
@@ -210,6 +213,8 @@ public function toString()
*/
public function get($property, $default = null)
{
+ JLog::add('JException::get is deprecated.', JLog::WARNING, 'deprecated');
+
if (isset($this->$property))
{
return $this->$property;
@@ -230,6 +235,8 @@ public function get($property, $default = null)
*/
public function getProperties($public = true)
{
+ JLog::add('JException::getProperties is deprecated.', JLog::WARNING, 'deprecated');
+
$vars = get_object_vars($this);
if ($public)
{
@@ -258,7 +265,6 @@ public function getProperties($public = true)
*/
public function getError($i = null, $toString = true)
{
- // Deprecation warning.
JLog::add('JException::getError is deprecated.', JLog::WARNING, 'deprecated');
// Find the error
@@ -297,7 +303,6 @@ public function getError($i = null, $toString = true)
*/
public function getErrors()
{
- // Deprecation warning.
JLog::add('JException::getErrors is deprecated.', JLog::WARNING, 'deprecated');
return $this->_errors;
@@ -317,7 +322,6 @@ public function getErrors()
*/
public function set($property, $value = null)
{
- // Deprecation warning.
JLog::add('JException::set is deprecated.', JLog::WARNING, 'deprecated');
$previous = isset($this->$property) ? $this->$property : null;
@@ -338,7 +342,6 @@ public function set($property, $value = null)
*/
public function setProperties($properties)
{
- // Deprecation warning.
JLog::add('JException::setProperties is deprecated.', JLog::WARNING, 'deprecated');
// Cast to an array
@@ -370,7 +373,6 @@ public function setProperties($properties)
*/
public function setError($error)
{
- // Deprecation warning.
JLog::add('JException::setErrors is deprecated.', JLog::WARNING, 'deprecated');
array_push($this->_errors, $error);
View
4 libraries/legacy/log/logexception.php
@@ -9,6 +9,8 @@
defined('JPATH_PLATFORM') or die;
+JLog::add('LogException is deprecated, use SPL Exceptions instead.', JLog::WARNING, 'deprecated');
+
/**
* Exception class definition for the Log subpackage.
*
@@ -17,6 +19,6 @@
* @since 11.1
* @deprecated 12.3 Use semantic exceptions instead
*/
-class LogException extends Exception
+class LogException extends RuntimeException
{
}
View
12 libraries/legacy/module/helper.php
@@ -384,6 +384,8 @@ protected static function &_load()
* Caching modes:
* To be set in XML:
* 'static' One cache file for all pages with the same module parameters
+ * 'oldstatic' 1.5 definition of module caching, one cache file for all pages
+ * with the same module id and user aid,
* 'itemid' Changes on itemid change, to be called from inside the module:
* 'safeuri' Id created from $cacheparams->modeparams array,
* 'id' Module sets own cache id's
@@ -477,6 +479,16 @@ public static function moduleCache($module, $moduleparams, $cacheparams)
);
break;
+ case 'oldstatic': // provided for backward compatibility, not really usefull
+ $ret = $cache->get(
+ array($cacheparams->class, $cacheparams->method),
+ $cacheparams->methodparams,
+ $module->id . $view_levels,
+ $wrkarounds,
+ $wrkaroundoptions
+ );
+ break;
+
case 'itemid':
default:
$ret = $cache->get(
View
5 libraries/legacy/simplecrypt/simplecrypt.php
@@ -37,6 +37,8 @@ class JSimplecrypt
*/
public function __construct($privateKey = null)
{
+ JLog::add('JSimpleCrypt is deprecated. Use JCrypt instead.', JLog::WARNING, 'deprecated');
+
if (empty($privateKey))
{
$privateKey = md5(JFactory::getConfig()->get('secret'));
@@ -47,9 +49,6 @@ public function __construct($privateKey = null)
// Setup the JCrypt object.
$this->_crypt = new JCrypt(new JCryptCipherSimple, $key);
-
- // Deprecation warning.
- JLog::add('JSimpleCrypt is deprecated. Use JCrypt instead.', JLog::WARNING, 'deprecated');
}
/**
View
88 tests/suites/unit/joomla/log/JLogTest.php
@@ -39,74 +39,6 @@ protected function tearDown()
}
/**
- * Test the JLog::addEntry method to make sure if we give it invalid scalar input it will return false
- * just as in Joomla! CMS 1.5. This method is deprecated and will be removed in 11.2.
- *
- * @return void
- *
- * @since 11.1
- */
- public function testAddEntryWithInvalidScalarInput()
- {
- $log = new JLogInspector;
-
- $this->assertFalse($log->addEntry(123), 'Line: '.__LINE__);
- $this->assertFalse($log->addEntry('foobar'), 'Line: '.__LINE__);
- $this->assertFalse($log->addEntry(3.14), 'Line: '.__LINE__);
- }
-
- /**
- * Test the JLog::addEntry method to make sure if we give it valid array input as in Joomla! CMS 1.5 then
- * it will in fact add a log entry and transform it correctly. This method is deprecated and will be
- * removed in 11.2.
- *
- * @return void
- *
- * @since 11.1
- */
- public function testAddEntryWithValidArrayInput()
- {
- $log = new JLogInspector;
-
- // Create an array similar to expected input array from Joomla! CMS 1.5
- $entry = array(
- 'c-ip' => '127.0.0.1',
- 'status' => 'deprecated',
- 'level' => JLog::DEBUG,
- 'comment' => 'Test Entry',
- 'foo' => 'bar'
- );
-
- $log->addEntry($entry);
-
- // Verify all of the JLogEntry values.
- $this->assertEquals($log->queue[0]->category, 'deprecated', 'Line: '.__LINE__);
- $this->assertEquals($log->queue[0]->priority, JLog::DEBUG, 'Line: '.__LINE__);
- $this->assertEquals($log->queue[0]->message, 'Test Entry', 'Line: '.__LINE__);
- $this->assertEquals($log->queue[0]->foo, 'bar', 'Line: '.__LINE__);
- $this->assertEquals($log->queue[0]->clientIP, '127.0.0.1', 'Line: '.__LINE__);
- }
-
- /**
- * Test the JLog::addEntry method to make sure if we give it a valid JLogEntry object as input it will
- * correctly accept and add the entry. This method is deprecated and will be removed in 11.2.
- *
- * @return void
- *
- * @since 11.1
- */
- public function testAddEntryWithValidJLogEntry()
- {
- $log = new JLogInspector;
-
- $entry = new JLogEntry('TESTING', JLog::DEBUG);
-
- $log->addEntry($entry);
-
- $this->assertEquals($log->queue[0], $entry, 'Line: '.__LINE__);
- }
-
- /**
* Test the JLog::addLogEntry method to verify that if called directly it will route the entry to the
* appropriate loggers. We use the echo logger here for easy testing using the PHP output buffer.
*
@@ -377,26 +309,6 @@ public function testFindLoggersByPriorityAndCategory()
}
/**
- * Test the JLog::getInstance method to make sure we are getting a valid JLog instance from it. This
- * method is deprecated and will be removed in 11.2.
- *
- * @return void
- *
- * @since 11.1
- */
- public function testGetInstance()
- {
- // Make sure we are working with a clean instance.
- JLog::setInstance(null);
-
- // Get an instance of the JLog class.
- $log = JLog::getInstance();
-
- // Verify that it is a JLog.
- $this->assertTrue(($log instanceof JLog), 'Line: '.__LINE__);
- }
-
- /**
* Test the JLog::setInstance method to make sure that if we set a logger instance JLog is actually going
* to use it. We accomplish this by setting an instance of JLogInspector and then performing some
* operations using JLog::addLogger() to alter the state of the internal instance. We then check that the
Something went wrong with that request. Please try again.