]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5210 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 4 Apr 2022 16:21:42 +0000 (18:21 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 4 Apr 2022 16:21:42 +0000 (18:21 +0200)
.idea/php.xml
.idea/workspace.xml
app/Console/Commands/WorkshopMigration.php
app/Jobs/UsersTree.php [new file with mode: 0644]
app/Models/FluidbookPublication.php
composer.json
config/backup.php
config/debugbar.php

index 5f5a9dbae55814300ea16bec587f43c610197cdb..dcb73f46608998c3c9fdd0f4a6cd9673753d59b8 100644 (file)
       <path value="$PROJECT_DIR$/vendor/cache/redis-adapter" />
     </include_path>
   </component>
-  <component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
+  <component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
   <component name="PhpUnit">
     <phpunit_settings>
       <PhpUnitSettings configuration_file_path="$PROJECT_DIR$/phpunit.xml" custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" use_configuration_file="true" />
index b913e73363652be68815926c7548b14dcc41f191..043080f42871f5c2c87b82ea77cf57837cc15a86 100644 (file)
     <select />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wip #4211 @0.5">
+    <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wait #5191">
       <change afterPath="$PROJECT_DIR$/app/Jobs/UsersTree.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/Console/Commands/WorkshopMigration.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Console/Commands/WorkshopMigration.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/Models/FluidbookPublication.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/FluidbookPublication.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/Models/FluidbookTranslate.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/FluidbookTranslate.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/backup.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/backup.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/config/debugbar.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/debugbar.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1646330633143" duration="4391000" />
       <workItem from="1646655005312" duration="12287000" />
       <workItem from="1646731397747" duration="10934000" />
-      <workItem from="1647340368330" duration="4048000" />
-    </task>
-    <task id="LOCAL-00216" summary="wip #5041 @0.75">
-      <created>1642686494944</created>
-      <option name="number" value="00216" />
-      <option name="presentableId" value="LOCAL-00216" />
-      <option name="project" value="LOCAL" />
-      <updated>1642686494944</updated>
+      <workItem from="1647340368330" duration="5393000" />
+      <workItem from="1647418626022" duration="3675000" />
+      <workItem from="1647430193970" duration="1263000" />
+      <workItem from="1647873010785" duration="2421000" />
+      <workItem from="1648634847198" duration="20000" />
+      <workItem from="1648636445466" duration="593000" />
+      <workItem from="1649080054308" duration="1855000" />
+      <workItem from="1649087728882" duration="910000" />
     </task>
     <task id="LOCAL-00217" summary="wip #5041 @1.5">
       <created>1642692522009</created>
       <option name="project" value="LOCAL" />
       <updated>1646740029014</updated>
     </task>
-    <option name="localTasksCounter" value="265" />
+    <task id="LOCAL-00265" summary="wip #5161 @0.25">
+      <created>1647345215873</created>
+      <option name="number" value="00265" />
+      <option name="presentableId" value="LOCAL-00265" />
+      <option name="project" value="LOCAL" />
+      <updated>1647345215873</updated>
+    </task>
+    <option name="localTasksCounter" value="266" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
     <option name="CHECK_NEW_TODO" value="false" />
     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
-    <MESSAGE value="wip #5045 @3" />
     <MESSAGE value="wait #5045" />
     <MESSAGE value="wip #5045 @0.75" />
     <MESSAGE value="wip #5045 @1.1" />
     <MESSAGE value="wip #5041 @2" />
     <MESSAGE value="wip #4211 @1" />
     <MESSAGE value="wip #4211 @0.5" />
-    <option name="LAST_COMMIT_MESSAGE" value="wip #4211 @0.5" />
+    <MESSAGE value="wip #5161 @0.25" />
+    <option name="LAST_COMMIT_MESSAGE" value="wip #5161 @0.25" />
   </component>
   <component name="XSLT-Support.FileAssociations.UIState">
     <expand />
index 61b07ddfd4a1b627012a82579a0fb0d2802ad00f..d3b9941eb0d0dea41e4452716413af3ff1b79e4e 100644 (file)
@@ -115,6 +115,7 @@ class WorkshopMigration extends CubistCommand
             $this->line('Import ' . $e->book_id);
             $oldRoot = $this->_oldRoot . 'books/working/' . $e->book_id . '/';
             $c = new FluidbookPublication();
+            $c->setIncrementing(false);
             $c->id = $e->book_id;
             $e->compiledate = max($e->compiledate, $e->compile1date, $e->compilehtml5date);
             foreach ($e as $k => $v) {
@@ -127,13 +128,11 @@ class WorkshopMigration extends CubistCommand
                     $date->setTimestamp($v);
                     $v = $date;
                 }
-                $c->$new = $v;
+                $c->setAttribute($new, $v);
             }
