Skip to content

Commit

Permalink
Merge branch 'master' into task/zoho-L41-T499-codition-not-shown-corr…
Browse files Browse the repository at this point in the history
…ectly
  • Loading branch information
olleharstedt committed Mar 12, 2021
2 parents 8535114 + 200db35 commit 1e1a589
Show file tree
Hide file tree
Showing 589 changed files with 75,603 additions and 110,386 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Expand Up @@ -43,10 +43,12 @@ before_script:
# NB: PHPUnit 6.5.* is installed with composer.
- composer install
- ./third_party/bin/phpunit --version

- chmod -R 777 tmp
- chmod -R 777 upload
- chmod -R 777 themes # Need 777 so both console and web server can cd into the folder.
- chmod -R 777 tests/tmp

# InnoDb needs large_file_prefix & Barracuda file format
# https://discuss.gogs.io/t/solved-mysql-error-1064-while-running-first-install/1604
- sudo service mysql status
Expand All @@ -63,7 +65,9 @@ before_script:
- cp application/config/config-sample-mysql.php application/config/config.php
# Enable debug=2 in config file. OBS: This assumes debug is on line 61.
# TODO: Disable, a lines was added to config file and some tests started to fail.
# NB: EmCache is always disabled when debug => 2
# - sed -i '61s/.*/ "debug"=>2,/' application/config/config.php
# - cat application/config/config.php

# Install Apache.
# Code fetched from https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
Expand All @@ -84,9 +88,8 @@ before_script:
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart

# Check for syntax errors.
# NB: '!' doesn't work properly, see https://github.com/travis-ci/travis-ci/issues/7494
- "! find application/ -type f -name '*.php' -exec php -l {} \; | grep -v 'No syntax errors'"
# This will run syntax check, CodeSniffer, MessDetector, etc
- composer test

# Test server.
- wget localhost
Expand All @@ -111,5 +114,5 @@ before_script:

script:
# Run tests.
- DOMAIN=localhost ./third_party/bin/phpunit --stop-on-failure
- DOMAIN=localhost ./third_party/bin/phpunit --stop-on-failure --testdox
- yarn --cwd ./assets/packages/adminbasics run test
8 changes: 6 additions & 2 deletions application/commands/DemomodeCommand.php
Expand Up @@ -133,8 +133,12 @@ private function _createDemo()
$surveysToActivate[] = $result['newsid'];
}
}
require_once(__DIR__ . '/../helpers/admin/activate_helper.php');
array_map('activateSurvey', $surveysToActivate);
//require_once(__DIR__ . '/../helpers/admin/activate_helper.php');
foreach ($surveysToActivate as $surveyID) {
$survey = \Survey::model()->findByPk($surveyID);
$surveyActivator = new SurveyActivator($survey);
$result = $surveyActivator->activate();
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion application/commands/ResetPasswordCommand.php
Expand Up @@ -21,8 +21,11 @@ public function run($sArgument)
if (isset($sArgument) && isset($sArgument[0]) && isset($sArgument[1])) {
$oUser = User::findByUsername($sArgument[0]);
if ($oUser) {
Yii::import('application.helpers.common_helper', true);
$oUser->setPassword($sArgument[1]);
if ($oUser->save()) {
// Save the model validating only the password, because there may be issues with other attributes
// (like an invalid value for some setting), which the user cannot fix because he doesn't have access.
if ($oUser->save(true, ['password'])) {
echo "Password for user {$sArgument[0]} was set.\n";
return 0;
} else {
Expand Down
1 change: 1 addition & 0 deletions application/commands/UpdateDbCommand.php
Expand Up @@ -41,6 +41,7 @@ public function run($args = null)
echo Yii::app()->db->tablePrefix . " from {$currentDbVersion} to {$newDbVersion}\n";
Yii::import('application.helpers.common_helper', true);
Yii::import('application.helpers.update.updatedb_helper', true);
Yii::import('application.helpers.update.update_helper', true);
$result = db_upgrade_all($currentDbVersion);
if ($result) {
echo "Database has been successfully upgraded to version $newDbVersion \n";
Expand Down
35 changes: 32 additions & 3 deletions application/commands/WipeCommand.php
Expand Up @@ -26,6 +26,10 @@ public function run($sArgument)
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{answer_l10ns}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{asset_version}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{boxes}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{conditions}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{defaultvalues}}";
Expand All @@ -38,8 +42,11 @@ public function run($sArgument)
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{labelsets}}";
Yii::app()->db->createCommand($actquery)->execute();
$quotedGroups = Yii::app()->db->quoteTableName('{{groups}}');
$actquery = "truncate table $quotedGroups";
$actquery = "truncate table " . Yii::app()->db->quoteTableName('{{groups}}');
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{group_l10ns}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{notifications}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{questions}}";
Yii::app()->db->createCommand($actquery)->execute();
Expand All @@ -51,7 +58,9 @@ public function run($sArgument)
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{surveys_languagesettings}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "delete from {{permissions}} where uid<>1";
$actquery = "delete from {{permissions}} where id<>1";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{plugin_settings}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{permissiontemplates}}";
Yii::app()->db->createCommand($actquery)->execute();
Expand All @@ -73,6 +82,8 @@ public function run($sArgument)
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{participants}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{participant_attribute}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{participant_attribute_names}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{participant_attribute_names_lang}}";
Expand All @@ -85,14 +96,28 @@ public function run($sArgument)
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{saved_control}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{sessions}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{survey_links}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "delete from {{users}} where uid<>1";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "delete from {{surveys_groups}} where gsid<>1";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "delete from {{surveys_groupsettings}} where gsid>1";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{survey_url_parameters}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "truncate table {{user_in_permissionrole}}";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "update {{users}} set lang='en'";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "update {{users}} set lang='auto'";
Yii::app()->db->createCommand($actquery)->execute();
if (tableExists('{{auditlog_log}}')) {
$actquery = "truncate table {{auditlog_log}}";
Yii::app()->db->createCommand($actquery)->execute();
}
$actquery = "delete from {{settings_global}} where stg_name LIKE 'last_question%'";
Yii::app()->db->createCommand($actquery)->execute();
$actquery = "delete from {{settings_global}} where stg_name LIKE 'last_survey%'";
Expand All @@ -115,6 +140,10 @@ public function run($sArgument)
Yii::app()->db->createCommand()->insert("{{template_configuration}}", $templateConfiguration);
}

