mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 09:08:42 +02:00
N°8772 - cache fix
This commit is contained in:
@@ -49,13 +49,13 @@ class FormBlockService
|
||||
public function GetFormBlockById(string $sId, string $sType): FormBlock
|
||||
{
|
||||
$sFilteredId = preg_replace('/[^0-9a-zA-Z_]/', '', $sId);
|
||||
if (strlen($sFilteredId) === 0) {
|
||||
if (strlen($sFilteredId) === 0 || $sFilteredId !== $sId) {
|
||||
throw new FormBlockException('Malformed name for block: '.json_encode($sId));
|
||||
}
|
||||
if (!$this->oCacheService->HasEntry(self::CACHE_POOL, $sFilteredId) || utils::IsDevelopmentEnvironment()) {
|
||||
// Cache not found, compile the form
|
||||
$sPHPContent = FormsCompiler::GetInstance()->CompileForm($sFilteredId, $sType);
|
||||
$this->oCacheService->StorePhpContent(FormBlockService::CACHE_POOL, $sId, "<?php\n\n$sPHPContent");
|
||||
$this->oCacheService->StorePhpContent(FormBlockService::CACHE_POOL, $sFilteredId, "<?php\n\n$sPHPContent");
|
||||
}
|
||||
$this->oCacheService->Fetch(self::CACHE_POOL, $sFilteredId);
|
||||
$sFormBlockClass = 'FormFor__'.$sFilteredId;
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Forms\Block\Base\ChoiceFromInputsBlock;
|
||||
use Combodo\iTop\Forms\Compiler\FormsCompiler;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use Symfony\Component\Validator\Constraints\NotNull;
|
||||
|
||||
class FormsCompilerTest extends ItopDataTestCase
|
||||
{
|
||||
@@ -17,7 +15,6 @@ class FormsCompilerTest extends ItopDataTestCase
|
||||
*
|
||||
* @param string $sXMLContent
|
||||
* @param string $sExpectedPHP
|
||||
* @param string $sMessage
|
||||
*
|
||||
* @return void
|
||||
* @throws \Combodo\iTop\Forms\Compiler\FormsCompilerException
|
||||
|
||||
Reference in New Issue
Block a user