21
21
use OCP \Security \Bruteforce \IThrottler ;
22
22
use OCP \Server ;
23
23
use OCP \Share ;
24
+ use OCP \Template \ITemplateManager ;
24
25
use OCP \User \Events \UserChangedEvent ;
25
26
use OCP \User \Events \UserDeletedEvent ;
26
27
use OCP \Util ;
@@ -208,7 +209,7 @@ public static function checkConfig(): void {
208
209
echo $ l ->t ('See %s ' , [ $ urlGenerator ->linkToDocs ('admin-config ' ) ]) . "\n" ;
209
210
exit ;
210
211
} else {
211
- OC_Template:: printErrorPage (
212
+ Server:: get (ITemplateManager::class)-> printErrorPage (
212
213
$ l ->t ('Cannot write into "config" directory! ' ),
213
214
$ l ->t ('This can usually be fixed by giving the web server write access to the config directory. ' ) . ' '
214
215
. $ l ->t ('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. ' ) . ' '
@@ -244,7 +245,7 @@ public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): voi
244
245
header ('Retry-After: 120 ' );
245
246
246
247
// render error page
247
- $ template = new OC_Template ('' , 'update.user ' , 'guest ' );
248
+ $ template = Server:: get (ITemplateManager::class)-> getTemplate ('' , 'update.user ' , 'guest ' );
248
249
\OCP \Util::addScript ('core ' , 'maintenance ' );
249
250
\OCP \Util::addStyle ('core ' , 'guest ' );
250
251
$ template ->printPage ();
@@ -300,7 +301,7 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
300
301
$ serverVersion = \OCP \Server::get (\OCP \ServerVersion::class);
301
302
302
303
// render error page
303
- $ template = new OC_Template ('' , 'update.use-cli ' , 'guest ' );
304
+ $ template = Server:: get (ITemplateManager::class)-> getTemplate ('' , 'update.use-cli ' , 'guest ' );
304
305
$ template ->assign ('productName ' , 'nextcloud ' ); // for now
305
306
$ template ->assign ('version ' , $ serverVersion ->getVersionString ());
306
307
$ template ->assign ('tooBig ' , $ tooBig );
@@ -327,7 +328,7 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
327
328
/** @var \OC\App\AppManager $appManager */
328
329
$ appManager = Server::get (\OCP \App \IAppManager::class);
329
330
330
- $ tmpl = new OC_Template ('' , 'update.admin ' , 'guest ' );
331
+ $ tmpl = Server:: get (ITemplateManager::class)-> getTemplate ('' , 'update.admin ' , 'guest ' );
331
332
$ tmpl ->assign ('version ' , \OCP \Server::get (\OCP \ServerVersion::class)->getVersionString ());
332
333
$ tmpl ->assign ('isAppsOnlyUpgrade ' , $ isAppsOnlyUpgrade );
333
334
@@ -420,7 +421,7 @@ public static function initSession(): void {
420
421
} catch (Exception $ e ) {
421
422
Server::get (LoggerInterface::class)->error ($ e ->getMessage (), ['app ' => 'base ' ,'exception ' => $ e ]);
422
423
//show the user a detailed error page
423
- OC_Template:: printExceptionErrorPage ($ e , 500 );
424
+ Server:: get (ITemplateManager::class)-> printExceptionErrorPage ($ e , 500 );
424
425
die ();
425
426
}
426
427
@@ -659,7 +660,7 @@ public static function init(): void {
659
660
if ($ config ->getSystemValueBool ('debug ' , false )) {
660
661
set_error_handler ([$ errorHandler , 'onAll ' ], E_ALL );
661
662
if (\OC ::$ CLI ) {
662
- $ exceptionHandler = [' OC_Template ' , 'printExceptionErrorPage ' ];
663
+ $ exceptionHandler = [Server:: get (ITemplateManager::class) , 'printExceptionErrorPage ' ];
663
664
}
664
665
} else {
665
666
set_error_handler ([$ errorHandler , 'onError ' ]);
@@ -702,7 +703,7 @@ public static function init(): void {
702
703
http_response_code (503 );
703
704
OC_Util::addStyle ('guest ' );
704
705
try {
705
- OC_Template:: printGuestPage ('' , 'error ' , ['errors ' => $ errors ]);
706
+ Server:: get (ITemplateManager::class)-> printGuestPage ('' , 'error ' , ['errors ' => $ errors ]);
706
707
exit ;
707
708
} catch (\Exception $ e ) {
708
709
// In case any error happens when showing the error page, we simply fall back to posting the text.
@@ -781,7 +782,7 @@ public static function init(): void {
781
782
// Check whether the sample configuration has been copied
782
783
if ($ systemConfig ->getValue ('copied_sample_config ' , false )) {
783
784
$ l = Server::get (\OCP \L10N \IFactory::class)->get ('lib ' );
784
- OC_Template:: printErrorPage (
785
+ Server:: get (ITemplateManager::class)-> printErrorPage (
785
786
$ l ->t ('Sample configuration detected ' ),
786
787
$ l ->t ('It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php ' ),
787
788
503
@@ -1094,7 +1095,7 @@ public static function handleRequest(): void {
1094
1095
logger ('core ' )->emergency ($ e ->getMessage (), ['exception ' => $ e ]);
1095
1096
}
1096
1097
$ l = Server::get (\OCP \L10N \IFactory::class)->get ('lib ' );
1097
- OC_Template:: printErrorPage (
1098
+ Server:: get (ITemplateManager::class)-> printErrorPage (
1098
1099
'404 ' ,
1099
1100
$ l ->t ('The page could not be found on the server. ' ),
1100
1101
404
0 commit comments