foreach ($boxesData = LsDefaultDataSets::getBoxesData() as $box) {
Yii::app()->db->createCommand()->insert("{{boxes}}", $box);
}

$surveyidresult = dbGetTablesLike("tokens%");
foreach ($surveyidresult as $sv) {
Yii::app()->db->createCommand("drop table " . $sv)->execute();
Expand Down
5 changes: 5 additions & 0 deletions application/commands/console.php
Expand Up @@ -60,6 +60,11 @@
if (!empty($env)) {
$app->commandRunner->addCommands($env);
}

// @see https://bugs.limesurvey.org/view.php?id=15500
Yii::import('application.helpers.ClassFactory');
ClassFactory::registerClass('Token_', 'Token');
ClassFactory::registerClass('Response_', 'Response');
}
$app->run();
?>
3 changes: 3 additions & 0 deletions application/config/config-defaults.php
Expand Up @@ -430,6 +430,9 @@
// QueXML: If set to true, the Data/Time answers will be formated with the survey's date format
$config['quexmlkeepsurveydateformat'] = false;

// QueXML: Width of the question title column in MM
$config['quexmlquestiontitlewidth'] = 14;

$config['minlengthshortimplode'] = 20; // Min length required to use short_implode instead of standard implode
$config['maxstringlengthshortimplode'] = 100; // short_implode: Max length of returned string

Expand Down
8 changes: 6 additions & 2 deletions application/config/fonts.php
Expand Up @@ -116,7 +116,9 @@
$userFontDir = $userFont->getFilename();
$configFile = $configUserFontsDir . DIRECTORY_SEPARATOR . $userFontDir . DIRECTORY_SEPARATOR . 'config.xml';
if (function_exists('simplexml_load_file') && file_exists($configFile)){
libxml_disable_entity_loader(false);
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader(false); // @see: http://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html#xml-external-entity-injection
}
$xml = simplexml_load_file($configFile);
$cssFiles = array();
foreach($xml->files->css as $file){
Expand All @@ -132,7 +134,9 @@
'basePath' => 'fonts',
'css' => $cssFiles,
);
libxml_disable_entity_loader(true);
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader(true);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/config/third_party.php
Expand Up @@ -29,7 +29,7 @@
'position' =>CClientScript::POS_HEAD,
'js' => array(
'jquery-3.5.1'.$minVersion.'.js',
'jquery-migrate-3.3.0'.$minVersion.'.js',
'jquery-migrate-3.3.2'.$minVersion.'.js',
)
),

Expand Down
6 changes: 3 additions & 3 deletions application/config/version.php
Expand Up @@ -11,10 +11,10 @@
* See COPYRIGHT.php for copyright notices and details.
*/

$config['versionnumber'] = '4.4.6';
$config['dbversionnumber'] = 437;
$config['versionnumber'] = '4.4.12';
$config['dbversionnumber'] = 441;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
$config['assetsversionnumber'] = '30189';
$config['assetsversionnumber'] = '30195';
return $config;

0 comments on commit 1e1a589

Please sign in to comment.