Add script to fix c_student_publication.post_group_id see BT#12609

- c_student_publication.post_group_id changed from 1.9.x
by using c_group_info.iid instead of c_group_info.id
- Error appears only when upgrading using chash.
pull/2487/head
jmontoyaa 8 years ago
parent fa607644cd
commit de1b0abe21
  1. 54
      main/install/install.lib.php
  2. 14
      tests/scripts/fix_student_publication_id.php

@ -3191,8 +3191,38 @@ function migrateSwitch($fromVersion, $manager, $processFiles = true)
if ($result) {
error_log('Migrations files were executed ('.date('Y-m-d H:i:s').')');
$connection->executeQuery("ALTER TABLE course_category MODIFY COLUMN auth_course_child VARCHAR(40) DEFAULT 'TRUE'");
fixPostGroupIds($connection);
$sql = "UPDATE settings_current SET selected_value = '1.11.0' WHERE variable = 'chamilo_database_version'";
$connection->executeQuery($sql);
if ($processFiles) {
error_log('Update config files');
$fromVersionShort = '1.10';
include __DIR__.'/update-files-1.10.0-1.11.0.inc.php';
// Only updates the configuration.inc.php with the new version
include __DIR__.'/update-configuration.inc.php';
}
error_log('Upgrade 1.11.x process concluded! ('.date('Y-m-d H:i:s').')');
} else {
error_log('There was an error during running migrations. Check error.log');
}
break;
default:
break;
}
echo '</div>';
return true;
}
/**
* @param \Doctrine\DBAL\Connection $connection
*/
function fixPostGroupIds($connection)
{
$connection->executeQuery("ALTER TABLE course_category MODIFY COLUMN auth_course_child VARCHAR(40) DEFAULT 'TRUE'");
error_log('Fix c_student_publication.post_group_id');
// Fix post_group_id
@ -3265,26 +3295,4 @@ function migrateSwitch($fromVersion, $manager, $processFiles = true)
}
}
error_log('End - Fix work documents');
$sql = "UPDATE settings_current SET selected_value = '1.11.0' WHERE variable = 'chamilo_database_version'";
$connection->executeQuery($sql);
if ($processFiles) {
error_log('Update config files');
$fromVersionShort = '1.10';
include __DIR__.'/update-files-1.10.0-1.11.0.inc.php';
// Only updates the configuration.inc.php with the new version
include __DIR__.'/update-configuration.inc.php';
}
error_log('Upgrade 1.11.x process concluded! ('.date('Y-m-d H:i:s').')');
} else {
error_log('There was an error during running migrations. Check error.log');
}
break;
default:
break;
}
echo '</div>';
return true;
}

@ -0,0 +1,14 @@
<?php
exit;
/* For license terms, see /license.txt */
if (PHP_SAPI != 'cli') {
die('This script can only be launched from the command line');
}
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'install/install.lib.php';
$connection = Database::getManager()->getConnection();
fixPostGroupIds($connection);
Loading…
Cancel
Save