Commit 625578d5 authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski

Drop 9.4.1 and 9.4.2 deprecateds

parent 7e889a05
......@@ -50,7 +50,10 @@ The present file will list all changes made to the project; according to the
- `CommonDBRelation::getSQLRequestToSearchForItem()`
- `Project::addVisibility()`
- `Project::addVisibilityJoins()`
- `Plugin::hasBeenInit()`
- 'SELECT DISTINCT' and 'DISTINCT FIELDS' criteria in `DBmysqlIterator::buildQuery()`
- `CommonDBTM::getTablesOf()`
- `CommonDBTM::getForeignKeyFieldsOf()`
## [9.4.2] unreleased
......
......@@ -174,20 +174,6 @@ class CommonDBTM extends CommonGLPI {
}
/**
* Get known tables
*
* @return array
*
* @deprecated 9.4.2
*/
public static function getTablesOf() {
Toolbox::deprecated();
return self::$tables_of;
}
/**
* Return the table used to store this object
*
......@@ -224,20 +210,6 @@ class CommonDBTM extends CommonGLPI {
}
/**
* Get known foreign keys
*
* @return array
*
* @deprecated 9.4.2
*/
public static function getForeignKeyFieldsOf() {
Toolbox::deprecated();
return self::$foreign_key_fields_of;
}
static function getForeignKeyField() {
$classname = get_called_class();
......@@ -462,8 +434,6 @@ class CommonDBTM extends CommonGLPI {
/**
* Retrieve all items from the database
*
* @since 9.4 string condition is deprecated
*
* @param array $condition condition used to search if needed (empty get all) (default '')
* @param array|string $order order field if needed (default '')
* @param integer $limit limit retrieved data if needed (default '')
......
......@@ -137,7 +137,6 @@ class DBmysqlIterator implements Iterator, Countable {
// Check field, orderby, limit, start in criterias
$field = "";
$dfield = "";
$distinct = false;
$orderby = null;
$limit = 0;
......@@ -155,12 +154,6 @@ class DBmysqlIterator implements Iterator, Countable {
unset($crit[$key]);
break;
case 'SELECT DISTINCT' :
case 'DISTINCT FIELDS' :
$dfield = $val;
unset($crit[$key]);
break;
case 'DISTINCT' :
if ($val) {
$distinct = true;
......@@ -214,30 +207,6 @@ class DBmysqlIterator implements Iterator, Countable {
$this->sql = 'SELECT ';
$first = true;
// Backward compatibility for "SELECT DISTINCT" and "DISTINCT FIELDS"
if (!empty($dfield)) {
Toolbox::logWarning('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
// Merge $field and $dfield
if (empty($field)) {
$field = $dfield;
} else {
if (is_array($field) && is_array($dfield)) {
$field = array_merge($dfield, $field);
} else if (is_array($field) && !is_array($dfield)) {
array_unshift($field, $dfield);
} else if (!is_array($field) && is_array($dfield)) {
$dfield[] = $field;
$field = $dfield;
} else { // both are strings
$field = [$dfield, $field];
}
}
$distinct = true;
unset($dfield);
}
// SELECT field list
if ($count) {
$this->sql .= 'COUNT(';
......
......@@ -133,20 +133,6 @@ class Plugin extends CommonDBTM {
}
/**
* Are plugin initialized (Plugin::Init() called)
*
* @return boolean
*
* @deprecated 9.4.1
*/
public static function hasBeenInit() {
Toolbox::deprecated();
return self::$plugins_init;
}
/**
* Init a plugin including setup.php file
* launching plugin_init_NAME function after checking compatibility
......
......@@ -199,52 +199,6 @@ class DBmysqlIterator extends DbTestCase {
$it = $this->it->execute('foo', ['FIELDS' => ['MAX' => 'bar AS cpt']]);
$this->string($it->getSql())->isIdenticalTo('SELECT MAX(`bar`) AS cpt FROM `foo`');
// Backward compability tests
$this->exception(
function() {
$it = $this->it->execute('foo', ['DISTINCT FIELDS' => ['bar', 'baz']]);
$this->string($it->getSql())->isIdenticalTo('SELECT DISTINCT `bar`, `baz` FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
$this->exception(
function() {
$it = $this->it->execute('foo', ['DISTINCT FIELDS' => ['bar'], 'FIELDS' => ['baz']]);
$this->string($it->getSql())->isIdenticalTo('SELECT DISTINCT `bar`, `baz` FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
$this->exception(
function() {
$it = $this->it->execute('foo', ['DISTINCT FIELDS' => 'bar', 'FIELDS' => ['baz']]);
$this->string($it->getSql())->isIdenticalTo('SELECT DISTINCT `bar`, `baz` FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
$this->exception(
function() {
$it = $this->it->execute('foo', ['DISTINCT FIELDS' => ['bar'], 'FIELDS' => 'baz']);
$this->string($it->getSql())->isIdenticalTo('SELECT DISTINCT `bar`, `baz` FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
$this->exception(
function() {
$it = $this->it->execute('foo', ['DISTINCT FIELDS' => 'bar', 'FIELDS' => 'baz']);
$this->string($it->getSql())->isIdenticalTo('SELECT DISTINCT `bar`, `baz` FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
}
......@@ -320,16 +274,6 @@ class DBmysqlIterator extends DbTestCase {
$it = $this->it->execute('foo', ['FIELDS' => ['foo.bar', 'COUNT' => ['foo.baz', 'foo.qux']]]);
$this->string($it->getSql())->isIdenticalTo('SELECT `foo`.`bar`, COUNT(`foo`.`baz`), COUNT(`foo`.`qux`) FROM `foo`');
// Backward compability tests
$this->exception(
function() {
$it = $this->it->execute('foo', ['COUNT' => 'cpt', 'SELECT DISTINCT' => 'bar']);
$this->string($it->getSql())->isIdenticalTo('SELECT COUNT(DISTINCT `bar`) AS cpt FROM `foo`');
}
)
->isInstanceOf('RuntimeException')
->message->contains('"SELECT DISTINCT" and "DISTINCT FIELDS" are depreciated.');
}
public function testCountDistinct() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment