Skip to content

Commit

Permalink
Merge branch 'release-2.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsconan committed Jan 8, 2018
2 parents 64d7367 + c60fb03 commit 8431fe2
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 47 deletions.
6 changes: 6 additions & 0 deletions config/default/clientDiag.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
*/
'configurableText' => null,

/**
* When this option is activated, the diagnostic will require a school name before allowing to start the checks
* @type boolean
*/
'requireSchoolName' => false,

/**
* List of testers that can be loaded
* @type array
Expand Down
4 changes: 4 additions & 0 deletions controller/CompatibilityChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ protected function getData($check = false)
unset($data[$type . '_type']);
}

if ($this->hasRequestParameter('school')) {
$data[Storage::DIAGNOSTIC_SCHOOL] = \tao_helpers_Display::sanitizeXssHtml(trim($this->getRequestParameter('school')));
}

if ($check) {
if (!$this->hasRequestParameter('os')) {
throw new \common_exception_MissingParameter('os');
Expand Down
2 changes: 1 addition & 1 deletion controller/DiagnosticChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function getData($check = false)
$data['login'] = UserHelper::getUserLogin(\common_session_SessionManager::getSession()->getUser());

if ($this->hasRequestParameter('workstation')) {
$data[PaginatedSqlStorage::DIAGNOSTIC_WORKSTATION] = trim($this->getRequestParameter('workstation'));
$data[PaginatedSqlStorage::DIAGNOSTIC_WORKSTATION] = \tao_helpers_Display::sanitizeXssHtml(trim($this->getRequestParameter('workstation')));
}

return $data;
Expand Down
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'label' => 'Browser and OS diagnostic tool',
'description' => 'Check compatibility of the os and browser of a client',
'license' => 'GPL-2.0',
'version' => '2.10.1',
'version' => '2.11.0',
'author' => 'Open Assessment Technologies SA',
'requires' => array(
'tao' => '>=14.3.1',
Expand Down
1 change: 1 addition & 0 deletions model/diagnostic/DiagnosticDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function getDiagnostics($options = array())
foreach($data as $idx => $row) {
$rowData = [
'id' => $row[PaginatedSqlStorage::DIAGNOSTIC_ID],
'school' => $row[PaginatedSqlStorage::DIAGNOSTIC_SCHOOL],
'fingerprint' => [
'uuid' => $row[PaginatedSqlStorage::DIAGNOSTIC_FINGERPRINT_UUID],
'value' => $row[PaginatedSqlStorage::DIAGNOSTIC_FINGERPRINT_VALUE],
Expand Down
1 change: 1 addition & 0 deletions model/storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface Storage
const DIAGNOSTIC_LOGIN = 'login';
const DIAGNOSTIC_IP = 'ip';
const DIAGNOSTIC_WORKSTATION = 'workstation';
const DIAGNOSTIC_SCHOOL = 'school';
const DIAGNOSTIC_FINGERPRINT_UUID = 'fingerprint_uuid';
const DIAGNOSTIC_FINGERPRINT_VALUE = 'fingerprint_value';
const DIAGNOSTIC_FINGERPRINT_DETAILS = 'fingerprint_details';
Expand Down
1 change: 1 addition & 0 deletions scripts/install/createDiagnosticTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function __invoke($params)
$tableResults->addColumn(Sql::DIAGNOSTIC_USER_ID, 'string', ['length' => 255, 'notnull' => false]);
$tableResults->addColumn(Sql::DIAGNOSTIC_IP, 'string', ['length' => 32]);
$tableResults->addColumn(Sql::DIAGNOSTIC_WORKSTATION, 'string', ['length' => 64, 'notnull' => false]);
$tableResults->addColumn(Sql::DIAGNOSTIC_SCHOOL, 'string', ['length' => 255, 'notnull' => false]);
$tableResults->addColumn(Sql::DIAGNOSTIC_FINGERPRINT_UUID, 'string', ['length' => 32, 'notnull' => false]);
$tableResults->addColumn(Sql::DIAGNOSTIC_FINGERPRINT_VALUE, 'string', ['length' => 32, 'notnull' => false]);
$tableResults->addColumn(Sql::DIAGNOSTIC_FINGERPRINT_DETAILS, 'text', ['notnull' => false]);
Expand Down
32 changes: 32 additions & 0 deletions scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,5 +575,37 @@ public function update($initialVersion)
}

$this->skip('2.9.0', '2.10.1');

if ($this->isVersion('2.10.1')) {
$extension = $this->getServiceManager()->get(\common_ext_ExtensionsManager::SERVICE_ID)->getExtensionById('taoClientDiagnostic');
$config = $extension->getConfig('clientDiag');

$config['requireSchoolName'] = false;

$extension->setConfig('clientDiag', $config);

$storageService = $this->getServiceManager()->get(Storage::SERVICE_ID);
if ($storageService instanceof Sql) {
$persistence = $storageService->getPersistence();

$schemaManager = $persistence->getDriver()->getSchemaManager();
$schema = $schemaManager->createSchema();

$fromSchema = clone $schema;

/** @var \Doctrine\DBAL\Schema\Table $tableResults */
$tableResults = $schema->getTable(Sql::DIAGNOSTIC_TABLE);

if (! $tableResults->hasColumn(PaginatedSqlStorage::DIAGNOSTIC_SCHOOL)) {
$tableResults->addColumn(Sql::DIAGNOSTIC_SCHOOL, 'string', ['length' => 255, 'notnull' => false]);
$queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema);
foreach ($queries as $query) {
$persistence->exec($query);
}
}
}

$this->setVersion('2.11.0');
}
}
}
2 changes: 1 addition & 1 deletion views/css/diagnostics.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8431fe2

Please sign in to comment.