merge hotfix

This commit is contained in:
Yuri Kuznetsov
2020-06-25 13:42:33 +03:00
6 changed files with 172 additions and 36 deletions
@@ -70,6 +70,8 @@ class SetPassword implements Command
$password = $this->ask();
$password = trim($password);
if (!$password) {
$this->out("Password can not be empty.\n");
die;
+63 -30
View File
@@ -109,6 +109,8 @@ class Parser
{
$isString = false;
$isSingleQuote = false;
$isComment = false;
$isLineComment = false;
$modifiedString = $string;
@@ -116,27 +118,31 @@ class Parser
for ($i = 0; $i < strlen($string); $i++) {
$isStringStart = false;
if ($string[$i] === "'" && ($i === 0 || $string[$i - 1] !== "\\")) {
if (!$isString) {
$isString = true;
$isSingleQuote = true;
$isStringStart = true;
} else {
if ($isSingleQuote) {
$isString = false;
if (!$isLineComment && !$isComment) {
if ($string[$i] === "'" && ($i === 0 || $string[$i - 1] !== "\\")) {
if (!$isString) {
$isString = true;
$isSingleQuote = true;
$isStringStart = true;
} else {
if ($isSingleQuote) {
$isString = false;
}
}
}
} else if ($string[$i] === "\"" && ($i === 0 || $string[$i - 1] !== "\\")) {
if (!$isString) {
$isString = true;
$isStringStart = true;
$isSingleQuote = false;
} else {
if (!$isSingleQuote) {
$isString = false;
} else if ($string[$i] === "\"" && ($i === 0 || $string[$i - 1] !== "\\")) {
if (!$isString) {
$isString = true;
$isStringStart = true;
$isSingleQuote = false;
} else {
if (!$isSingleQuote) {
$isString = false;
}
}
}
}
if ($isString) {
if ($string[$i] === '(' || $string[$i] === ')') {
$modifiedString[$i] = '_';
@@ -144,24 +150,51 @@ class Parser
$modifiedString[$i] = ' ';
}
} else {
if ($string[$i] === '(') {
$braceCounter++;
}
if ($string[$i] === ')') {
$braceCounter--;
}
if (!$isLineComment && !$isComment) {
if ($braceCounter === 0) {
if (!is_null($splitterIndexList)) {
if ($string[$i] === ';') {
$splitterIndexList[] = $i;
if (!$isComment) {
if ($i && $string[$i] === '/' && $string[$i - 1] === '/') {
$isLineComment = true;
}
}
if ($intoOneLine) {
if ($string[$i] === "\r" || $string[$i] === "\n" || $string[$i] === "\t") {
$string[$i] = ' ';
if (!$isLineComment) {
if ($i && $string[$i] === '*' && $string[$i - 1] === '/') {
$isComment = true;
}
}
if ($string[$i] === '(') {
$braceCounter++;
}
if ($string[$i] === ')') {
$braceCounter--;
}
if ($braceCounter === 0) {
if (!is_null($splitterIndexList)) {
if ($string[$i] === ';') {
$splitterIndexList[] = $i;
}
}
if ($intoOneLine) {
if ($string[$i] === "\r" || $string[$i] === "\n" || $string[$i] === "\t") {
$string[$i] = ' ';
}
}
}
}
if ($isLineComment) {
if ($string[$i] === "\n") {
$isLineComment = false;
}
}
if ($isComment) {
if ($string[$i - 1] === "*" && $string[$i] === "/") {
$isComment = false;
}
}
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ class ProcessJobQueueQ0 implements Job
public function run()
{
$limit = $this->config->get('jobQ1MaxPortion', 200);
$limit = $this->config->get('jobQ0MaxPortion', 200);
$this->cronManager->processPendingJobs('q0', $limit, true, true);
}
+7 -4
View File
@@ -102,11 +102,14 @@ class Metadata extends \Espo\Core\Services\Base
}
$foreignEntityType = $defs['entity'] ?? null;
if ($this->getAcl()->check($foreignEntityType)) continue;
if ($this->getUser()->isPortal()) {
if ($foreignEntityType === 'Account' || $foreignEntityType === 'Contact') {
continue;
if ($foreignEntityType) {
if ($this->getAcl()->check($foreignEntityType)) continue;
if ($this->getUser()->isPortal()) {
if ($foreignEntityType === 'Account' || $foreignEntityType === 'Contact') {
continue;
}
}
}
+3 -1
View File
@@ -462,6 +462,8 @@ define('views/site/navbar', 'view', function (Dep) {
updateSizeForVertical();
this.$el.find('.notifications-badge-container').insertAfter(this.$el.find('.quick-create-container'));
this.adjustBodyMinHeight();
},
getNavbarHeight: function () {
@@ -479,7 +481,7 @@ define('views/site/navbar', 'view', function (Dep) {
},
adjustBodyMinHeightVertical: function () {
var minHeight = this.$tabs.height() + this.getStaticItemsHeight();
var minHeight = this.$tabs.get(0).scrollHeight + this.getStaticItemsHeight();
var moreHeight = 0;
this.$more.find('> li:visible').each(function (i, el) {
@@ -193,4 +193,100 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase
$this->assertEquals([0, 1, 2], $vars->target);
}
public function testComment1()
{
$expression = "
// test
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment2()
{
$expression = "
// test'test
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment3()
{
$expression = "
// test\"test
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment4()
{
$expression = "
// test)(test
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment5()
{
$expression = "
/* test'test
*/
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment6()
{
$expression = "
/* test(test
*/
\$test = '1';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('1', $vars->test);
}
public function testComment7()
{
$expression = "
\$test = '/* 1 */';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('/* 1 */', $vars->test);
}
public function testComment8()
{
$expression = "
\$test = '// 1 */';
";
$vars = (object) [];
$this->evaluator->process($expression, null, $vars);
$this->assertEquals('// 1 */', $vars->test);
}
}