Overview
Comment:Fix 1.1.8 bug with web and SQLite storage, where pages disappeared
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 1.1.9
Files: files | file ages | folders
SHA3-256: a2880f0555a9a4b8bfa86e9f2e39f1d678010f09eb4965ec602c5b70ef7abcb5
User & Date: bohwaz on 2021-06-20 19:16:07
Other Links: manifest | tags
Context
2021-06-23
00:48
Fix migration from older version with not unique URLs check-in: 8f9740d222 user: bohwaz tags: trunk, stable
2021-06-20
19:16
Fix 1.1.8 bug with web and SQLite storage, where pages disappeared check-in: a2880f0555 user: bohwaz tags: trunk, stable, 1.1.9
19:15
Fix migration from FileSystem to SQLite check-in: 8c158ef253 user: bohwaz tags: trunk
Changes

Modified src/VERSION from [07c940882d] to [6930707832].

1
1.1.8
|
1
1.1.9

Modified src/include/lib/Garradin/Files/Storage/SQLite.php from [ce000d8bf2] to [69084d5de4].

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

	static public function listDirectoriesRecursively(string $path): array
	{
		$files = [];
		$it = DB::getInstance()->iterate('SELECT path FROM files WHERE parent LIKE ? ORDER BY path;', $path . '/%');

		foreach ($it as $file) {
			$files[] = $file->path;
		}

		return $files;
	}

	static public function exists(string $path): bool
	{







|







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

	static public function listDirectoriesRecursively(string $path): array
	{
		$files = [];
		$it = DB::getInstance()->iterate('SELECT path FROM files WHERE parent LIKE ? ORDER BY path;', $path . '/%');

		foreach ($it as $file) {
			$files[] = substr($file->path, strlen($path) + 1);
		}

		return $files;
	}

	static public function exists(string $path): bool
	{

Modified src/include/lib/Garradin/Upgrade.php from [0b2351ebf8] to [afc0149baa].

318
319
320
321
322
323
324





325
326
327
328
329
330
331
				\Garradin\Web\Web::sync();

				// Add UNIQUE index
				$db->import(ROOT . '/include/data/1.1.8_migration.sql');

				$db->commit();
			}






			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);
			Utils::resetCache(STATIC_CACHE_ROOT);







>
>
>
>
>







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
				\Garradin\Web\Web::sync();

				// Add UNIQUE index
				$db->import(ROOT . '/include/data/1.1.8_migration.sql');

				$db->commit();
			}

			if (version_compare($v, '1.1.8', '==')) {
				// Force sync to add missing pages if you had the buggy 1.1.8 version
				\Garradin\Web\Web::sync(true);
			}

			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);
			Utils::resetCache(STATIC_CACHE_ROOT);

Modified src/include/lib/Garradin/Web/Web.php from [bd32cd07a7] to [5c10caa4bb].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
37
38
39
40
41
42
43
44
45





46
47
48
49
50
51
52
use Garradin\Utils;
use Garradin\UserException;
use Garradin\ValidationException;
use Garradin\Membres\Session;

use KD2\DB\EntityManager as EM;

use const Garradin\{WWW_URI, ADMIN_URL};

class Web
{
	static public function search(string $search): array
	{
		$results = Files::search($search, File::CONTEXT_WEB . '%');

................................................................................

		return $results;
	}

	/**
	 * This syncs the whole website between the actual files and the web_pages table
	 */
	static public function sync(): array
	{





		$path = File::CONTEXT_WEB;
		$errors = [];

		$exists = array_flip(Files::callStorage('listDirectoriesRecursively', $path));

		$db = DB::getInstance();








|







 







|

>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use Garradin\Utils;
use Garradin\UserException;
use Garradin\ValidationException;
use Garradin\Membres\Session;

use KD2\DB\EntityManager as EM;

use const Garradin\{WWW_URI, ADMIN_URL, FILE_STORAGE_BACKEND};

class Web
{
	static public function search(string $search): array
	{
		$results = Files::search($search, File::CONTEXT_WEB . '%');

................................................................................

		return $results;
	}

	/**
	 * This syncs the whole website between the actual files and the web_pages table
	 */
	static public function sync(bool $force = false): array
	{
		// This is only useful if web pages are stored outside of the database
		if (FILE_STORAGE_BACKEND == 'SQLite' && !$force) {
			return [];
		}

		$path = File::CONTEXT_WEB;
		$errors = [];

		$exists = array_flip(Files::callStorage('listDirectoriesRecursively', $path));

		$db = DB::getInstance();