-            $c->save();
 
             $s = $this->_unserialize($e->parametres);
 
-
             foreach ($s->datas as $k => $data) {
                 if (in_array($k, $ignore)) {
                     continue;
@@ -153,9 +152,14 @@ class WorkshopMigration extends CubistCommand
                 if (isset($mapValues[$data])) {
                     $data = $mapValues[$data];
                 }
-                $c->$k = $data;
+                $c->setAttribute($k, $data);
+            }
+
+            try {
+                $c->save();
+            }catch (\Exception $e){
+                dd($e);
             }
-            $c->save();
         }
     }
 }
diff --git a/app/Jobs/UsersTree.php b/app/Jobs/UsersTree.php
new file mode 100644 (file)
index 0000000..e5b04ca
--- /dev/null
@@ -0,0 +1,181 @@
+<?php
+
+namespace App\Jobs;
+
+class UsersTree extends Base
+{
+    protected $jobName = 'userstree';
+
+    protected $users=[];
+    protected $admins=[];
+    protected $grades=[];
+    protected $facturables=[];
+    protected $rights=[];
+    protected $entreprises=[];
+
+    public function handle()
+    {
+
+
+        $this->users = array();
+        $this->admins = array();
+        $this->grades = array();
+        $this->entreprises = array();
+        $this->domains = array();
+
+        $this->rights = array();
+
+        $r = $this->con->select('SELECT * FROM e2_u u LEFT JOIN e2_c e ON u.entreprise=e.entreprise_id WHERE e.ws_grade>0 ORDER BY e.ws_grade ASC');
+        while ($r->fetch()) {
+            $this->entreprises[$r->utilisateur_id] = $r->entreprise_id;
+            $this->users[$r->utilisateur_id] = $r->ws_admin;
+            $this->grades[$r->utilisateur_id] = $r->ws_grade;
+            if (!isset($this->admins[$r->ws_admin])) {
+                $this->admins[$r->ws_admin] = array();
+            }
+            if (!isset($this->admins[$r->utilisateur_id])) {
+                $this->admins[$r->utilisateur_id] = array();
+            }
+            $this->admins[$r->ws_admin][] = $r->utilisateur_id;
+            $d = explode('@', $r->email);
+            $this->domains[$r->utilisateur_id] = mb_strtolower($d[1]);
+        }
+
+        $daoBook = new wsDAOBook($this->con);
+        $books = $daoBook->selectAll();
+        $owners = [];
+        foreach ($books as $book) {
+            if (!isset($owners[$book->proprietaire_id])) {
+                $owners[$book->proprietaire_id] = 0;
+            }
+            $owners[$book->proprietaire_id]++;
+        }
+
+        $this->facturables = $this->getFacturables();
+        // Fabrication de l'arbre
+        $c = $this->con->openCursor('ws_users_tree');
+        $ce = $this->con->openCursor('ws_entreprises_tree');
+
+        $evu = array();
+
+        foreach ($this->users as $utilisateur_id => $admin) {
+            $facturable_id = $administrateur_id = 0;
+            $this->getFacturableOf($utilisateur_id, $facturable_id, $administrateur_id, 1);
+
+            if (!isset($this->entreprises[$facturable_id]) || is_null($this->entreprises[$facturable_id])) {
+                //$this->entreprises[$facturable_id]=$this->entreprises[$utilisateur_id];
+            }
+
+            $c->utilisateur_id = $utilisateur_id;
+            $ce->entreprise_id = $c->entreprise_id = $this->entreprises[$utilisateur_id];
+            $c->facturable_id = $facturable_id;
+            $ce->facturable_entreprise_id = $c->facturable_entreprise_id = $this->entreprises[$facturable_id];
+            $ce->administrateur_id = $c->administrateur_id = $administrateur_id;
+            try {
+                $c->insert();
+            } catch (Exception $e) {
+                fb($e);
+            }
+            if (isset($evu[$c->entreprise_id])) {
+                continue;
+            }
+            try {
+                $ce->insert();
+            } catch (Exception $e) {
+                fb($e);
+            }
+            $evu[$c->entreprise_id] = true;
+        }
+        // Fabrication de la liste des droits à partir de l'arbre
+        $j = 0;
+        for ($i = 1; $i <= 5; $i++) {
+            foreach ($this->admins as $admin_id => $list) {
+                $newlist = $list;
+                foreach ($list as $uid) {
+                    if ($uid != $admin_id && isset($this->admins[$uid])) {
+                        $newlist = array_merge($this->admins[$uid], $newlist);
+                    }
+                }
+                $this->admins[$admin_id] = array_unique($newlist);
+            }
+        }
+        // Ajout des droits personnels
+        foreach ($this->users as $uid => $admin) {
+            $this->admins[$uid][] = $uid;
+        }
+        // Echange des droits entre collègues
+        foreach ($this->admins as $admin_id => $list) {
+            if (!isset($this->entreprises[$admin_id])) {
+                continue;
+            }
+            $e = $this->entreprises[$admin_id];
+            $collegues = array_keys($this->entreprises, $e);
+            $newlist = $this->admins[$admin_id];
+            foreach ($collegues as $c) {
+                $newlist = array_merge($newlist, $this->admins[$c]);
+            }
+            $newlist = array_unique($newlist);
+            $this->admins[$admin_id] = $newlist;
+            foreach ($collegues as $c) {
+                $this->admins[$c] = $newlist;
+            }
+        }
+
+        $adom = array();
+
+        foreach ($this->admins as $admin => $list) {
+            $this->admins[$admin] = array_unique($list);
+            sort($this->admins[$admin]);
+
+            $adom[$admin] = array();
+            foreach ($list as $id) {
+                $adom[$admin][] = $this->domains[$id];
+            }
+            $adom[$admin] = array_unique($adom[$admin]);
+        }
+
+        $c = $this->con->openCursor('extranet_users.user');
+        foreach ($this->admins as $admin => $list) {
+            $wscount = 0;
+            foreach ($list as $item) {
+                $wscount += $owners[$item];
+            }
+            $c->e1_ws_count = $wscount;
+            $c->e1_ws_rights = implode(',', $list);
+            $c->e1_ws_domains = implode(',', $adom[$admin]);
+            $c->update('WHERE id=\'' . $this->con->escape($admin) . '\'');
+        }
+    }
+
+    protected function getFacturableOf($utilisateur_id, &$facturable_id, &$administrateur_id, $level)
+    {
+        if (in_array($utilisateur_id, $this->facturables)) {
+            $facturable_id = $utilisateur_id;
+            $administrateur_id = $this->users[$utilisateur_id];
+            return;
+        }
+        if ($level > 10) {
+            $facturable_id = -1;
+            $administrateur_id = -1;
+            return;
+        }
+        if (!$utilisateur_id || !isset($this->users[$utilisateur_id])) {
+            return;
+        }
+
+        return $this->getFacturableOf($this->users[$utilisateur_id], $facturable_id, $administrateur_id, $level + 1);
+    }
+
+    protected function getFacturables()
+    {
+        $res = array();
+        foreach ($this->users as $utilisateur_id => $admin) {
+            if ($this->grades[$admin] == 5) {
+                $res[] = $utilisateur_id;
+            }
+        }
+        sort($res);
+        return $res;
+    }
+
+}
index 4b7005f43a9118c8e7a35bde9a8867fffb6d804b..aa687872ec7459390d646c08cc7f2fd3a345e205 100644 (file)
@@ -30,11 +30,7 @@ class FluidbookPublication extends ToolboxModel
         'plural' => 'publications'];
 
     protected $_enableBulk = false;
