Removed deprecated REST API
Prepare code to be compatible with swagger v2
This commit is contained in:
parent
92753273b9
commit
a5a9b9b23f
@ -15,22 +15,24 @@ WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The methode "cloture" on contract were renamed into "closeAll".
|
||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||
* The substitution key for reference of objects is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||
__PROPALREF__, ...)
|
||||
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
|
||||
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
||||
* Removed old deprecated REST API (APIs found into '/root' section of the REST API explorer in Dolibarr v6).
|
||||
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
|
||||
common API "/setup".
|
||||
* The REST API /documents were renamed into /documents/download and /documents/upload.
|
||||
* Page bank/index.php, bank/bankentries.php and comm/actions/listactions.php were renamed into
|
||||
bank/list.php, bank/bankentries_list.php and comm/actions/list.php to follow page naming
|
||||
conventions (so default filter/sort order features can also work).
|
||||
conventions (so default filter/sort order features can also work for this pages).
|
||||
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED.
|
||||
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY.
|
||||
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced).
|
||||
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
||||
* Removed js library 'fileupload' that was not used by core code.
|
||||
* IE8 and earlier and Firefox 12 and earlier (2012) are no more supported.
|
||||
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||
FIX: #7211 Update qty dispatched on qty change
|
||||
|
||||
@ -96,7 +96,7 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||
|
||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||
$refreshcache=false;
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
$refreshcache=true;
|
||||
}
|
||||
@ -109,7 +109,7 @@ $api = new DolibarrApi($db, '', $refreshcache);
|
||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
||||
|
||||
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
|
||||
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat'); // 'YamlFormat'
|
||||
$api->r->addAuthenticationClass('DolibarrApiAccess','');
|
||||
|
||||
// Define accepted mime types
|
||||
@ -118,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
||||
|
||||
|
||||
// Call Explorer file for all APIs definitions
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
// Scan all API files to load them
|
||||
|
||||
@ -164,7 +164,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
|
||||
// Support of the deprecated API.
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
/*if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
{
|
||||
$classname = ucwords($regapi[1]).'Api';
|
||||
require_once $dir_part.$file_searched;
|
||||
@ -178,7 +178,8 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
else*/
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
{
|
||||
$classname = ucwords($regapi[1]);
|
||||
$classname = str_replace('_', '', $classname);
|
||||
@ -213,15 +214,16 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
{
|
||||
$api->r->addAPIClass($classname, $apiname);
|
||||
}
|
||||
//var_dump($api->r);
|
||||
}
|
||||
|
||||
// Call one APIs or one definition of an API
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
|
||||
{
|
||||
$module = $reg[1];
|
||||
if ($module == 'explorer') // If we call page to explore details of a service
|
||||
{
|
||||
$module = $regbis[1];
|
||||
$module = $regbis[2];
|
||||
}
|
||||
|
||||
$module=strtolower($module);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user