Version20160825155200.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V111;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\DBAL\Types\Type;
  7. /**
  8. * Class Version20160825155200
  9. * Add option to allow download documents with the api key
  10. * @package Application\Migrations\Schema\V111
  11. */
  12. class Version20160825155200 extends AbstractMigrationChamilo
  13. {
  14. /**
  15. * @param Schema $schema
  16. * @throws \Doctrine\DBAL\DBALException
  17. * @throws \Doctrine\DBAL\Schema\SchemaException
  18. */
  19. public function up(Schema $schema)
  20. {
  21. $this->addSettingCurrent(
  22. 'allow_download_documents_by_api_key',
  23. null,
  24. 'radio',
  25. 'WebServices',
  26. 'false',
  27. 'AllowDownloadDocumentsByApiKeyTitle',
  28. 'AllowDownloadDocumentsByApiKeyComment',
  29. null,
  30. null,
  31. 1,
  32. true,
  33. true,
  34. [
  35. ['value' => 'false', 'text' => 'No'],
  36. ['value' => 'true', 'text' => 'Yes']
  37. ]
  38. );
  39. }
  40. /**
  41. * @param Schema $schema
  42. * @throws \Doctrine\DBAL\DBALException
  43. * @throws \Doctrine\DBAL\Schema\SchemaException
  44. */
  45. public function down(Schema $schema)
  46. {
  47. $this->addSql("DELETE FROM settings_current WHERE variable = 'allow_download_documents_by_api_key'");
  48. $this->addSql("DELETE FROM settings_options WHERE variable = 'allow_download_documents_by_api_key'");
  49. }
  50. }