Commit Graph

50 Commits (master)

Author SHA1 Message Date
Ferdinand Thiessen d6d6747a73 refactor: apply rector rules for PHPUnit 10
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-10-27 21:56:04 +07:00
Robin Appelman aa15f9d16d
chore: run rector
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-07-01 22:45:52 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Robin Appelman 29e39c0a2e
chore: run rector on tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-06-12 18:31:58 +07:00
Ferdinand Thiessen 3868d62a8f
test: move legacy tests to non-depecated class tests
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-16 23:09:14 +07:00
Côme Chilliet b2100484c0 fix: Remove some call and references to deprecated OC_Util class
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-04-07 17:05:54 +07:00
Côme Chilliet e467ea1c6a
chore(legacy): Remove deprecated OC_Util::addScript and functions depending on it
Deprecated since 24, currently unused.
Sadly not all related functions were officially marked as deprecated,
 but all of them were unused.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-04-01 15:24:24 +07:00
Julius Knorr 606241caeb
chore(legacy): Introduce public version ct plass and drop version methods from OC_Util
Signed-off-by: Julius Knorr <jus@bitgrid.net>
2024-09-20 14:53:34 +07:00
Christoph Wurst 49dd79eabb
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 22:32:31 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Ferdinand Thiessen 0563757ea4 fix(SetupCheck): Properly check public access to data directory
When checking for public (web) access to the data directory the status is not enough
as you might have a webserver that forwards to e.g. a login page.
So instead check that the content of the file matches.

For this the `.ncdata` file (renamed from `.ocdata`¹) has minimal text content
to allow checking.

¹The file was renamed from the legacy `.ocdata`, there is a repair step to remove the old one.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-08 22:08:42 +07:00
Ferdinand Thiessen f4ede27cdb
refactor: Remove deprecated `Util` function for filename validation to `FilenameValidator`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-07-16 12:49:10 +07:00
Ferdinand Thiessen 1a27314530
fix(Mailer): Allow to enforce strict email format
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-05-31 14:18:06 +07:00
Andy Scherzinger 1f7e2ba599
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-13 17:41:36 +07:00
John Molakvoæ 58d516b509
Make sure common and main core scripts are loaded first
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2022-03-04 10:22:56 +07:00
Louis Chemineau 25ade6218a Streamline reseting of private static properties
Signed-off-by: Louis Chemineau <louis@chmn.me>
2022-01-11 10:29:25 +07:00
Louis Chemineau 92e60caa86 Revert "Streamline reseting of private static properties"
This reverts commit e50121d4c0.
2022-01-10 18:42:07 +07:00
Louis Chemineau e50121d4c0 Streamline reseting of private static properties
Signed-off-by: Louis Chemineau <louis@chmn.me>
2022-01-10 17:34:48 +07:00
Louis Chemineau 447cd553b6
Reset $scriptDeps in tests
Signed-off-by: Louis Chemineau <louis@chmn.me>
2022-01-08 10:15:48 +07:00
Jonas Meurer 491bd6260c
Sort app scripts topologically by its dependencies
Implement a proper topological sorting algorithm. Based on the
implementation by https://github.com/marcj/topsort.php

Logs an error in case a circular dependency is detected.

Fixes: #30278

Signed-off-by: Jonas Meurer <jonas@freesources.org>
2021-12-29 16:40:05 +07:00
Jonas Meurer 8dd119402a
Improve unit testing for Util::addScript() and Util::getScript()
Instead of checking for a predefined order of the scripts, test the
logic: core first, dependencies before their children, no duplicates and
all scripts still listed.

Signed-off-by: Jonas Meurer <jonas@freesources.org>
2021-12-20 11:40:17 +07:00
John Molakvoæ (skjnldsv) 791d57051a
Adapt tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-12-02 21:13:07 +07:00
Arthur Schiwon d384edc9c6
add method to shorten a string to given byte size to Utils
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-11-26 16:21:40 +07:00
Naoto Kobayashi e9b414fbe3 OC_Util: Add fallbacks to check if current locale is UTF8
Using escapeshellcmd to get current locale causes error
if the function is disabled.

Add fallbacks to prevent the error.

Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 00:40:52 +07:00
Naoto Kobayashi 25f15f86a9 Add check whether escapeshellcmd behaves the same as basename
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-15 18:33:50 +07:00
Naoto Kobayashi 455bff5c17 Fix missing setlocale with php 8
When php version = 8, basename('§') does not bug even if LC_ALL is non-UTF-8 locale.
This cause OC_Util::isSetLocaleWorking() to skip setlocale("C.UTF-8").

Fix it by using escapeshellcmd instead of basename.

Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-14 09:18:59 +07:00
Daniel Rudolf 15a445f743
Move UtilTest::testDefaultApps() to UrlGeneratorTest
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2021-07-01 16:26:55 +07:00
Daniel Rudolf e16bf707aa
Fix UtilTest::testDefaultApps()
Oh wow... This definitly was no best practice... 😒

Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2021-07-01 16:00:29 +07:00
Daniel Rudolf 12059eb65b
Add IUrlGenerator::linkToDefaultPageUrl()
Replaces the deprecated \OC_Util::getDefaultPageUrl() and makes this API public.

Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2021-06-30 16:20:57 +07:00
Robin Appelman b1dca57a1c
load share settings from the share manager in more places
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-05-12 16:11:28 +07:00
Christoph Wurst 1584c9ae9c
Add visibility to all methods and position of static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:51:06 +07:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +07:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +07:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +07:00
Christoph Wurst 2ee65f177e
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:21:27 +07:00
Roeland Jago Douma c007ca624f
Make phpunit8 compatible
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 13:34:41 +07:00
Roeland Jago Douma 1088068c60
Remove \OCP\Files::tmpFolder
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-19 10:54:39 +07:00
Morris Jobke 44289ff134
Use proper method to format absolute timestamp
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-03-12 15:16:52 +07:00
Roeland Jago Douma 8a41d05761
Remove deprecated \OCP\Config
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-13 14:25:04 +07:00
Morris Jobke be4e921306
Use basename() instead of self implementation
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-23 12:35:47 +07:00
Morris Jobke 43e498844e
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-10-24 17:45:32 +07:00
Morris Jobke c27498db71 Use IConfig instead of static OCP\Config
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-07-27 13:43:18 +07:00
Vincent Petry 1c771c097a
Use regex to detect part files 2017-04-26 16:12:48 +07:00
Felix Epp 1614b310ef Add system config htaccess.IgnoreFrontController for prettyURLs w/o mod_env
Added the system config which sets all conditions to true that query the
FrontControllerActive mod_env variable.

Signed-off-by: Felix A. Epp <work@felixepp.de>
2016-11-16 22:28:49 +07:00
Roeland Jago Douma 83e7cfd13a
Fix more tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-28 22:16:28 +07:00
Joas Schilling 122edcd0c1
Make sure all tests use the TestCase method to overwrite services
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-20 15:19:41 +07:00
Roeland Jago Douma 368f407698
Fix getMock UtilTest 2016-09-13 09:09:53 +07:00
Roeland Jago Douma 8d739f308b
Some UtilTests require DB
In the current setup there is no DI so no way to mock them.
2016-07-11 21:05:39 +07:00
Morris Jobke c2d88a08b7
Remove unneeded checks if it runs on a Windows machine
* the setup check is still there
2016-07-08 15:55:17 +07:00
Joas Schilling 9a4253ef7c
Fix lib/ 2016-05-19 09:38:52 +07:00