-
     protected $_enableTrackNonDefaultValues = true;
-
-//    protected $_syncDbSchema = false;
-
     protected static $_permissionBase = 'fluidbook-publication';
 
 
@@ -87,10 +83,42 @@ class FluidbookPublication extends ToolboxModel
         $this->addField('compilation_date', Datetime::class, __('Dernière compilation'));
         $this->addField('composition_updated_at', Datetime::class, __('Dernière modification de la composition'));
         $this->addField('export_data', Hidden::class, __('Paramètres d\'export'));
+        // Composed fields
+        $composed = ['admin' => __('Administrator'), 'super_admin' => __('Super administrator'), 'owner_company_name' => __('Propriétaire'), 'owner_name' => __('Propriétaire'), 'invoicable' => __('Utilisateur facturable'), 'invoicable_company' => __('Facturation'), 'extranet_project' => __('Project extranet')];
+        foreach ($composed as $name => $label) {
+            $this->addField($name, Hidden::class, $label);
+        }
 
         $this->setSettingsFields();
     }
 
+    public function onBeforeStore($controller, $request)
+    {
+        $this->setComposedAttributes();
+        parent::onBeforeStore($controller, $request);
+    }
+
+    public function onBeforeUpdate($controller, $request)
+    {
+        $this->setComposedAttributes();
+        parent::onBeforeUpdate($controller, $request);
+    }
+
+    protected function setComposedAttributes(){
+        /** @var \App\Models\User $owner */
+        $owner=\App\Models\User::find($this->owner);
+        /** @var Company $company */
+        $company=Company::find($owner->company);
+
+        $this->admin=$company->admin;
+        $this->super_admin='';
+        $this->owner_company_name=$company->company_with_name;
+        $this->owner_name=$owner->name;
+        $this->invoicable='';
+        $this->invoicable_company='';
+        $this->extranet_project='';
+    }
+
     public function setSettingsFields()
     {
         $this->addField('section_important', FormSection::class, __('Description de la publication'));
@@ -98,12 +126,11 @@ class FluidbookPublication extends ToolboxModel
             'default' => 'stable',
             'fake' => true,
             'store_in' => 'settings',
-            'filter' => true,
             'translatable' => false,
         ]);
