Change $_configutaion values to current_setting - refs #7402

ofaj
Angel Fernando Quiroz Campos 10 years ago
parent 23dba3b5a0
commit 630c349e94
  1. 82
      app/Migrations/Schema/V111/Version20160302133200.php
  2. 4
      main/inc/lib/webservices/MessagesWebService.class.php
  3. 6
      main/install/configuration.dist.php
  4. 15
      main/install/data.sql
  5. 2
      main/webservices/rest.php

@ -0,0 +1,82 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160302133200
*/
class Version20160302133200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$allowSendPushNotification = $this->getConfigurationValue('messaging_allow_send_push_notification');
$this->addSettingCurrent(
'messaging_allow_send_push_notification',
null,
'radio',
'Platform',
($allowSendPushNotification ? 'true' : 'false'),
'MessagingAllowSendPushNotificationTitle',
'MessagingAllowSendPushNotificationComment',
null,
'',
1,
true,
false,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No'],
]
);
$gdcProjectNumber = $this->getConfigurationValue('messaging_gdc_project_number');
$this->addSettingCurrent(
'messaging_gdc_project_number',
null,
'textfield',
'Platform',
!empty($gdcProjectNumber) ? $gdcProjectNumber : '',
'MessagingGDCProjectNumberTitle',
'MessagingGDCProjectNumberComment',
null,
'',
1,
true,
false
);
$gdcApiKey = $this->getConfigurationValue('messaging_gdc_api_key');
$this->addSettingCurrent(
'messaging_gdc_api_key',
null,
'textfield',
'Platform',
!empty($gdcApiKey) ? $gdcApiKey : '',
'MessagingGDCApiKeyTitle',
'MessagingGDCApiKeyComment',
null,
'',
1,
true,
false
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

@ -170,11 +170,11 @@ class MessagesWebService extends WebService
*/
public static function sendPushNotification(array $userIds, $title, $content)
{
if (api_get_configuration_value('messaging_allow_send_push_notification') !== 'true') {
if (api_get_setting('messaging_allow_send_push_notification') !== 'true') {
return false;
}
$gdcApiKey = api_get_configuration_value('messaging_gdc_api_key');
$gdcApiKey = api_get_setting('messaging_gdc_api_key');
if ($gdcApiKey === false) {
return false;

@ -232,9 +232,3 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['session_hide_tab_list'] = array();
// Show invisible exercise in LP list
//$_configuration['show_invisible_exercise_in_lp_list'] = false;
//Allow send a push notification when an email are sent
//$_configuration['messaging_allow_send_push_notification'] = 'true';
//Project number in the Google Developer Console
//$_configuration['messaging_gdc_project_number'] = '';
//Api Key in the Google Developer Console
//$_configuration['messaging_gdc_api_key'] = '';

@ -1802,4 +1802,17 @@ VALUES
('show_full_skill_name_on_skill_wheel', 'true', 'Yes'),
('show_full_skill_name_on_skill_wheel', 'false', 'No');
UPDATE settings_current SET selected_value = '1.10.0.51' WHERE variable = 'chamilo_database_version';
-- Version 1.10.0.52
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
VALUES
('messaging_allow_send_push_notification', NULL, 'radio', 'Platform', 'false', 'MessagingAllowSendPushNotificationText', 'MessagingAllowSendPushNotificationComment', NULL, NULL, 0),
('messaging_gdc_project_number', NULL, 'textfield', 'Platform', '', 'MessagingGDCProjectNumberTitle', 'MessagingGDCProjectNumberComment', NULL, NULL, 0),
('messaging_gdc_api_key', NULL, 'textfield', 'Platform', '', 'MessagingGDCApiKeyTitle', 'MessagingGDCApiKeyComment', NULL, NULL, 0);
INSERT INTO settings_options (variable, value, display_text)
VALUES
('messaging_allow_send_push_notification', 'true', 'Yes'),
('messaging_allow_send_push_notification', 'false', 'No'),
UPDATE settings_current SET selected_value = '1.10.0.52' WHERE variable = 'chamilo_database_version';

@ -30,7 +30,7 @@ switch ($action) {
$json = array(
'status' => true,
'apiKey' => $apiKey,
'gcmSenderId' => api_get_configuration_value('messaging_gdc_project_number'),
'gcmSenderId' => api_get_setting('messaging_gdc_project_number'),
);
} else {
$json = array(

Loading…
Cancel
Save