From d065dbbb3227e098d339dae205884c14aa923b23 Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Sat, 18 Feb 2017 20:10:20 +0100 Subject: [PATCH 1/4] [fix] Use github link for source file - Fix https://github.com/YunoHost-Apps/limesurvey_ynh/issues/17 - Here get a specific commit (specific command action for plugin) --- app.src | 6 +++--- manifest.json | 2 +- scripts/_common.sh | 28 ++++++++++++++-------------- scripts/install | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app.src b/app.src index f1d34ed..8202979 100644 --- a/app.src +++ b/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://www.limesurvey.org/stable-release?download=1994:limesurvey2622%20170203targz -SOURCE_SUM=04aef224292ebacbfdf5c92cedc94de2f5900688bde33481a8908b15023df933 -SOURCE_FILE=limesurvey2.62.2+170203.tar.gz +SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/a46075a10b6244c850ee11dcf283d38bdd7d8ad5.tar.gz +SOURCE_SUM=b06778cd6747e4106953810d5aefe9f12d968a3910ce48159bcbb2fe5a61d486 +SOURCE_FILE=limesurvey_2.6.2.1.tar.gz diff --git a/manifest.json b/manifest.json index ba8b605..a1d859f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "LimeSurvey", "id": "limesurvey", "packaging_format": 1, - "version": "2.62.2", + "version": "2.62.2.1", "description": { "en": "LimeSurvey is used to create advanced poll.", "fr": "LimeSurvey est un outil de création et diffusion de sondage en ligne." diff --git a/scripts/_common.sh b/scripts/_common.sh index 9b09134..643c1ec 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,14 +7,14 @@ ynh_check_var () { test -n "$1" || ynh_die "$2" } -ynh_exit_properly () { +ynh_exit_properly () { exit_code=$? if [ "$exit_code" -eq 0 ]; then - exit 0 + exit 0 fi trap '' EXIT set +eu - echo -e "\e[91m \e[1m" + echo -e "\e[91m \e[1m" err "$app script has encountered an error." if type -t CLEAN_SETUP > /dev/null; then @@ -89,7 +89,7 @@ ynh_local_path_available () { fi } -# Save listed var in YunoHost app settings +# Save listed var in YunoHost app settings # usage: ynh_save_args VARNAME1 [VARNAME2 [...]] ynh_save_args () { for var in $@; @@ -113,7 +113,7 @@ ynh_mysql_generate_db () { export db_pwd=$(ynh_string_random) # Generate a random password ynh_check_var "$db_pwd" "db_pwd empty" - + ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database ynh_app_setting_set $app mysqlpwd $db_pwd # Store the password in the app's config @@ -161,9 +161,9 @@ ynh_setup_source () { fi echo "$SOURCE_SUM $SOURCE_FILE" |$SUM_PRG -c --status \ || ynh_die "Corrupt source" - + sudo mkdir -p "$DEST" - sudo chown $AS_USER: "$DEST" + sudo chown $AS_USER: "$DEST" if [ "$(echo ${SOURCE_FILE##*.})" == "gz" ]; then ynh_exec_as "$AS_USER" tar xf $SOURCE_FILE -C "$DEST" --strip-components 1 elif [ "$(echo ${SOURCE_FILE##*.})" == "bz2" ]; then @@ -171,18 +171,18 @@ ynh_setup_source () { elif [ "$(echo ${SOURCE_FILE##*.})" == "zip" ]; then mkdir -p "/tmp/$SOURCE_FILE" ynh_exec_as "$AS_USER" unzip -q $SOURCE_FILE -d "/tmp/$SOURCE_FILE" - ynh_exec_as "$AS_USER" mv "/tmp/$SOURCE_FILE"/./. "$DEST" + ynh_exec_as "$AS_USER" mv "/tmp/$SOURCE_FILE"/./. "$DEST" rmdir "$/tmp/$SOURCE_FILE" else false fi - + # Apply patches if [ -f ${PKG_DIR}/patches/$SOURCE_ID-*.patch ]; then (cd "$DEST" \ && for p in ${PKG_DIR}/patches/$SOURCE_ID-*.patch; do \ ynh_exec_as "$AS_USER" patch -p1 < $p; done) \ - || ynh_die "Unable to apply patches" + || ynh_die "Unable to apply patches" fi @@ -324,13 +324,13 @@ Homepage: {{ project_url }} Standards-Version: 3.9.2 Package: {{ dep_app }}-ynh-deps -Version: {{ version }} +Version: {{ version }} Depends: {{ dependencies }} Architecture: all Description: meta package for {{ app }} (YunoHost app) dependencies This meta-package is only responsible of installing its dependencies. EOF - + ynh_configure app-ynh-deps.control ./$dep_app-ynh-deps.control ynh_package_install_from_equivs ./$dep_app-ynh-deps.control \ || ynh_die "Unable to install dependencies" @@ -387,11 +387,11 @@ ynh_configure_php_fpm () { finalphpconf=/etc/php5/fpm/pool.d/$app.conf ynh_configure php-fpm.conf /etc/php5/fpm/pool.d/$app.conf sudo chown root: $finalphpconf - + finalphpini=/etc/php5/fpm/conf.d/20-$app.ini sudo cp ../conf/php-fpm.ini $finalphpini sudo chown root: $finalphpini - + sudo service php5-fpm reload } diff --git a/scripts/install b/scripts/install index 6eef0a2..4205cbb 100755 --- a/scripts/install +++ b/scripts/install @@ -34,10 +34,10 @@ ynh_mysql_generate_db "$user" "$app" ynh_system_user_create "$user" "$local_path" ynh_setup_source "$local_path" "$user" - + ynh_configure config.php "$local_path/application/config/config.php" -# Fill LimeSurvey database +# Fill LimeSurvey database @todo replace by command action from limesurvey sed "s/\`prefix_/\`$prefix/g" $local_path/installer/sql/create-mysql.sql > ./structure.sql mysql -u $db_user -p$db_pwd $db_user < ./structure.sql ynh_configure data.sql ./data.sql @@ -53,10 +53,10 @@ set -x ynh_set_default_perm $local_path sudo chmod -R u+w $local_path/tmp sudo chmod -R u+w $local_path/upload -sudo chmod -R u+w $local_path/application/config/ +#~ sudo chmod -R u+w $local_path/application/config/ sudo yunohost app addaccess $app -u $admin -ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts" +ynh_sso_access "/index.php?r=admin" ynh_configure_php_fpm ynh_configure_nginx From b02660cf9d2480b4c4df4a5ac02a64e66795e663 Mon Sep 17 00:00:00 2001 From: shnoulle Date: Mon, 20 Feb 2017 16:16:44 +0100 Subject: [PATCH 2/4] [fix] https://github.com/YunoHost-Apps/limesurvey_ynh/issues/24 using config.php [fix] partially https://github.com/YunoHost-Apps/limesurvey_ynh/issues/25 using an alt user for super-super-admin [dev] Add a activatePlugin (to manage ls via a ynh plugin (when i done it) [dev] Little fix on installer (warning when testing files in patch directory) [dev] Using LimeSurvey install command for installing --- conf/config.php.j2 | 7 ++- conf/data.sql.j2 | 21 ++++--- patches/app-0001-7ca4932.patch | 106 --------------------------------- scripts/_common.sh | 2 +- scripts/install | 12 ++-- 5 files changed, 21 insertions(+), 127 deletions(-) delete mode 100644 patches/app-0001-7ca4932.patch diff --git a/conf/config.php.j2 b/conf/config.php.j2 index 5a99217..a27eca8 100644 --- a/conf/config.php.j2 +++ b/conf/config.php.j2 @@ -56,7 +56,12 @@ return array( // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates 'debug'=>0, 'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2 - 'enableLdap'=>true + /* yunohost part */ + 'auth_webserver_user_map' => array( '{{ admin }}'=>'ynh_admin'),// Primary user as ynh admin + 'auth_webserver_autocreate_user'=>1, + 'auth_webserver_autocreate_permissions'=>array( + 'superadmin' => array('create'=>true,'read'=>true,'update'=>true,'delete'=>true), + ), ) ); /* End of file config.php */ diff --git a/conf/data.sql.j2 b/conf/data.sql.j2 index b53db1f..a736dce 100644 --- a/conf/data.sql.j2 +++ b/conf/data.sql.j2 @@ -1,4 +1,4 @@ -INSERT INTO `lime_plugins` (`id`, `name`, `active`) VALUES +INSERT INTO `lime_plugins` (`id`, `name`, `active`) VALUES (2,'AuditLog',0), (3,'oldUrlCompat',0), (4,'ExportR',0), @@ -6,15 +6,9 @@ INSERT INTO `lime_plugins` (`id`, `name`, `active`) VALUES (6,'extendedStartPage',0), (7,'ExportSTATAxml',0), (8,'QuickMenu',0), -(9,'AuthLDAP',0); +(9,'AuthLDAP',1); -INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES -(1,'global',0,1,'superadmin',0,1,0,0,0,0), -(2,'global',0,2,'auth_ldap',0,1,0,0,0,0), -(3,'global',0,2,'surveys',1,0,0,0,0,0); - - -INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES +INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES (1,9,NULL,NULL,'server','\"ldap:\\/\\/localhost\"'), (2,9,NULL,NULL,'ldapport','\"\"'), (3,9,NULL,NULL,'ldapversion','\"3\"'), @@ -41,8 +35,13 @@ INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key INSERT INTO `lime_settings_global` VALUES ('defaultlang','{{ language }}'),('AssetsVersion','2620'); -INSERT INTO `lime_users` VALUES (1,'{{ admin }}','9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08','Administrator',0,'{{ language }}','','default','default','default',NULL,1,'2017-02-02 01:03:08',NULL); +INSERT INTO `lime_users` VALUES (2,'{{ admin }}','9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08','Administrator',0,'{{ language }}','','default','default','default',NULL,1,'2017-02-02 01:03:08',NULL); + +INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES +(2,'global',0,2,'superadmin',0,1,0,0,0,0), +(3,'global',0,2,'auth_ldap',0,1,0,0,0,0), +(4,'global',0,2,'auth_webserver',0,1,0,0,0,0); {% if is_public == "1" %} UPDATE `lime_plugin_settings` SET value='\"0\"' WHERE `id`=21; -{% endif %} +{% endif %} diff --git a/patches/app-0001-7ca4932.patch b/patches/app-0001-7ca4932.patch deleted file mode 100644 index 1394085..0000000 --- a/patches/app-0001-7ca4932.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 7ca49326dafe4d9896e67aebe414edcd3ce8c1af Mon Sep 17 00:00:00 2001 -From: Denis Chenu -Date: Thu, 19 Jan 2017 00:02:45 +0100 -Subject: [PATCH] [feature] Allow update via PHP cli - ---- - application/commands/UpdateCommand.php | 90 ++++++++++++++++++++++++++++++++++ - 1 files changed, 90 insertions(+) - create mode 100644 application/commands/UpdateCommand.php - -diff --git a/application/commands/UpdateCommand.php b/application/commands/UpdateCommand.php -new file mode 100644 -index 0000000..41ef107 ---- /dev/null -+++ b/application/commands/UpdateCommand.php -@@ -0,0 +1,90 @@ -+ -+ * @license GPL v3 -+ * @version 0.1 -+ * -+ * Copyright (C) 2017 Denis Chenu -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU Affero General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ */ -+class UpdateCommand extends CConsoleCommand -+{ -+ public function run(){ -+ $this->_setConfigs(); -+ $newDbVersion = (float)Yii::app()->getConfig('dbversionnumber'); -+ $currentDbVersion = (float)Yii::app()->getConfig('DBVersion'); -+ if($newDbVersion > $currentDbVersion){ -+ echo "Update ".Yii::app()->db->connectionString.", prefix :".Yii::app()->db->tablePrefix." from {$currentDbVersion} to {$newDbVersion}\n"; -+ Yii::import('application.helpers.common_helper', true); -+ Yii::import('application.helpers.update.updatedb_helper', true); -+ $result=db_upgrade_all($currentDbVersion);/* @todo : fix bad echoing here */ -+ if ($result) { -+ //printf(gT("Database has been successfully upgraded to version %s"),$dbversionnumber)."\n"; -+ echo "Database has been successfully upgraded to version $newDbVersion \n"; -+ } else { -+ //echo gT("Please fix this error in your database and try again")."\n"; -+ echo "Please fix this error in your database and try again\n"; -+ } -+ } else { -+ echo "no need update ".$newDbVersion ." ". $currentDbVersion ."\n"; -+ } -+ } -+ -+ /** -+ * Fonction to set all needed (and unneeded) config -+ * @return void -+ */ -+ private function _setConfigs(){ -+ /* default config */ -+ $aDefaultConfigs = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config-defaults.php'); -+ foreach($aDefaultConfigs as $sConfig=>$defaultConfig){ -+ Yii::app()->setConfig($sConfig,$defaultConfig); -+ } -+ /* Fix for badly set rootdir */ -+ $sRootDir=realpath(Yii::app()->basePath. DIRECTORY_SEPARATOR . "..") ; -+ Yii::app()->setConfig('rootdir',$sRootDir); -+ Yii::app()->setConfig('publicdir',$sRootDir); -+ Yii::app()->setConfig('homedir',$sRootDir); -+ Yii::app()->setConfig('tempdir',$sRootDir.DIRECTORY_SEPARATOR."tmp"); -+ Yii::app()->setConfig('imagedir',$sRootDir.DIRECTORY_SEPARATOR."images"); -+ Yii::app()->setConfig('uploaddir',$sRootDir.DIRECTORY_SEPARATOR."upload"); -+ Yii::app()->setConfig('standardtemplaterootdir',$sRootDir.DIRECTORY_SEPARATOR."templates"); -+ Yii::app()->setConfig('usertemplaterootdir',$sRootDir.DIRECTORY_SEPARATOR."upload".DIRECTORY_SEPARATOR."templates"); -+ Yii::app()->setConfig('styledir',$sRootDir.DIRECTORY_SEPARATOR."styledir"); -+ /* version */ -+ $aVersionConfigs = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'version.php'); -+ foreach($aVersionConfigs as $sConfig=>$versionConfig){ -+ Yii::app()->setConfig($sConfig,$versionConfig); -+ } -+ /* LS 3 version */ -+ Yii::app()->setConfig('runtimedir',$sRootDir.DIRECTORY_SEPARATOR."tmp".DIRECTORY_SEPARATOR."runtime"); -+ if(file_exists(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php')) -+ { -+ $config = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'); -+ if(is_array($config['config']) && !empty($config['config'])) -+ { -+ foreach($config['config'] as $key=>$value) -+ Yii::app()->setConfig($key,$value); -+ } -+ } -+ $oSettings=SettingGlobal::model()->findAll(); -+ if (count($oSettings) > 0) -+ { -+ foreach ($oSettings as $oSetting) -+ { -+ Yii::app()->setConfig($oSetting->getAttribute('stg_name'), $oSetting->getAttribute('stg_value')); -+ } -+ } -+ } -+ -+} -+?> diff --git a/scripts/_common.sh b/scripts/_common.sh index 643c1ec..6f88e5d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -178,7 +178,7 @@ ynh_setup_source () { fi # Apply patches - if [ -f ${PKG_DIR}/patches/$SOURCE_ID-*.patch ]; then + if [ $(find ${PKG_DIR}/patches/ -type f -name "$SOURCE_ID-*.patch" | wc -l) ]; then (cd "$DEST" \ && for p in ${PKG_DIR}/patches/$SOURCE_ID-*.patch; do \ ynh_exec_as "$AS_USER" patch -p1 < $p; done) \ diff --git a/scripts/install b/scripts/install index 4205cbb..e0c804f 100755 --- a/scripts/install +++ b/scripts/install @@ -37,18 +37,14 @@ ynh_setup_source "$local_path" "$user" ynh_configure config.php "$local_path/application/config/config.php" -# Fill LimeSurvey database @todo replace by command action from limesurvey -sed "s/\`prefix_/\`$prefix/g" $local_path/installer/sql/create-mysql.sql > ./structure.sql -mysql -u $db_user -p$db_pwd $db_user < ./structure.sql -ynh_configure data.sql ./data.sql -mysql -u $db_user -p$db_pwd $db_user < ./data.sql - # Randomize Password user ls_cli=$local_path/application/commands/console.php set +x -ynh_exec_as "$user" php $ls_cli resetpassword "$admin" "$(ynh_string_random 24)" +ynh_exec_as "$user" php $ls_cli install "ynh_admin" "$(ynh_string_random 24)" "Administrator" "$admin@$domain" set -x - +# Setup^extra DB part (@todo : replace by a plugin system) +ynh_configure data.sql ./data.sql +mysql -u $db_user -p$db_pwd $db_user < ./data.sql # Set permissions ynh_set_default_perm $local_path sudo chmod -R u+w $local_path/tmp From d574e836c9788af9492c55c32469c0972ffe17b8 Mon Sep 17 00:00:00 2001 From: Shnoulle Date: Mon, 20 Feb 2017 16:21:45 +0100 Subject: [PATCH 3/4] [dev][fix] Add the patchs :whistle: --- patches/app-0001-14c81c8.patch | 107 +++++++++++++++++++++++++++++++++ patches/app-0002-301de6e.patch | 87 +++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 patches/app-0001-14c81c8.patch create mode 100644 patches/app-0002-301de6e.patch diff --git a/patches/app-0001-14c81c8.patch b/patches/app-0001-14c81c8.patch new file mode 100644 index 0000000..fe54360 --- /dev/null +++ b/patches/app-0001-14c81c8.patch @@ -0,0 +1,107 @@ +From 14c81c86b7692794e7b251de3628f9afe353e020 Mon Sep 17 00:00:00 2001 +From: Denis Chenu +Date: Wed, 15 Feb 2017 01:15:35 +0100 +Subject: [PATCH] [feature][yunohost] Allow update via PHP cli - Included in + LimeSurvey 3.0 + +--- + application/commands/UpdateCommand.php | 90 ++++++++++++++++++++++++++++++++++ + 1 file changed, 90 insertions(+) + create mode 100644 application/commands/UpdateCommand.php + +diff --git a/application/commands/UpdateCommand.php b/application/commands/UpdateCommand.php +new file mode 100644 +index 0000000..faa216f +--- /dev/null ++++ b/application/commands/UpdateCommand.php +@@ -0,0 +1,90 @@ ++ ++ * @license GPL v3 ++ * @version 0.1.1 ++ * @deprecated in LimeSurvey 3.0/develop UpdateDbCommand do it ++ * ++ * Copyright (C) 2017 Denis Chenu ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++class UpdateCommand extends CConsoleCommand ++{ ++ public function run(){ ++ $this->_setConfigs(); ++ $newDbVersion = (float)Yii::app()->getConfig('dbversionnumber'); ++ $currentDbVersion = (float)Yii::app()->getConfig('DBVersion'); ++ if($newDbVersion > $currentDbVersion){ ++ echo "Update ".Yii::app()->db->connectionString.", prefix :".Yii::app()->db->tablePrefix." from {$currentDbVersion} to {$newDbVersion}\n"; ++ Yii::import('application.helpers.common_helper', true); ++ Yii::import('application.helpers.update.updatedb_helper', true); ++ $result=db_upgrade_all($currentDbVersion);/* @todo : fix bad echoing here */ ++ if ($result) { ++ echo "Database has been successfully upgraded to version $newDbVersion \n"; ++ } else { ++ echo "Please fix this error in your database and try again\n"; ++ return 1; ++ } ++ } else { ++ echo "no need update ".$newDbVersion ." ". $currentDbVersion ."\n"; ++ } ++ } ++ ++ /** ++ * Fonction to set all needed (and unneeded) config ++ * @deprecated in LimeSurvey 3.0/develop version config is set by LimeSurvey Core ++ * @return void ++ */ ++ private function _setConfigs(){ ++ /* default config */ ++ $aDefaultConfigs = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config-defaults.php'); ++ foreach($aDefaultConfigs as $sConfig=>$defaultConfig){ ++ Yii::app()->setConfig($sConfig,$defaultConfig); ++ } ++ /* Fix for badly set rootdir */ ++ $sRootDir=realpath(Yii::app()->basePath. DIRECTORY_SEPARATOR . "..") ; ++ Yii::app()->setConfig('rootdir',$sRootDir); ++ Yii::app()->setConfig('publicdir',$sRootDir); ++ Yii::app()->setConfig('homedir',$sRootDir); ++ Yii::app()->setConfig('tempdir',$sRootDir.DIRECTORY_SEPARATOR."tmp"); ++ Yii::app()->setConfig('imagedir',$sRootDir.DIRECTORY_SEPARATOR."images"); ++ Yii::app()->setConfig('uploaddir',$sRootDir.DIRECTORY_SEPARATOR."upload"); ++ Yii::app()->setConfig('standardtemplaterootdir',$sRootDir.DIRECTORY_SEPARATOR."templates"); ++ Yii::app()->setConfig('usertemplaterootdir',$sRootDir.DIRECTORY_SEPARATOR."upload".DIRECTORY_SEPARATOR."templates"); ++ Yii::app()->setConfig('styledir',$sRootDir.DIRECTORY_SEPARATOR."styledir"); ++ /* version */ ++ $aVersionConfigs = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'version.php'); ++ foreach($aVersionConfigs as $sConfig=>$versionConfig){ ++ Yii::app()->setConfig($sConfig,$versionConfig); ++ } ++ ++ if(file_exists(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php')) ++ { ++ $config = require(Yii::app()->basePath. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'); ++ if(is_array($config['config']) && !empty($config['config'])) ++ { ++ foreach($config['config'] as $key=>$value) { ++ Yii::app()->setConfig($key,$value); ++ } ++ } ++ } ++ $oSettings=SettingGlobal::model()->findAll(); ++ if (count($oSettings) > 0) ++ { ++ foreach ($oSettings as $oSetting) ++ { ++ Yii::app()->setConfig($oSetting->getAttribute('stg_name'), $oSetting->getAttribute('stg_value')); ++ } ++ } ++ } ++ ++} diff --git a/patches/app-0002-301de6e.patch b/patches/app-0002-301de6e.patch new file mode 100644 index 0000000..a147c73 --- /dev/null +++ b/patches/app-0002-301de6e.patch @@ -0,0 +1,87 @@ +From 301de6eb25dda2b9342a006baadaa068c42b115e Mon Sep 17 00:00:00 2001 +From: Denis Chenu +Date: Wed, 15 Feb 2017 01:59:12 +0100 +Subject: [PATCH] [feature][yunohost] Activate a plugin by command - Needed for + update + +--- + application/commands/ActivatePluginCommand.php | 70 ++++++++++++++++++++++++++ + 1 file changed, 70 insertions(+) + create mode 100644 application/commands/ActivatePluginCommand.php + +diff --git a/application/commands/ActivatePluginCommand.php b/application/commands/ActivatePluginCommand.php +new file mode 100644 +index 0000000..512e9a4 +--- /dev/null ++++ b/application/commands/ActivatePluginCommand.php +@@ -0,0 +1,70 @@ ++ ++ * @copyright 2015 Denis Chenu ++ * @license GPL v3 ++ * @version 0.0.1 ++ * ++ * 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 ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++class ActivatePluginCommand extends CConsoleCommand ++{ ++ ++ /** ++ * @var string $defaultAction ++ * @see http://www.yiiframework.com/doc/api/1.1/CConsoleCommand#defaultAction-detail ++ */ ++ public $defaultAction='activate'; ++ /** ++ * Activate a plugin by name ++ * @param string $name The plugin Class name ++ * @return void ++ */ ++ public function actionActivate($classname) ++ { ++ $oPluginManager = \Yii::app()->pluginManager; ++ $aDiscoveredPlugins = $oPluginManager->scanPlugins(); ++ if(!array_key_exists($classname,$aDiscoveredPlugins)) { ++ echo "Plugin {$classname} are not in your plugin directory\n"; ++ return 1; ++ } ++ ++ $oPlugin=Plugin::model()->find("name=:name",array(":name"=>$classname)); ++ /* If plugin is not installed : just install it */ ++ if(!$oPlugin) { ++ $oPlugin = new Plugin(); ++ $oPlugin->name = $classname; ++ $oPlugin->active = 0; ++ $oPlugin->save(); ++ } ++ /* Activate the plugin with the event beforeActivate */ ++ if ($oPlugin->active == 0) ++ { ++ /* Load the plugin and dispatch beforeActivate event */ ++ App()->getPluginManager()->loadPlugin($oPlugin->name, $oPlugin->id); ++ $result = App()->getPluginManager()->dispatchEvent(new PluginEvent('beforeActivate',$this), $oPlugin->name); ++ if ($result->get('success', true)) { ++ $oPlugin->active = 1; ++ if(!$oPlugin->save()){ ++ return 1; /* This must not happen */ ++ } ++ } else { ++ echo $result->get('message', 'Failed to activate the plugin.')."\n"; ++ return 1; ++ } ++ } else { ++ // No error if try to activate an already activated plugin ++ } ++ } ++ ++} From 25ed10478b4743f4bfd6694c735ed4d1005d13f7 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Sat, 1 Apr 2017 13:50:32 +0200 Subject: [PATCH 4/4] [fix] Update sources --- app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.src b/app.src index 8202979..6567177 100644 --- a/app.src +++ b/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/a46075a10b6244c850ee11dcf283d38bdd7d8ad5.tar.gz -SOURCE_SUM=b06778cd6747e4106953810d5aefe9f12d968a3910ce48159bcbb2fe5a61d486 -SOURCE_FILE=limesurvey_2.6.2.1.tar.gz +SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/2.64.5+170331.tar.gz +SOURCE_SUM=ede99fb149feed4a60ea83e540263c912a68fb46c7fca98cb7ff7c5d474f3dc4 +SOURCE_FILE=limesurvey2.64.5+170331.tar.gz