-        $this->addField('mobileVersion', SelectFromArray::class, __('Affichage des pages'), [
+        $this->addField('mobileVersion', SelectFromArray::class, __('Version mobile'), [
             'options' => [
-                //'pdf' => 'Rediriger vers le PDF',
+                'pdf' => 'Rediriger vers le PDF',
                 'html5-desktop' => 'Version HTML5 recommandée (vecteurs sur desktop)',
                 'html5' => 'Version HTML5 vecteurs',
                 'html5-images' => 'Version HTML5 en images',
@@ -112,7 +139,6 @@ class FluidbookPublication extends ToolboxModel
             'fake' => true,
             'store_in' => 'settings',
             'translatable' => false,
-            'filter' => true,
         ]);
         $this->addField('title', LongText::class, __('Titre de la publication'), [
             'default' => '',
@@ -1283,6 +1309,19 @@ class FluidbookPublication extends ToolboxModel
             'store_in' => 'settings',
             'translatable' => false,
         ]);
+        $this->addField('section_slider', FormSection::class, __('Slider'));
+        $this->addField('sliderImage', FilesOrURL::class, __('Image pour le slider'), [
+            'default' => '',
+            'accept' => [
+                0 => '*.svg',
+                1 => '*.jpg',
+                2 => '*.png',
+                3 => '*.gif',
+            ],
+            'fake' => true,
+            'store_in' => 'settings',
+            'translatable' => false,
+        ]);
         $this->addField('section_stats', FormSection::class, __('Statistiques avancées'));
         $this->addField('tagcommander_id', LongText::class, __('Tag commander ID'), [
             'default' => '',
@@ -2645,13 +2684,11 @@ L,index',
             'fake' => true,
             'store_in' => 'settings',
             'translatable' => false,
-            'filter' => true,
-
-            'column_label' => 'SCORM',
         ]);
         $this->addField('scorm_version', SelectFromArray::class, __('Version du standard SCORM'), [
             'options' => [
                 '1.2' => 'SCORM 1.2',
+                '2004.3' => 'SCORM 2004 3rd edition',
                 2004 => 'SCORM 2004 4th edition',
             ],
             'default' => '1.2',
index 7007a0a379938e3efb3f09428717c9c71e207f68..b27b7ea9daee12099a8a571c9a6ec233d88d3b32 100644 (file)
@@ -18,7 +18,7 @@
     ],
     "license": "MIT",
     "require": {
-        "php": ">=7.4",
+        "php": ">=8.0",
         "ext-json": "*",
         "ext-simplexml": "*",
         "ext-tidy": "*",
         "cubedesigners/userdatabase": "dev-master",
         "cubist/cms-back": "dev-master",
         "cubist/scorm": "dev-master",
-        "league/csv": "^9.7",
-        "mxl/laravel-job": "^1.2",
+        "league/csv": "^9.8",
+        "mxl/laravel-job": "^1.3",
         "php-ffmpeg/php-ffmpeg": "^0.18.0",
-        "phpoffice/phpspreadsheet": "^1.18",
+        "phpoffice/phpspreadsheet": "^1.22",
         "rustici-software/scormcloud-api-v2-client-php": "^2.0"
     },
     "require-dev": {
-        "facade/ignition": "^2.3",
-        "fzaninotto/faker": "^1.9.1",
-        "mockery/mockery": "^1.4",
-        "nunomaduro/collision": "^4.2",
+        "facade/ignition": "^2.17",
+        "fzaninotto/faker": "^1.9",
+        "mockery/mockery": "^1.5",
+        "nunomaduro/collision": "^4.3",
         "phpunit/phpunit": "^8.5",
-        "barryvdh/laravel-ide-helper": "^2.8",
-        "filp/whoops": "^2.7",
-        "laravel/tinker": "^2.4"
+        "barryvdh/laravel-ide-helper": "^2.12",
+        "filp/whoops": "^2.14",
+        "laravel/tinker": "^2.7"
     },
     "config": {
         "optimize-autoloader": true,
index deaa8a442397f29100c49084117e029f0adb56f0..9cc4f9e7d65d3056deb68d5fe29d7dce0df21008 100644 (file)
@@ -44,18 +44,57 @@ return [
                  */
                 'exclude' => [
                     base_path('vendor'),
+                    base_path('node_modules'),
                     storage_path(),
                 ],
 
                 /*
                  * Determines if symlinks should be followed.
                  */
-                'followLinks' => false,
+                'follow_links' => false,
+
+                /*
+                 * Determines if it should avoid unreadable folders.
+                 */
+                'ignore_unreadable_directories' => false,
+
+                /*
+                 * This path is used to make directories in resulting zip-file relative
+                 * Set to `null` to include complete absolute path
+                 * Example: base_path()
+                 */
+                'relative_path' => null,
             ],
 
             /*
-             * The names of the connections to the databases that should be part of the backup.
-             * Currently only MySQL- and PostgreSQL-databases are supported.
+             * The names of the connections to the databases that should be backed up
+             * MySQL, PostgreSQL, SQLite and Mongo databases are supported.
+             *
+             * The content of the database dump may be customized for each connection
+             * by adding a 'dump' key to the connection settings in config/database.php.
+             * E.g.
+             * 'mysql' => [
+             *       ...
+             *      'dump' => [
+             *           'excludeTables' => [
+             *                'table_to_exclude_from_backup',
+             *                'another_table_to_exclude'
+             *            ]
+             *       ],
+             * ],
+             *
+             * If you are using only InnoDB tables on a MySQL server, you can
+             * also supply the useSingleTransaction option to avoid table locking.
+             *
+             * E.g.
+             * 'mysql' => [
+             *       ...
+             *      'dump' => [
+             *           'useSingleTransaction' => true,
+             *       ],
+             * ],
+             *
+             * For a complete list of available customization options, see https://github.com/spatie/db-dumper
              */
             'databases' => [
                 'mysql',
@@ -63,9 +102,25 @@ return [
         ],
 
         /*
-         * The database dump can be gzipped to decrease diskspace usage.
+         * The database dump can be compressed to decrease diskspace usage.
+         *
+         * Out of the box Laravel-backup supplies
+         * Spatie\DbDumper\Compressors\GzipCompressor::class.
+         *
+         * You can also create custom compressor. More info on that here:
+         * https://github.com/spatie/db-dumper#using-compression
+         *
+         * If you do not want any compressor at all, set it to null.
          */
-        'gzip_database_dump' => false,
+        'database_dump_compressor' => null,
+
+        /*
+         * The file extension used for the database dump files.
+         *
+         * If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
+         * The file extension should be specified without a leading .
+         */
+        'database_dump_file_extension' => '',
 
         'destination' => [
 
@@ -82,25 +137,43 @@ return [
             ],
         ],
 
+        /*
+         * The directory where the temporary files will be stored.
+         */
         'temporary_directory' => storage_path('app/backup-temp'),
+
+        /*
+         * The password to be used for archive encryption.
+         * Set to `null` to disable encryption.
+         */
+        'password' => env('BACKUP_ARCHIVE_PASSWORD'),
+
+        /*
+         * The encryption algorithm to be used for archive encryption.
+         * You can set it to `null` or `false` to disable encryption.
+         *
+         * When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
+         * available on your system.
+         */
+        'encryption' => 'default',
     ],
 
     /*
      * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
-     * For Slack you need to install guzzlehttp/guzzle.
+     * For Slack you need to install laravel/slack-notification-channel.
      *
      * You can also use your own notification classes, just make sure the class is named after one of
-     * the `Spatie\Backup\Events` classes.
+     * the `Spatie\Backup\Notifications\Notifications` classes.
      */
     'notifications' => [
 
         'notifications' => [
-            \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class         => ['mail'],
-            \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
-            \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class        => ['mail'],
-            \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class     => ['mail'],
-            \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class   => ['mail'],
-            \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class    => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
+            \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
         ],
 
         /*
@@ -113,7 +186,12 @@ return [
          * Here you can specify how emails should be sent.
          */
         'mail' => [
-            'to'   => 'your@email.com',
+            'to' => 'your@example.com',
+
+            'from' => [
+                'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
+                'name' => env('MAIL_FROM_NAME', 'Example'),
+            ],
         ],
 
         /*
@@ -126,6 +204,19 @@ return [
              * If this is set to null the default channel of the webhook will be used.
              */
             'channel' => null,
+
+            'username' => null,
+
+            'icon' => null,
+
+        ],
+
+        'discord' => [
+            'webhook_url' => '',
+
+            'username' => null,
+
+            'avatar_url' => null,
         ],
     ],
 
@@ -134,20 +225,24 @@ return [
      * If a backup does not meet the specified requirements the
      * UnHealthyBackupWasFound event will be fired.
      */
-    'monitorBackups' => [
+    'monitor_backups' => [
         [
-            'name'                                   => env('APP_NAME'),
-            'disks'                                  => ['backups'],
-            'newestBackupsShouldNotBeOlderThanDays'  => 1,
-            'storageUsedMayNotBeHigherThanMegabytes' => 5000,
+            'name' => env('APP_NAME', 'laravel-backup'),
+            'disks' => ['backups'],
+            'health_checks' => [
+                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
+                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
+            ],
         ],
 
         /*
         [
             'name' => 'name of the second app',
             'disks' => ['local', 's3'],
-            'newestBackupsShouldNotBeOlderThanDays' => 1,
-            'storageUsedMayNotBeHigherThanMegabytes' => 5000,
+            'health_checks' => [
+                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
+                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
+            ],
         ],
         */
     ],
@@ -164,38 +259,38 @@ return [
          */
         'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
 
-        'defaultStrategy' => [
+        'default_strategy' => [
 
             /*
              * The number of days for which backups must be kept.
              */
-            'keepAllBackupsForDays' => 7,
+            'keep_all_backups_for_days' => 7,
 
             /*
              * The number of days for which daily backups must be kept.
              */
-            'keepDailyBackupsForDays' => 16,
+            'keep_daily_backups_for_days' => 16,
 
             /*
              * The number of weeks for which one weekly backup must be kept.
              */
-            'keepWeeklyBackupsForWeeks' => 8,
+            'keep_weekly_backups_for_weeks' => 8,
 
             /*
              * The number of months for which one monthly backup must be kept.
              */
-            'keepMonthlyBackupsForMonths' => 4,
+            'keep_monthly_backups_for_months' => 4,
 
             /*
              * The number of years for which one yearly backup must be kept.
              */
-            'keepYearlyBackupsForYears' => 2,
+            'keep_yearly_backups_for_years' => 2,
 
             /*
              * After cleaning up the backups remove the oldest backup until
              * this amount of megabytes has been reached.
              */
-            'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
+            'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
         ],
     ],
 
index 00cdd00ae5735ad74c05711b88f2a09c6f54dc13..438e3bd9a70282c450e3b8b265666778d63d7f33 100644 (file)
@@ -119,7 +119,7 @@ return [
         'laravel'         => true, // Laravel version and environment
         'events'          => false, // All events fired
         'default_request' => false, // Regular or special Symfony request logger
-        'logs'            => false, // Add the latest log messages
+        'logs'            => true, // Add the latest log messages
         'files'           => false, // Show the included files
         'config'          => false, // Display config settings
         'cache'           => false, // Display cache events