Overview
Comment:Don't enforce quota in upgrade
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 1.1.1
Files: files | file ages | folders
SHA3-256: afdce7b8c0912d456a4eea0825ccf7a59571c06cba3fda26a3185958ef594dd9
User & Date: bohwaz on 2021-04-10 11:49:26
Other Links: manifest | tags
Context
2021-04-10
12:04
Make sure session is started before anything is sent to browser check-in: 6a2aec70c7 user: bohwaz tags: trunk, stable, 1.1.1
11:49
Don't enforce quota in upgrade check-in: afdce7b8c0 user: bohwaz tags: trunk, stable, 1.1.1
11:39
Fix links in admin homepage check-in: 1395906311 user: bohwaz tags: trunk, stable, 1.1.1
Changes

Modified src/include/lib/Garradin/Files/Files.php from [97e4ccbc5c] to [a99c4bec9a].

12
13
14
15
16
17
18





19
20
21
22
23
24
25
...
241
242
243
244
245
246
247




248
249
250
251
252
253
254











use KD2\DB\EntityManager as EM;

use const Garradin\{FILE_STORAGE_BACKEND, FILE_STORAGE_QUOTA, FILE_STORAGE_CONFIG};

class Files
{





	static public function search(string $search, string $path = null): array
	{
		if (strlen($search) > 100) {
			throw new ValidationException('Recherche trop longue : maximum 100 caractères');
		}

		$where = '';
................................................................................
		}

		return self::callStorage('getRemainingQuota');
	}

	static public function checkQuota(int $size = 0): void
	{




		$remaining = self::getRemainingQuota(true);

		if (($remaining - $size) < 0) {
			throw new ValidationException('L\'espace disque est insuffisant pour réaliser cette opération');
		}
	}
}

















>
>
>
>
>







 







>
>
>
>






|
>
>
>
>
>
>
>
>
>
>
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273

use KD2\DB\EntityManager as EM;

use const Garradin\{FILE_STORAGE_BACKEND, FILE_STORAGE_QUOTA, FILE_STORAGE_CONFIG};

class Files
{
	/**
	 * To enable or disable quota check
	 */
	static protected $quota = true;

	static public function search(string $search, string $path = null): array
	{
		if (strlen($search) > 100) {
			throw new ValidationException('Recherche trop longue : maximum 100 caractères');
		}

		$where = '';
................................................................................
		}

		return self::callStorage('getRemainingQuota');
	}

	static public function checkQuota(int $size = 0): void
	{
		if (!self::$quota) {
			return;
		}

		$remaining = self::getRemainingQuota(true);

		if (($remaining - $size) < 0) {
			throw new ValidationException('L\'espace disque est insuffisant pour réaliser cette opération');
		}
	}

	static public function enableQuota(): void
	{
		self::$quota = true;
	}

	static public function disableQuota(): void
	{
		self::$quota = false;
	}
}

Modified src/include/lib/Garradin/Upgrade.php from [0a9d699f0f] to [19bc9790eb].

217
218
219
220
221
222
223

224
225
226
227
228
229
230
							}

							$link = sprintf('!web/page.php?p=%s', trim($link));
							return sprintf('[[%s|%s]]', $label, $link);
						}, $content);

						if ($new_content != $content) {

							$file->setContent($new_content);
						}
					}
				}
			}

			// Vérification de la cohérence des clés étrangères







>







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
							}

							$link = sprintf('!web/page.php?p=%s', trim($link));
							return sprintf('[[%s|%s]]', $label, $link);
						}, $content);

						if ($new_content != $content) {
							Files::disableQuota();
							$file->setContent($new_content);
						}
					}
				}
			}

			// Vérification de la cohérence des clés étrangères