Overview
Comment: | More progress on migration to files and web pages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
ba3e9fabe2b0d3aaa5c2863ee63039e9 |
User & Date: | bohwaz on 2020-12-12 17:21:24 |
Other Links: | branch diff | manifest | tags |
Context
2020-12-13
| ||
00:28 | You should be able to get the session object again, using a singleton check-in: ed012f894f user: bohwaz tags: dev | |
2020-12-12
| ||
17:21 | More progress on migration to files and web pages check-in: ba3e9fabe2 user: bohwaz tags: dev | |
17:20 | Refactor of Config class, using AbstractEntity in a key-value model check-in: 04b6151bfe user: bohwaz tags: dev | |
Changes
Modified src/include/data/1.1.0_migration.sql from [6938873928] to [b636c3139c].
︙ | ︙ | |||
61 62 63 64 65 66 67 | author_id, public FROM wiki_as_files; INSERT INTO files_search (id, content) SELECT new_id, content FROM wiki_as_files WHERE encrypted = 0; UPDATE wiki_as_files SET new_id = (SELECT id FROM files WHERE hash = wiki_as_files.hash); | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | author_id, public FROM wiki_as_files; INSERT INTO files_search (id, content) SELECT new_id, content FROM wiki_as_files WHERE encrypted = 0; UPDATE wiki_as_files SET new_id = (SELECT id FROM files WHERE hash = wiki_as_files.hash); UPDATE wiki_as_files SET new_parent = (SELECT w.new_id FROM wiki_as_files w WHERE w.old_id = wiki_as_files.old_parent); INSERT INTO web_pages SELECT new_id, new_parent, type, 1, uri, title, modified FROM wiki_as_files WHERE public = 1; INSERT INTO files_links (id, web_page_id) SELECT id, id FROM web_pages WHERE status = 1; INSERT INTO files_links (id, file_id) SELECT f.id, w.fichier FROM fichiers_wiki_pages w INNER JOIN wiki_as_files waf ON waf.old_id = w.id INNER JOIN files f ON f.hash = waf.hash; INSERT INTO files_links (id, transaction_id) SELECT fichier, id FROM fichiers_acc_transactions; INSERT INTO files_links (id, config) SELECT valeur, cle FROM config WHERE cle = 'image_fond' AND valeur > 0; INSERT INTO files (hash, folder_id, name, type, created, content_id, author_id, public) SELECT hash, NULL, name, type, created, content_id, author_id, 0 FROM files WHERE id = (SELECT new_id FROM wiki_as_files WHERE uri = (SELECT valeur FROM config WHERE cle = 'accueil_connexion')); UPDATE config SET valeur = (SELECT id FROM files WHERE name = 'Accueil_connexion.skriv') WHERE cle = 'accueil_connexion'; UPDATE config SET cle = 'admin_homepage' WHERE cle = 'accueil_connexion'; DELETE FROM config WHERE cle = 'accueil_wiki'; INSERT INTO config (cle, valeur) VALUES ('telephone_asso', NULL); DROP TRIGGER wiki_recherche_delete; DROP TRIGGER wiki_recherche_update; DROP TRIGGER wiki_recherche_contenu_insert; DROP TRIGGER wiki_recherche_contenu_chiffre; DROP TABLE wiki_recherche; DROP TABLE wiki_pages; DROP TABLE wiki_revisions; DROP TABLE fichiers_wiki_pages; DROP TABLE fichiers_acc_transactions; DROP TABLE fichiers_membres; |
Modified src/include/data/1.1.0_schema.sql from [bd697f352a] to [1510ba50b8].
︙ | ︙ | |||
311 312 313 314 315 316 317 | content TEXT NOT NULL -- Text content ); CREATE TABLE IF NOT EXISTS files_links -- This references use of a file outside of the documents module -- One file can only be linked to one thing ( | | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | content TEXT NOT NULL -- Text content ); CREATE TABLE IF NOT EXISTS files_links -- This references use of a file outside of the documents module -- One file can only be linked to one thing ( id INTEGER NOT NULL REFERENCES files (id) ON DELETE CASCADE, file_id INTEGER NULL REFERENCES files (id) ON DELETE CASCADE, user_id INTEGER NULL REFERENCES membres (id) ON DELETE CASCADE, transaction_id INTEGER NULL REFERENCES acc_transactions (id) ON DELETE CASCADE, config TEXT NULL REFERENCES config (cle) ON DELETE CASCADE, web_page_id INTEGER NULL REFERENCES web_pages (id) ON DELETE CASCADE, -- Make sure that only one is filled CHECK ((file_id IS NOT NULL) + (user_id IS NOT NULL) + (transaction_id IS NOT NULL) + (config IS NOT NULL) + (web_page_id IS NOT NULL) = 1) ); CREATE UNIQUE INDEX IF NOT EXISTS files_links_unique ON files_links (id, file_id, user_id, transaction_id, config, web_page_id); CREATE TABLE IF NOT EXISTS web_pages ( id INTEGER NOT NULL PRIMARY KEY REFERENCES files(id), parent_id INTEGER NULL REFERENCES web_pages(id) ON DELETE SET NULL, type INTEGER NOT NULL, -- 1 = Category, 2 = Page status INTEGER NOT NULL DEFAULT 0, -- 0 = draft, 1 = online |
︙ | ︙ |
Modified src/include/lib/Garradin/Entities/Files/File.php from [9ccf80c988] to [419025821b].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | const TABLE = 'files'; protected $id; protected $folder_id; protected $name; protected $type; protected $image; protected $size; protected $hash; protected $storage; protected $storage_path; protected $created; | > < > > < > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | const TABLE = 'files'; protected $id; protected $folder_id; protected $name; protected $type; protected $image; protected $public; protected $size; protected $hash; protected $storage; protected $storage_path; protected $created; protected $author_id; protected $content_id; protected $_types = [ 'id' => 'int', 'folder_id' => '?int', 'name' => 'string', 'type' => '?string', 'public' => 'int', 'image' => 'int', 'size' => 'int', 'hash' => 'string', 'storage' => '?string', 'storage_path' => '?string', 'created' => 'DateTime', 'author_id' => '?int', 'content_id' => '?int', ]; protected $_public; /** * Tailles de miniatures autorisées, pour ne pas avoir 500 fichiers générés avec 500 tailles différentes * @var array |
︙ | ︙ |
Modified src/include/lib/Garradin/Files/Files.php from [c115561b4c] to [c4da787241].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php namespace Garradin\Files; use Garradin\Static_Cache; use Garradin\DB; use const Garradin\FILE_STORAGE_BACKEND; class Files { static public function callStorage(string $function, ...$args) { | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php namespace Garradin\Files; use Garradin\Static_Cache; use Garradin\DB; use Garradin\Entities\Files\File; use KD2\DB\EntityManager as EM; use const Garradin\FILE_STORAGE_BACKEND; class Files { static public function callStorage(string $function, ...$args) { |
︙ | ︙ | |||
69 70 71 72 73 74 75 | $path = explode('/', $path); foreach ($path as $part) { } } } | | > | > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | $path = explode('/', $path); foreach ($path as $part) { } } } static public function get(int $id): ?File { return EM::findOneById(File::class, $id); } } |
Modified src/templates/admin/_head.tpl from [6be9088bcc] to [a52e4cbdcf].
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 | <li class="{if $current == 'acc/simple'} current{/if}"><a href="{$admin_url}acc/accounts/simple.php">Suivi des écritures</a></li> <li class="{if $current == 'acc/years'} current{/if}"><a href="{$admin_url}acc/years/">Exercices & rapports</a></li> {if $session->canAccess('compta', Membres::DROIT_ECRITURE)} <li class="{if $current == 'acc/charts'} current{/if}"><a href="{$admin_url}acc/charts/">Plans comptables</a></li> {/if} </ul> </li> {/if} {if $session->canAccess('web', Membres::DROIT_ACCES)} | > > > > > > > | > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | <li class="{if $current == 'acc/simple'} current{/if}"><a href="{$admin_url}acc/accounts/simple.php">Suivi des écritures</a></li> <li class="{if $current == 'acc/years'} current{/if}"><a href="{$admin_url}acc/years/">Exercices & rapports</a></li> {if $session->canAccess('compta', Membres::DROIT_ECRITURE)} <li class="{if $current == 'acc/charts'} current{/if}"><a href="{$admin_url}acc/charts/">Plans comptables</a></li> {/if} </ul> </li> {/if} {if $session->canAccess('documents', Membres::DROIT_ACCES)} <li class="{if $current == 'docs'} current{elseif $current_parent == 'docs'} current_parent{/if}"><a href="{$admin_url}docs/"><b class="icn">🗀</b><i> Fichiers</i></a> <ul> <li class="{if $current == 'docs/recent'} current{/if}"><a href="{$admin_url}docs/recent.php">Récents</a></li> </ul> </li> {/if} {if $session->canAccess('web', Membres::DROIT_ACCES)} <li class="{if $current == 'web'} current{elseif $current_parent == 'web'} current_parent{/if}"><a href="{$admin_url}web/"><b class="icn">🖻</b><i> Site web</i></a> <ul> <li class="{if $current == 'web/themes'} current{/if}"><a href="{$admin_url}web/themes/">Thèmes</a></li> </ul> </li> {/if} {if $session->canAccess('config', Membres::DROIT_ADMIN)} <li class="main config{if $current == 'config'} current{elseif $current_parent == 'config'} current_parent{/if}"><a href="{$admin_url}config/"><b class="icn">☸</b><i> Configuration</i></a> {/if} <li class="{if $current == 'mes_infos'} current{elseif $current_parent == 'mes_infos'} current_parent{/if}"> <a href="{$admin_url}mes_infos.php"><b class="icn">👤</b><i> Mes infos personnelles</i></a> |
︙ | ︙ |
Modified src/www/admin/upgrade.php from [0bcf1f55dd] to [f17b581907].
1 2 3 4 5 6 7 8 9 | <?php namespace Garradin; const UPGRADE_PROCESS = true; require_once __DIR__ . '/../../include/test_required.php'; require_once __DIR__ . '/../../include/init.php'; | < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <?php namespace Garradin; const UPGRADE_PROCESS = true; require_once __DIR__ . '/../../include/test_required.php'; require_once __DIR__ . '/../../include/init.php'; if (!Upgrade::preCheck()) { throw new UserException('Aucune mise à jour à effectuer, tout est à jour :-)'); } echo '<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, target-densitydpi=device-dpi" /> <link rel="stylesheet" type="text/css" href="static/admin.css" media="all" /> <script type="text/javascript" src="static/scripts/loader.js"></script> <title>Mise à jour</title> </head> <body> <header class="header"> <nav class="menu"></nav> <h1>Mise à jour de Garradin vers la version '.garradin_version().'...</h1> </header> <main> <div id="loader" class="loader" style="margin: 2em 0; height: 50px;"></div> <script> animatedLoader(document.getElementById("loader"), 5); </script>'; |
︙ | ︙ |