This repository has been archived by the owner. It is now read-only.

Remove deprecated methods in JLog + additional fixes #1183

Merged
merged 8 commits into from May 7, 2012
@@ -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);
}
@@ -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
@@ -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');
@@ -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
@@ -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');
@@ -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');
@@ -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');
@@ -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');
@@ -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');
@@ -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
@@ -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');
@@ -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');
/**
@@ -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');
@@ -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
@@ -13,9 +13,6 @@
JLoader::discover('JLogger', __DIR__ . '/loggers');
-// @deprecated 12.1
-jimport('joomla.filesystem.path');
-
/**
* Joomla! Log Class
*
@@ -209,65 +206,6 @@ public static function addLogger(array $options, $priorities = self::ALL, $categ
'categories' => array_map('strtolower', (array) $categories));
}
- /**
- * 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.
@@ -286,62 +224,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.
*
@@ -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;
@@ -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;
@@ -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
@@ -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;
Oops, something went wrong.