diff --git a/public/main/install/index.php b/public/main/install/index.php
index 4500f5d3de..8d9bf395d5 100644
--- a/public/main/install/index.php
+++ b/public/main/install/index.php
@@ -224,6 +224,8 @@ if ($installType === 'update' && in_array($my_old_version, $update_from_version_
}
$showEmailNotCheckedToStudent = 1;
+$userMailCanBeEmpty = null;
+$checkEmailByHashSent = null;
if (!isset($_GET['running'])) {
// Extract the path to append to the url if Chamilo is not installed on the web root directory.
diff --git a/public/main/install/install.lib.php b/public/main/install/install.lib.php
index dbb3f41829..e251c31546 100644
--- a/public/main/install/install.lib.php
+++ b/public/main/install/install.lib.php
@@ -412,7 +412,7 @@ function write_system_config_file($path)
Your problems can be related on two possible causes:
- Permission problems.
Try initially with chmod -R 777 and increase restrictions gradually.
- - PHP is running in Safe-Mode.
+
- PHP is running in Safe-Mode.
If possible, try to switch it off.
Read about this problem in Support Forum
@@ -877,7 +877,7 @@ function display_requirements(
'.get_lang('(recommended)').' |
'.get_lang('Currently').' |
-
+
Display Errors |
'.Display::label('OFF', 'success').' |
@@ -953,7 +953,7 @@ function display_requirements(
'.api_get_path(SYS_PATH).' |
'.check_writable(api_get_path(SYS_PATH)).' |
-
+
'.get_lang('Permissions for new directories').' |
'.$dir_perm.' |
@@ -1809,7 +1809,7 @@ function display_after_install_message()
'To protect your site, make the whole %s directory read-only (chmod -R 0555 on Linux) and delete the %s directory.'), 'var/config/', 'main/install/');
$html .= '
-
+
'.$trans->trans('Go to your newly created portal.').'
';
@@ -2689,7 +2689,7 @@ function fixLpId($connection, $debug)
$correctLink = "lp/lp_controller.php?action=view&lp_id=$lpIid&id_session=$sessionId";
$link = "newscorm/lp_controller.php?action=view&lp_id=$oldId&id_session=$sessionId";
$secondLink = "lp/lp_controller.php?action=view&lp_id=$oldId&id_session=$sessionId";
- $sql = "UPDATE $toolTable
+ $sql = "UPDATE $toolTable
SET link = '$correctLink'
WHERE c_id = $courseId AND (link = '$link' OR link ='$secondLink')";
$connection->query($sql);
@@ -2701,7 +2701,7 @@ function fixLpId($connection, $debug)
foreach ($variablesToFix as $variable) {
if (!empty($item[$variable]) && isset($itemList[$item[$variable]])) {
$newId = $itemList[$item[$variable]];
- $sql = "UPDATE $tblCLpItem SET $variable = $newId
+ $sql = "UPDATE $tblCLpItem SET $variable = $newId
WHERE iid = $itemIid AND c_id = $courseId AND lp_id = $oldId";
$connection->query($sql);
}
@@ -2715,7 +2715,7 @@ function fixLpId($connection, $debug)
if (!empty($document)) {
$newDocumentId = $document['iid'];
if (!empty($newDocumentId)) {
- $sql = "UPDATE $tblCLpItem SET path = $newDocumentId
+ $sql = "UPDATE $tblCLpItem SET path = $newDocumentId
WHERE iid = $itemIid AND c_id = $courseId";
$connection->query($sql);
if ($debug) {
@@ -2727,22 +2727,22 @@ function fixLpId($connection, $debug)
}
// c_lp_view
- $sql = "UPDATE c_lp_view SET last_item = $itemIid
+ $sql = "UPDATE c_lp_view SET last_item = $itemIid
WHERE c_id = $courseId AND last_item = $itemId AND lp_id = $oldId";
$connection->query($sql);
// c_lp_item_view
- $sql = "UPDATE c_lp_item_view SET lp_item_id = $itemIid
+ $sql = "UPDATE c_lp_item_view SET lp_item_id = $itemIid
WHERE c_id = $courseId AND lp_item_id = $itemId";
$connection->query($sql);
// Update track_exercises
- $sql = "UPDATE track_e_exercises SET orig_lp_item_id = $itemIid
+ $sql = "UPDATE track_e_exercises SET orig_lp_item_id = $itemIid
WHERE c_id = $courseId AND orig_lp_id = $oldId AND orig_lp_item_id = $itemId";
$connection->query($sql);
// c_forum_thread
- $sql = "UPDATE c_forum_thread SET lp_item_id = $itemIid
+ $sql = "UPDATE c_forum_thread SET lp_item_id = $itemIid
WHERE c_id = $courseId AND lp_item_id = $itemId";
$connection->query($sql);
@@ -2761,14 +2761,14 @@ function fixLpId($connection, $debug)
continue;
}
- $sql = "UPDATE track_e_exercises
- SET orig_lp_item_view_id = $newItemView
- WHERE
- c_id = $courseId AND
- orig_lp_id = $oldId AND
- orig_lp_item_id = $itemIid AND
- orig_lp_item_view_id = $oldItemViewId AND
- exe_user_id = $userId
+ $sql = "UPDATE track_e_exercises
+ SET orig_lp_item_view_id = $newItemView
+ WHERE
+ c_id = $courseId AND
+ orig_lp_id = $oldId AND
+ orig_lp_item_id = $itemIid AND
+ orig_lp_item_view_id = $oldItemViewId AND
+ exe_user_id = $userId
";
$connection->query($sql);
@@ -2782,11 +2782,11 @@ function fixLpId($connection, $debug)
}
}
- $sql = "UPDATE $tblCLpItem SET lp_id = $lpIid
+ $sql = "UPDATE $tblCLpItem SET lp_id = $lpIid
WHERE c_id = $courseId AND lp_id = $oldId AND id = $itemId";
$connection->query($sql);
- $sql = "UPDATE $tblCLpItem SET id = iid
+ $sql = "UPDATE $tblCLpItem SET id = iid
WHERE c_id = $courseId AND lp_id = $oldId AND id = $itemId";
$connection->query($sql);
}
@@ -2798,7 +2798,7 @@ function fixLpId($connection, $debug)
$connection->query($sql);
// Update track_exercises.
- $sql = "UPDATE track_e_exercises SET orig_lp_id = $lpIid
+ $sql = "UPDATE track_e_exercises SET orig_lp_id = $lpIid
WHERE c_id = $courseId AND orig_lp_id = $oldId";
$connection->query($sql);
@@ -3662,7 +3662,7 @@ function fixPostGroupIds($connection)
error_log('Fix c_student_publication.post_group_id');
// Fix post_group_id
- $sql = "SELECT * FROM c_student_publication
+ $sql = "SELECT * FROM c_student_publication
WHERE (post_group_id <> 0 AND post_group_id is not null)";
$statement = $connection->executeQuery($sql);
$result = $statement->fetchAll();
@@ -3671,7 +3671,7 @@ function fixPostGroupIds($connection)
$groupId = $row['post_group_id'];
$courseId = $row['c_id'];
$workIid = $row['iid'];
- $sql = "SELECT iid from c_group_info
+ $sql = "SELECT iid from c_group_info
WHERE c_id = $courseId AND id = $groupId";
$statement = $connection->executeQuery($sql);
$count = $statement->rowCount();
@@ -3682,9 +3682,9 @@ function fixPostGroupIds($connection)
continue;
}
if ($newGroupId) {
- $sql = "UPDATE c_student_publication
- SET post_group_id = $newGroupId
- WHERE
+ $sql = "UPDATE c_student_publication
+ SET post_group_id = $newGroupId
+ WHERE
c_id = $courseId AND
iid = $workIid
";
@@ -3696,7 +3696,7 @@ function fixPostGroupIds($connection)
error_log('End - Fix c_student_publication.post_group_id');
// Delete c_student_publication from any session that doesn't exist anymore
- $sql = "DELETE FROM c_student_publication
+ $sql = "DELETE FROM c_student_publication
WHERE session_id NOT IN (SELECT id FROM session) AND (session_id <> 0 AND session_id is not null)";
$connection->executeQuery($sql);
diff --git a/src/CoreBundle/Tool/AbstractTool.php b/src/CoreBundle/Tool/AbstractTool.php
index 2adffe1e92..fe8786131a 100644
--- a/src/CoreBundle/Tool/AbstractTool.php
+++ b/src/CoreBundle/Tool/AbstractTool.php
@@ -112,7 +112,7 @@ abstract class AbstractTool implements ToolInterface
/**
* @return array
*/
- public function getResourceTypes(): array
+ public function getResourceTypes()
{
return $this->resourceTypes;
}
diff --git a/src/CoreBundle/ToolChain.php b/src/CoreBundle/ToolChain.php
index 1a8b32fd85..5f4c57ac43 100644
--- a/src/CoreBundle/ToolChain.php
+++ b/src/CoreBundle/ToolChain.php
@@ -90,10 +90,44 @@ class ToolChain
$types = $tool->getResourceTypes();
if (!empty($types)) {
- foreach ($types as $entityName => $name) {
+ foreach ($types as $name => $data) {
$resourceType = new ResourceType();
$resourceType->setName($name);
- $resourceType->setEntityName($entityName);
+ $resourceType->setEntityName($data['entity']);
+ $resourceType->setTool($toolEntity);
+ $manager->persist($resourceType);
+ }
+ }
+
+ $manager->flush();
+ }
+ }
+
+ public function updateTools(ObjectManager $manager): void
+ {
+ $tools = $this->getTools();
+
+ /** @var AbstractTool $tool */
+ foreach ($tools as $tool) {
+ $toolEntity = new Tool();
+ $toolEntity
+ ->setName($tool->getName())
+ ;
+
+ if ($tool->getAdmin() === 1) {
+ // Only check ROLE_ADMIN
+ } else {
+ $this->setToolPermissions($toolEntity);
+ }
+
+ $manager->persist($toolEntity);
+
+ $types = $tool->getResourceTypes();
+ if (!empty($types)) {
+ foreach ($types as $name => $data) {
+ $resourceType = new ResourceType();
+ $resourceType->setName($name);
+ $resourceType->setEntityName($data['entity']);
$resourceType->setTool($toolEntity);
$manager->persist($resourceType);
}