mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
07a2c1ff0a
|
|
@ -24,7 +24,6 @@ repos:
|
|||
exclude: |
|
||||
(?x)^(htdocs/includes/.*)$
|
||||
# This checks that yaml files are correct
|
||||
args: [--branch, develop, --pattern, \d+.0$]
|
||||
- id: check-yaml
|
||||
args: [--unsafe]
|
||||
# This checks that json files are correct
|
||||
|
|
|
|||
|
|
@ -24864,18 +24864,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/product/canvas/product/actions_card_product.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$canvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/product/canvas/product/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$refalreadyexists might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/product/canvas/product/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Property ActionsCardService\:\:\$field_list has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
|
|
@ -24888,30 +24876,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/product/canvas/service/actions_card_service.class.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access property \$control on mixed\.$#'
|
||||
identifier: property.nonObject
|
||||
count: 2
|
||||
path: ../../htdocs/product/canvas/service/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$canvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/product/canvas/service/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$refalreadyexists might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/product/canvas/service/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$this might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../htdocs/product/canvas/service/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
|
|
@ -30450,24 +30414,6 @@ parameters:
|
|||
count: 3
|
||||
path: ../../htdocs/societe/canvas/company/tpl/card_view.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$canvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/societe/canvas/individual/tpl/card_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$canvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/societe/canvas/individual/tpl/card_edit.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$canvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../htdocs/societe/canvas/individual/tpl/card_view.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$objcanvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
|
|||
|
|
@ -1567,6 +1567,7 @@ function dol_get_object_properties($obj, $properties = [])
|
|||
* @param T $object Object to clone
|
||||
* @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended)
|
||||
* @return T Clone object
|
||||
*
|
||||
* @see https://php.net/manual/language.oop5.cloning.php
|
||||
* @phan-suppress PhanTypeExpectedObjectPropAccess
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,10 +63,11 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
|
|||
* @param string $memoryid Memory id of shared area
|
||||
* @param mixed $data Data to save. It must not be a null value.
|
||||
* @param int $expire ttl in seconds, 0 never expire
|
||||
* @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default)
|
||||
* @return int Return integer <0 if KO, 0 if nothing is done, Nb of bytes written if OK
|
||||
* @see dol_getcache()
|
||||
*/
|
||||
function dol_setcache($memoryid, $data, $expire = 0)
|
||||
function dol_setcache($memoryid, $data, $expire = 0, $filecache = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
|
@ -124,6 +125,31 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
|||
} elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { // This is a really not reliable cache ! Use Memcached instead.
|
||||
// Using shmop
|
||||
$result = dol_setshmop($memoryid, $data, $expire);
|
||||
} elseif ($filecache > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$now = dol_now();
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
$dircache = 'dolcache';
|
||||
$pathcache = DOL_DATA_ROOT.'/'.$dircache;
|
||||
if (!dol_is_dir($pathcache)) {
|
||||
$result = dol_mkdir($pathcache);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
if ($expire != 0) {
|
||||
$expire = dol_time_plus_duree($now, $expire, 's');
|
||||
}
|
||||
|
||||
$cachedata = array("expire" => $expire, "data" => $data);
|
||||
$cachejson = dolEncrypt(json_encode($cachedata));
|
||||
if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) {
|
||||
$result = file_put_contents($pathcache.'/'.$memoryid.'.cache', $cachejson);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// No intersession cache system available, we use at least the perpage cache
|
||||
$conf->cache['cachememory_'.$memoryid] = $data;
|
||||
|
|
@ -137,10 +163,11 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
|||
* Read a memory area shared by all users, all sessions on server
|
||||
*
|
||||
* @param string $memoryid Memory id of shared area
|
||||
* @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default)
|
||||
* @return int|mixed Return integer <0 if KO, data if OK, null if not found into cache or no caching feature enabled
|
||||
* @see dol_setcache()
|
||||
*/
|
||||
function dol_getcache($memoryid)
|
||||
function dol_getcache($memoryid, $filecache = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
|
@ -203,6 +230,31 @@ function dol_getcache($memoryid)
|
|||
// Using shmop
|
||||
$data = dol_getshmop($memoryid);
|
||||
return $data;
|
||||
} elseif ($filecache > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$now = dol_now();
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
$dircache = 'dolcache';
|
||||
$pathcache = DOL_DATA_ROOT.'/'.$dircache;
|
||||
if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) {
|
||||
return null;
|
||||
}
|
||||
$data = file_get_contents($pathcache.'/'.$memoryid.'.cache');
|
||||
if (!$data) {
|
||||
return -1;
|
||||
}
|
||||
$json = json_decode(dolDecrypt($data));
|
||||
if ($json->expire > $now) {
|
||||
return $json->data;
|
||||
} else {
|
||||
$result = dol_delete_file($pathcache.'/'.$memoryid.'.cache');
|
||||
if (!$result) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
// No intersession cache system available, we use at least the perpage cache
|
||||
if (isset($conf->cache['cachememory_'.$memoryid])) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -16,10 +16,14 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var Form $form
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $canvas
|
||||
* @var int $refalreadyexists
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -16,10 +16,14 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var Form $form
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $canvas
|
||||
* @var int $refalreadyexists
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var CommonObject $this
|
||||
* @var DoliDB $db
|
||||
* @var FormFile $formfile
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $canvas
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var CommonObject $this
|
||||
* @var DoliDB $db
|
||||
* @var FormFile $formfile
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $canvas
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var CommonObject $this
|
||||
* @var DoliDB $db
|
||||
* @var FormFile $formfile
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $canvas
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user