1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00

[enh] Upgrade to 3.5.0

This commit is contained in:
ljf 2018-03-14 04:00:59 +01:00
parent a451e536d7
commit 770b3411e4
5 changed files with 10 additions and 116 deletions

View file

@ -7,7 +7,7 @@
language="en"
is_public=1 (PUBLIC|public=1|private=0)
; Checks
pkg_linter=0
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
@ -19,10 +19,10 @@
wrong_user=1
wrong_path=1
incorrect_path=1
corrupt_source=0
fail_download_source=0
corrupt_source=1
fail_download_source=1
port_already_use=0
final_path_already_use=0
final_path_already_use=1
change_url=0
;;; Levels
Level 1=auto

View file

@ -1,3 +1,3 @@
SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/2.64.5+170331.tar.gz
SOURCE_SUM=9ae345eae7443f4df7f60ac49e8514ffb30315ba9376d5464cbfe9d6aaf9469f
SOURCE_FILENAME=libresurvey2.64.5+170331.tar.gz
SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/3.5.0+180309.tar.gz
SOURCE_SUM=2e55d6123a6f53a8ae7b909fcc0bb435469e995ab4815f86d2b01990aeb76734
SOURCE_FILENAME=limesurvey-3-5-0-180309.tar.gz

View file

@ -2,7 +2,7 @@
"name": "LimeSurvey",
"id": "limesurvey",
"packaging_format": 1,
"version": "2.62.5-2",
"version": "3.5.0-1",
"description": {
"en": "LimeSurvey is used to create advanced poll.",
"fr": "LimeSurvey est un outil de création et diffusion de sondage en ligne."
@ -11,7 +11,7 @@
"maintainer": {
"name": "ljf",
"email": "ljf+limesurvey_ynh@reflexlibre.net",
"url": "http://www.limesurvey.org/"
"url": "https://reflexlibre.net"
},
"url": "https://www.limesurvey.org/",
"requirements": {

View file

@ -6,7 +6,7 @@
# App package root directory should be the parent folder
PKG_DIR=$(cd ../; pwd)
pkg_dependencies="php5-cli php5-imap"
pkg_dependencies="php5-cli php5-imap python-pip php5-gd php5-ldap"
#=================================================
# SPECIFIC HELPERS

View file

@ -1,106 +0,0 @@
From 7ca49326dafe4d9896e67aebe414edcd3ce8c1af Mon Sep 17 00:00:00 2001
From: Denis Chenu <denis@sondages.pro>
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 @@
+<?php
+ /*
+ * @author Denis Chenu <denis@sondages.pro>
+ * @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'));
+ }
+ }
+ }
+
+}
+?>