Add audit tables when entities change #2326

pull/2715/head
Julio Montoya 6 years ago
parent d2ed1426af
commit c46f5e29d7
  1. 3
      composer.json
  2. 1
      config/bundles.php
  3. 7
      config/packages/simple_things_entity_audity.yaml
  4. 3
      src/CoreBundle/Controller/ResourceController.php
  5. 4
      src/CoreBundle/Migrations/Schema/V200/Version20.php

@ -153,7 +153,8 @@
"a2lix/translation-form-bundle": "^3.0",
"oneup/uploader-bundle": "^2.0",
"overblog/graphql-bundle": "^0.11.4",
"firebase/php-jwt": "^5.0"
"firebase/php-jwt": "^5.0",
"simplethings/entity-audit-bundle": "^1.0"
},
"require-dev": {
"symfony/var-dumper": "^4.0",

@ -73,4 +73,5 @@ return [
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Sonata\FormatterBundle\SonataFormatterBundle::class => ['all' => true],
SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle::class => ['all' => true],
];

@ -0,0 +1,7 @@
simple_things_entity_audit:
table_prefix: ''
table_suffix: _audit
revision_field_name: rev
revision_type_field_name: revtype
revision_table_name: revisions
revision_id_field_type: integer

@ -444,7 +444,8 @@ class ResourceController extends BaseController implements CourseControllerInter
$provider = $this->get('sonata.media.pool')->getProvider($media->getProviderName());
//$reference = $provider->getReferenceFile($media);
$filename = sprintf('%s/%s',
$filename = sprintf(
'%s/%s',
$provider->getFilesystem()->getAdapter()->getDirectory(),
$provider->generatePrivateUrl($media, $format)
);

@ -216,7 +216,9 @@ class Version20 extends AbstractMigrationChamilo
}
$this->addSql('ALTER TABLE c_student_publication ADD filesize INT DEFAULT NULL');
$this->addSql('CREATE TABLE IF NOT EXISTS c_group_info_audit (iid INT NOT NULL, rev INT NOT NULL, c_id INT DEFAULT NULL, id INT DEFAULT NULL, name VARCHAR(100) DEFAULT NULL, status TINYINT(1) DEFAULT NULL, category_id INT DEFAULT NULL, description LONGTEXT DEFAULT NULL, max_student INT DEFAULT NULL, doc_state TINYINT(1) DEFAULT NULL, calendar_state TINYINT(1) DEFAULT NULL, work_state TINYINT(1) DEFAULT NULL, announcements_state TINYINT(1) DEFAULT NULL, forum_state TINYINT(1) DEFAULT NULL, wiki_state TINYINT(1) DEFAULT NULL, chat_state TINYINT(1) DEFAULT NULL, secret_directory VARCHAR(255) DEFAULT NULL, self_registration_allowed TINYINT(1) DEFAULT NULL, self_unregistration_allowed TINYINT(1) DEFAULT NULL, session_id INT DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(iid, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('UPDATE user SET created_at = registration_date WHERE CAST(created_at AS CHAR(20)) = "0000-00-00 00:00:00"');
$this->addSql('UPDATE user SET updated_at = registration_date WHERE CAST(updated_at AS CHAR(20)) = "0000-00-00 00:00:00"');
/*$table = $schema->getTable('course_rel_class');
if (!$table->hasColumn('c_id')) {

Loading…
Cancel
Save