diff --git a/api/v1/_library/PKPLibraryController.php b/api/v1/_library/PKPLibraryController.php index b271b5cdf92..4feaf0bb268 100644 --- a/api/v1/_library/PKPLibraryController.php +++ b/api/v1/_library/PKPLibraryController.php @@ -18,7 +18,6 @@ namespace PKP\API\v1\_library; use APP\core\Application; -use APP\core\Services; use APP\file\LibraryFileManager; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -142,7 +141,7 @@ protected function fileToResponse(LibraryFile $file, LibraryFileManager $library 'filename' => $file->getServerFileName(), 'name' => $file->getName(null), 'mimetype' => $file->getFileType(), - 'documentType' => Services::get('file')->getDocumentType($file->getFileType()), + 'documentType' => app()->get('file')->getDocumentType($file->getFileType()), 'submissionId' => $file->getSubmissionId() ?? 0, 'type' => $file->getType(), 'typeName' => __($libraryFileManager->getTitleKeyFromType($file->getType())), diff --git a/api/v1/_payments/PKPBackendPaymentsSettingsController.php b/api/v1/_payments/PKPBackendPaymentsSettingsController.php index 3972e2ee456..482739f2eab 100644 --- a/api/v1/_payments/PKPBackendPaymentsSettingsController.php +++ b/api/v1/_payments/PKPBackendPaymentsSettingsController.php @@ -17,7 +17,6 @@ namespace PKP\API\v1\_payments; -use APP\core\Services; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -94,7 +93,7 @@ public function edit(Request $illuminateRequest): JsonResponse $request = $this->getRequest(); $context = $request->getContext(); $params = $illuminateRequest->input(); - $contextService = Services::get('context'); + $contextService = app()->get('context'); // Process query params to format incoming data as needed foreach ($illuminateRequest->input() as $param => $val) { diff --git a/api/v1/contexts/PKPContextController.php b/api/v1/contexts/PKPContextController.php index 46a4a266af3..45f2f9bd69b 100644 --- a/api/v1/contexts/PKPContextController.php +++ b/api/v1/contexts/PKPContextController.php @@ -16,7 +16,6 @@ namespace PKP\API\v1\contexts; use APP\core\Application; -use APP\core\Services; use APP\plugins\IDoiRegistrationAgency; use APP\services\ContextService; use APP\template\TemplateManager; @@ -181,7 +180,7 @@ public function getMany(Request $illuminateRequest): JsonResponse } } - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $items = []; $contextsIterator = $contextService->getMany($allowedParams); $propertyArgs = [ @@ -208,7 +207,7 @@ public function get(Request $illuminateRequest): JsonResponse $request = $this->getRequest(); $user = $request->getUser(); - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get((int) $illuminateRequest->route('contextId')); if (!$context) { @@ -254,7 +253,7 @@ public function getTheme(Request $illuminateRequest): JsonResponse $request = $this->getRequest(); $user = $request->getUser(); - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get((int) $illuminateRequest->route('contextId')); if (!$context) { @@ -339,7 +338,7 @@ public function add(Request $illuminateRequest): JsonResponse } } - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $errors = $contextService->validate(EntityWriteInterface::VALIDATE_ACTION_ADD, $params, $allowedLocales, $primaryLocale); if (!empty($errors)) { @@ -382,7 +381,7 @@ public function edit(Request $illuminateRequest): JsonResponse ], Response::HTTP_FORBIDDEN); } - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get($contextId); if (!$context) { @@ -445,7 +444,7 @@ public function editTheme(Request $illuminateRequest): JsonResponse ], Response::HTTP_FORBIDDEN); } - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get($contextId); if (!$context) { @@ -549,7 +548,7 @@ public function editDoiRegistrationAgencyPlugin(Request $illuminateRequest): Jso ], Response::HTTP_FORBIDDEN); } - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get($contextId); if (!$context) { @@ -565,7 +564,7 @@ public function editDoiRegistrationAgencyPlugin(Request $illuminateRequest): Jso ], Response::HTTP_FORBIDDEN); } - $schemaService = Services::get('schema'); /** @var PKPSchemaService $schemaService */ + $schemaService = app()->get('schema'); /** @var PKPSchemaService $schemaService */ $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_CONTEXT, $illuminateRequest->input()); $contextFullProps = array_flip($schemaService->getFullProps(PKPSchemaService::SCHEMA_CONTEXT)); @@ -683,7 +682,7 @@ public function delete(Request $illuminateRequest): JsonResponse $contextId = (int) $illuminateRequest->route('contextId'); - $contextService = Services::get('context'); /** @var PKPContextService $contextService */ + $contextService = app()->get('context'); /** @var PKPContextService $contextService */ $context = $contextService->get($contextId); if (!$context) { @@ -712,7 +711,7 @@ public function delete(Request $illuminateRequest): JsonResponse */ protected function updateRegistrationAgencyPluginSettings(int $contextId, Plugin $plugin, string $schemaName, array $props): void { - $schemaService = Services::get('schema'); /** @var PKPSchemaService $schemaService */ + $schemaService = app()->get('schema'); /** @var PKPSchemaService $schemaService */ $sanitizedProps = $schemaService->sanitize($schemaName, $props); foreach ($sanitizedProps as $fieldName => $value) { diff --git a/api/v1/site/PKPSiteController.php b/api/v1/site/PKPSiteController.php index b1a860a223e..e7e16f088f7 100644 --- a/api/v1/site/PKPSiteController.php +++ b/api/v1/site/PKPSiteController.php @@ -16,7 +16,6 @@ namespace PKP\API\v1\site; use APP\core\Application; -use APP\core\Services; use APP\template\TemplateManager; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -101,7 +100,7 @@ public function get(Request $illuminateRequest): JsonResponse { $request = $this->getRequest(); - $siteProps = Services::get('site') + $siteProps = app()->get('site') ->getFullProperties($request->getSite(), [ 'request' => $request, ]); @@ -149,7 +148,7 @@ public function edit(Request $illuminateRequest): JsonResponse { $request = $this->getRequest(); $site = $request->getSite(); - $siteService = Services::get('site'); + $siteService = app()->get('site'); $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_SITE, $illuminateRequest->input()); @@ -175,7 +174,7 @@ public function editTheme(Request $illuminateRequest): JsonResponse { $request = $this->getRequest(); $site = $request->getSite(); - $siteService = Services::get('site'); + $siteService = app()->get('site'); $params = $illuminateRequest->input(); diff --git a/api/v1/stats/contexts/PKPStatsContextController.php b/api/v1/stats/contexts/PKPStatsContextController.php index 4e5b13a4a89..be66c9dd8d5 100644 --- a/api/v1/stats/contexts/PKPStatsContextController.php +++ b/api/v1/stats/contexts/PKPStatsContextController.php @@ -17,7 +17,6 @@ namespace PKP\API\v1\stats\contexts; -use APP\core\Services; use APP\services\ContextService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -157,7 +156,7 @@ public function getMany(Request $illuminateRequest): StreamedResponse|JsonRespon } // Get a list of contexts with their total views matching the params - $statsService = Services::get('contextStats'); /** @var PKPStatsContextService $statsService */ + $statsService = app()->get('contextStats'); /** @var PKPStatsContextService $statsService */ $totalMetrics = $statsService->getTotals($allowedParams); // Get the stats for each context @@ -223,7 +222,7 @@ public function getManyTimeline(Request $illuminateRequest): StreamedResponse|Js ], Response::HTTP_BAD_REQUEST); } - $statsService = Services::get('contextStats'); /** @var PKPStatsContextService $statsService */ + $statsService = app()->get('contextStats'); /** @var PKPStatsContextService $statsService */ // Identify contexts which should be included in the results when a searchPhrase is passed if (!empty($allowedParams['searchPhrase'])) { @@ -261,7 +260,7 @@ public function get(Request $illuminateRequest): StreamedResponse|JsonResponse $responseCSV = str_contains($illuminateRequest->headers->get('Accept'), 'text/csv') ? true : false; $request = $this->getRequest(); - $contextService = Services::get('context'); /** @var ContextService $contextService */ + $contextService = app()->get('context'); /** @var ContextService $contextService */ $context = $contextService->get((int) $illuminateRequest->route('contextId', null)); if (!$context) { @@ -293,7 +292,7 @@ public function get(Request $illuminateRequest): StreamedResponse|JsonResponse $dateStart = array_key_exists('dateStart', $allowedParams) ? $allowedParams['dateStart'] : null; $dateEnd = array_key_exists('dateEnd', $allowedParams) ? $allowedParams['dateEnd'] : null; - $statsService = Services::get('contextStats'); + $statsService = app()->get('contextStats'); $contextViews = $statsService->getTotal($context->getId(), $dateStart, $dateEnd); // Get basic context details for display @@ -324,7 +323,7 @@ public function getTimeline(Request $illuminateRequest): StreamedResponse|JsonRe $responseCSV = str_contains($illuminateRequest->headers->get('Accept'), 'text/csv') ? true : false; $request = $this->getRequest(); - $contextService = Services::get('context'); /** @var ContextService $contextService */ + $contextService = app()->get('context'); /** @var ContextService $contextService */ $context = $contextService->get((int) $illuminateRequest->route('contextId')); if (!$context) { @@ -368,11 +367,11 @@ public function getTimeline(Request $illuminateRequest): StreamedResponse|JsonRe ], Response::HTTP_BAD_REQUEST); } - $statsService = Services::get('contextStats'); /** @var PKPStatsContextService $statsService */ + $statsService = app()->get('contextStats'); /** @var PKPStatsContextService $statsService */ $data = $statsService->getTimeline($allowedParams['timelineInterval'], $allowedParams); if ($responseCSV) { - $csvColumnNames = Services::get('contextStats')->getTimelineReportColumnNames(); + $csvColumnNames = app()->get('contextStats')->getTimelineReportColumnNames(); return response()->withFile($data, $csvColumnNames, count($data)); } @@ -432,7 +431,7 @@ protected function _processAllowedParams(array $requestParams, array $allowedPar */ protected function _processSearchPhrase(string $searchPhrase, array $contextIds = []): array { - $searchPhraseContextIds = Services::get('context')->getIds(['searchPhrase' => $searchPhrase]); + $searchPhraseContextIds = app()->get('context')->getIds(['searchPhrase' => $searchPhrase]); if (!empty($contextIds)) { return array_intersect($contextIds, $searchPhraseContextIds->toArray()); } @@ -457,7 +456,7 @@ protected function _getContextReportColumnNames(): array protected function getItemForCSV(int $contextId, int $contextViews): array { // Get context title for display - $contexts = Services::get('context')->getManySummary([]); + $contexts = app()->get('context')->getManySummary([]); // @todo: Avoid retrieving all contexts just to grab one item $context = array_filter($contexts, function ($context) use ($contextId) { return $context->id == $contextId; @@ -480,8 +479,8 @@ protected function getItemForJSON(Request $illuminateRequest, int $contextId, in 'request' => $this->getRequest(), 'apiRequest' => $illuminateRequest, ]; - $context = Services::get('context')->get($contextId); - $contextProps = Services::get('context')->getSummaryProperties($context, $propertyArgs); + $context = app()->get('context')->get($contextId); + $contextProps = app()->get('context')->getSummaryProperties($context, $propertyArgs); return [ 'total' => $contextViews, 'context' => $contextProps, diff --git a/api/v1/stats/editorial/PKPStatsEditorialController.php b/api/v1/stats/editorial/PKPStatsEditorialController.php index 1d14651f8a4..f389407ac24 100644 --- a/api/v1/stats/editorial/PKPStatsEditorialController.php +++ b/api/v1/stats/editorial/PKPStatsEditorialController.php @@ -17,7 +17,6 @@ namespace PKP\API\v1\stats\editorial; -use APP\core\Services; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -145,7 +144,7 @@ function ($item) { $item['name'] = __($item['name']); return $item; }, - Services::get('editorialStats')->getOverview($params) + app()->get('editorialStats')->getOverview($params) ), Response::HTTP_OK ); @@ -188,7 +187,7 @@ public function getAverages(Request $illuminateRequest): JsonResponse $params['contextIds'] = [$request->getContext()->getId()]; - $statsEditorialService = Services::get('editorialStats'); /** @var \PKP\services\PKPStatsEditorialService $statsEditorialService */ + $statsEditorialService = app()->get('editorialStats'); /** @var \PKP\services\PKPStatsEditorialService $statsEditorialService */ return response()->json($statsEditorialService->getAverages($params), Response::HTTP_OK); } diff --git a/api/v1/stats/publications/PKPStatsPublicationController.php b/api/v1/stats/publications/PKPStatsPublicationController.php index 03b3358498f..0101f5f1d42 100644 --- a/api/v1/stats/publications/PKPStatsPublicationController.php +++ b/api/v1/stats/publications/PKPStatsPublicationController.php @@ -18,7 +18,6 @@ namespace PKP\API\v1\stats\publications; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\statistics\StatisticsHelper; use APP\submission\Submission; @@ -210,7 +209,7 @@ public function getMany(Request $illuminateRequest): StreamedResponse|JsonRespon ], $e->getCode()); } - $statsService = Services::get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ // Get a list of top submissions by total views $totalMetrics = $statsService->getTotals($allowedParams); @@ -263,7 +262,7 @@ public function getManyTimeline(Request $illuminateRequest): StreamedResponse|Js Hook::call('API::stats::publications::timeline::params', [&$allowedParams, $illuminateRequest]); - $statsService = Services::get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ // Check/validate, filter and sanitize the request params try { @@ -320,7 +319,7 @@ public function get(Request $illuminateRequest): JsonResponse return response()->json(['error' => $result], Response::HTTP_BAD_REQUEST); } - $statsService = Services::get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ // get abstract, pdf, html and other views for the submission $dateStart = array_key_exists('dateStart', $allowedParams) ? $allowedParams['dateStart'] : null; @@ -383,7 +382,7 @@ public function getTimeline(Request $illuminateRequest): JsonResponse ], Response::HTTP_BAD_REQUEST); } - $statsService = Services::get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ $data = $statsService->getTimeline($allowedParams['timelineInterval'], $allowedParams); return response()->json($data, Response::HTTP_OK); @@ -426,7 +425,7 @@ public function getManyFiles(Request $illuminateRequest): StreamedResponse|JsonR return response()->json(['error' => $e->getMessage()], $e->getCode()); } - $statsService = Services::get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \PKP\services\PKPStatsPublicationService $statsService */ $filesMetrics = $statsService->getFilesTotals($allowedParams); $items = $submissionTitles = []; @@ -500,7 +499,7 @@ public function getManyCountries(Request $illuminateRequest): StreamedResponse|J return response()->json(['error' => $e->getMessage()], $e->getCode()); } - $statsService = Services::get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ + $statsService = app()->get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ // Get a list of top countries by total views $totals = $statsService->getTotals($allowedParams, StatisticsHelper::STATISTICS_DIMENSION_COUNTRY); @@ -571,7 +570,7 @@ public function getManyRegions(Request $illuminateRequest): StreamedResponse|Jso return response()->json(['error' => $e->getMessage()], $e->getCode()); } - $statsService = Services::get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ + $statsService = app()->get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ // Get a list of top regions by total views $totals = $statsService->getTotals($allowedParams, StatisticsHelper::STATISTICS_DIMENSION_REGION); @@ -649,7 +648,7 @@ public function getManyCities(Request $illuminateRequest): StreamedResponse|Json return response()->json(['error' => $e->getMessage()], $e->getCode()); } - $statsService = Services::get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ + $statsService = app()->get('geoStats'); /** @var \PKP\services\PKPStatsGeoService $statsService */ // Get a list of top cities by total views $totals = $statsService->getTotals($allowedParams, StatisticsHelper::STATISTICS_DIMENSION_CITY); diff --git a/api/v1/submissions/PKPSubmissionController.php b/api/v1/submissions/PKPSubmissionController.php index dca694ec807..132e8800c11 100644 --- a/api/v1/submissions/PKPSubmissionController.php +++ b/api/v1/submissions/PKPSubmissionController.php @@ -18,7 +18,6 @@ namespace PKP\API\v1\submissions; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\mail\variables\ContextEmailVariable; use APP\notification\NotificationManager; @@ -970,7 +969,7 @@ public function addPublication(Request $illuminateRequest): JsonResponse $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $errors = Repo::publication()->validate(null, $params, $submission, $submissionContext); @@ -1129,7 +1128,7 @@ public function editPublication(Request $illuminateRequest): JsonResponse $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $errors = Repo::publication()->validate($publication, $params, $submission, $submissionContext); @@ -1188,7 +1187,7 @@ public function publishPublication(Request $illuminateRequest): JsonResponse $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $primaryLocale = $submission->getData('locale'); $allowedLocales = $submissionContext->getData('supportedSubmissionLocales'); @@ -1413,7 +1412,7 @@ public function addContributor(Request $illuminateRequest): JsonResponse $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $errors = Repo::author()->validate(null, $params, $submission, $submissionContext); @@ -1524,7 +1523,7 @@ public function editContributor(Request $illuminateRequest): JsonResponse $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } if ($publication->getId() !== $author->getData('publicationId')) { @@ -1683,7 +1682,7 @@ protected function isEditor(): bool */ protected function getWriteDisabledErrors(string $schemaName, array $params): array { - $schema = Services::get('schema')->get($schemaName); + $schema = app()->get('schema')->get($schemaName); $writeDisabledProps = []; foreach ($schema->properties as $propName => $propSchema) { diff --git a/api/v1/submissions/PKPSubmissionFileController.php b/api/v1/submissions/PKPSubmissionFileController.php index b3d2dc97791..b8e14198168 100644 --- a/api/v1/submissions/PKPSubmissionFileController.php +++ b/api/v1/submissions/PKPSubmissionFileController.php @@ -18,7 +18,6 @@ namespace PKP\API\v1\submissions; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -310,7 +309,7 @@ public function add(Request $illuminateRequest): JsonResponse $request->getContext()->getId(), $submission->getId() ); - $fileId = Services::get('file')->add( + $fileId = app()->get('file')->add( $_FILES['file']['tmp_name'], $submissionDir . '/' . uniqid() . '.' . $extension ); @@ -348,7 +347,7 @@ public function add(Request $illuminateRequest): JsonResponse ); if (!empty($errors)) { - Services::get('file')->delete($fileId); + app()->get('file')->delete($fileId); return response()->json($errors, Response::HTTP_BAD_REQUEST); } @@ -359,7 +358,7 @@ public function add(Request $illuminateRequest): JsonResponse SubmissionFile::SUBMISSION_FILE_QUERY, ]; if (in_array($params['fileStage'], $notAllowedFileStages)) { - Services::get('file')->delete($fileId); + app()->get('file')->delete($fileId); return response()->json([ 'error' => __('api.submissionFiles.403.unauthorizedFileStageIdWrite'), ], Response::HTTP_BAD_REQUEST); @@ -374,7 +373,7 @@ public function add(Request $illuminateRequest): JsonResponse ]; if (in_array($params['fileStage'], $reviewFileStages)) { if (empty($params['assocType']) || $params['assocType'] !== Application::ASSOC_TYPE_REVIEW_ROUND || empty($params['assocId'])) { - Services::get('file')->delete($fileId); + app()->get('file')->delete($fileId); return response()->json([ 'error' => __('api.submissionFiles.400.missingReviewRoundAssocType'), ], Response::HTTP_BAD_REQUEST); @@ -387,7 +386,7 @@ public function add(Request $illuminateRequest): JsonResponse if (!$reviewRound || $reviewRound->getData('submissionId') != $params['submissionId'] || $reviewRound->getData('stageId') != $stageId) { - Services::get('file')->delete($fileId); + app()->get('file')->delete($fileId); return response()->json([ 'error' => __('api.submissionFiles.400.reviewRoundSubmissionNotMatch'), ], Response::HTTP_BAD_REQUEST); @@ -458,7 +457,7 @@ public function edit(Request $illuminateRequest): JsonResponse $request->getContext()->getId(), $submission->getId() ); - $fileId = Services::get('file')->add( + $fileId = app()->get('file')->add( $_FILES['file']['tmp_name'], $submissionDir . '/' . uniqid() . '.' . $extension ); diff --git a/api/v1/temporaryFiles/PKPTemporaryFilesController.php b/api/v1/temporaryFiles/PKPTemporaryFilesController.php index d84f5840d63..ddd1c01fed1 100644 --- a/api/v1/temporaryFiles/PKPTemporaryFilesController.php +++ b/api/v1/temporaryFiles/PKPTemporaryFilesController.php @@ -16,7 +16,6 @@ namespace PKP\API\v1\temporaryFiles; use APP\core\Application; -use APP\core\Services; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -139,7 +138,7 @@ public function uploadFile(Request $illuminateRequest): JsonResponse 'id' => $uploadedFile->getId(), 'name' => $uploadedFile->getData('originalFileName'), 'mimetype' => $uploadedFile->getData('filetype'), - 'documentType' => Services::get('file')->getDocumentType($uploadedFile->getData('filetype')), + 'documentType' => app()->get('file')->getDocumentType($uploadedFile->getData('filetype')), ], Response::HTTP_OK); } diff --git a/classes/author/Repository.php b/classes/author/Repository.php index 69a06985790..1d206aac06d 100644 --- a/classes/author/Repository.php +++ b/classes/author/Repository.php @@ -16,7 +16,6 @@ use APP\author\Author; use APP\author\DAO; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\submission\Submission; use PKP\context\Context; @@ -98,7 +97,7 @@ public function getSchemaMap(): maps\Schema */ public function validate($author, $props, Submission $submission, Context $context) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $primaryLocale = $submission->getData('locale'); $allowedLocales = $submission->getPublicationLanguages($context->getSupportedSubmissionMetadataLocales()); diff --git a/classes/components/fileAttachers/ReviewFiles.php b/classes/components/fileAttachers/ReviewFiles.php index 0a408cc7c96..8888d0acf68 100644 --- a/classes/components/fileAttachers/ReviewFiles.php +++ b/classes/components/fileAttachers/ReviewFiles.php @@ -16,7 +16,6 @@ namespace PKP\components\fileAttachers; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use Exception; use PKP\context\Context; @@ -76,7 +75,7 @@ protected function getFilesState(): array $files[] = [ 'id' => $file->getId(), 'name' => $file->getData('name'), - 'documentType' => Services::get('file')->getDocumentType($file->getData('documentType')), + 'documentType' => app()->get('file')->getDocumentType($file->getData('documentType')), 'reviewerName' => $this->reviewAssignments[$file->getData('assocId')]->getReviewerFullName(), 'url' => $request->getDispatcher()->url( $request, diff --git a/classes/components/forms/site/PKPSiteConfigForm.php b/classes/components/forms/site/PKPSiteConfigForm.php index 97533939bd2..8e1eb1732cb 100644 --- a/classes/components/forms/site/PKPSiteConfigForm.php +++ b/classes/components/forms/site/PKPSiteConfigForm.php @@ -15,7 +15,6 @@ namespace PKP\components\forms\site; -use APP\core\Services; use PKP\components\forms\FieldOptions; use PKP\components\forms\FieldSelect; use PKP\components\forms\FieldText; @@ -42,7 +41,7 @@ public function __construct($action, $locales, $site) $this->action = $action; $this->locales = $locales; - $contextsIterator = Services::get('context')->getMany(['isEnabled' => true]); + $contextsIterator = app()->get('context')->getMany(['isEnabled' => true]); $this->addField(new FieldText('title', [ 'label' => __('admin.settings.siteTitle'), diff --git a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php index d63f6e4850f..4e4d2418b7f 100644 --- a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php +++ b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php @@ -38,7 +38,6 @@ use PKP\core\JSONMessage; use PKP\core\PKPApplication; use PKP\core\PKPRequest; -use PKP\core\PKPServices; use PKP\db\DAO; use PKP\db\DAORegistry; use PKP\emailTemplate\EmailTemplate; @@ -557,7 +556,7 @@ public function updateReinstateReviewer($args, $request) if ($reinstateReviewerForm->execute() && !$request->getUserVar('skipEmail')) { $reviewer = Repo::user()->get($reviewAssignment->getReviewerId()); $user = $request->getUser(); - $context = PKPServices::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $template = Repo::emailTemplate()->getByKey($context->getId(), ReviewerReinstate::getEmailTemplateKey()); $mailable = new ReviewerReinstate($context, $submission, $reviewAssignment); $this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer); @@ -649,7 +648,7 @@ public function updateUnassignReviewer($args, $request) if ($unassignReviewerForm->execute() && !$request->getUserVar('skipEmail')) { $reviewer = Repo::user()->get($reviewAssignment->getReviewerId()); $user = $request->getUser(); - $context = PKPServices::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $template = Repo::emailTemplate()->getByKey($context->getId(), ReviewerUnassign::getEmailTemplateKey()); $mailable = new ReviewerUnassign($context, $submission, $reviewAssignment); $this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer); diff --git a/classes/core/AppServiceProvider.php b/classes/core/AppServiceProvider.php index 26315075e2d..cfa7671e868 100644 --- a/classes/core/AppServiceProvider.php +++ b/classes/core/AppServiceProvider.php @@ -15,7 +15,6 @@ namespace PKP\core; -use APP\core\Services; use APP\core\Application; use Illuminate\Support\ServiceProvider; use PKP\services\PKPStatsSushiService; diff --git a/classes/core/Dispatcher.php b/classes/core/Dispatcher.php index fc2579a0ada..5d03720f640 100644 --- a/classes/core/Dispatcher.php +++ b/classes/core/Dispatcher.php @@ -14,7 +14,6 @@ namespace PKP\core; -use APP\core\Services; use PKP\config\Config; use PKP\plugins\Hook; use PKP\plugins\PluginRegistry; @@ -153,7 +152,7 @@ public function dispatch(PKPRequest $request) // Reload the context after generic plugins have loaded so that changes to // the context schema can take place - $contextSchema = Services::get('schema')->get(PKPSchemaService::SCHEMA_CONTEXT, true); + $contextSchema = app()->get('schema')->get(PKPSchemaService::SCHEMA_CONTEXT, true); $request->getRouter()->getContext($request, true); $router->route($request); diff --git a/classes/core/PKPBaseController.php b/classes/core/PKPBaseController.php index 98a3f3e45ba..d1a2c64c9d9 100644 --- a/classes/core/PKPBaseController.php +++ b/classes/core/PKPBaseController.php @@ -18,7 +18,6 @@ namespace PKP\core; use APP\core\Application; -use APP\core\Services; use Exception; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; @@ -411,7 +410,7 @@ public function getParameter(string $parameterName, mixed $default = null): mixe */ public function convertStringsToSchema(string $schema, array $params): array { - $schema = Services::get('schema')->get($schema); + $schema = app()->get('schema')->get($schema); foreach ($params as $paramName => $paramValue) { if (!property_exists($schema->properties, $paramName)) { diff --git a/classes/db/SchemaDAO.php b/classes/db/SchemaDAO.php index b545249fc85..fc3c4703ee5 100644 --- a/classes/db/SchemaDAO.php +++ b/classes/db/SchemaDAO.php @@ -16,7 +16,6 @@ namespace PKP\db; -use APP\core\Services; use Exception; use Illuminate\Support\Facades\DB; @@ -74,7 +73,7 @@ public function getById($objectId) */ public function insertObject($object) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $schema = $schemaService->get($this->schemaName); $sanitizedProps = $schemaService->sanitize($this->schemaName, $object->_data); @@ -136,7 +135,7 @@ public function insertObject($object) */ public function updateObject($object) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $schema = $schemaService->get($this->schemaName); $sanitizedProps = $schemaService->sanitize($this->schemaName, $object->_data); @@ -224,7 +223,7 @@ public function deleteById(int $objectId): int */ public function _fromRow($primaryRow) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $schema = $schemaService->get($this->schemaName); $object = $this->newDataObject(); @@ -269,8 +268,8 @@ public function _fromRow($primaryRow) */ private function _getPrimaryDbProps($object) { - $schema = Services::get('schema')->get($this->schemaName); - $sanitizedProps = Services::get('schema')->sanitize($this->schemaName, $object->_data); + $schema = app()->get('schema')->get($this->schemaName); + $sanitizedProps = app()->get('schema')->sanitize($this->schemaName, $object->_data); $primaryDbProps = []; foreach ($this->primaryTableColumns as $propName => $columnName) { diff --git a/classes/decision/Repository.php b/classes/decision/Repository.php index b6c7883178b..79d1f81a6bd 100644 --- a/classes/decision/Repository.php +++ b/classes/decision/Repository.php @@ -15,7 +15,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\decision\Decision; use APP\facades\Repo; use APP\notification\NotificationManager; @@ -232,7 +231,7 @@ public function add(Decision $decision): int $decision = $this->get($decision->getId()); $context = Application::get()->getRequest()->getContext(); if (!$context || $context->getId() !== $submission->getData('contextId')) { - $context = Services::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); } // Log the decision diff --git a/classes/decision/types/traits/IsRecommendation.php b/classes/decision/types/traits/IsRecommendation.php index b6206cb0cb1..945bc81f2ee 100644 --- a/classes/decision/types/traits/IsRecommendation.php +++ b/classes/decision/types/traits/IsRecommendation.php @@ -14,7 +14,6 @@ namespace PKP\decision\types\traits; use APP\core\Application; -use APP\core\Services; use APP\decision\Decision; use APP\facades\Repo; use APP\submission\Submission; @@ -208,7 +207,7 @@ protected function addSubmissionFileToNoteFromFilePath(string $filepath, string { $extension = pathinfo($filename, PATHINFO_EXTENSION); $submissionDir = Repo::submissionFile()->getSubmissionDir($context->getId(), $submission->getId()); - $fileId = Services::get('file')->add( + $fileId = app()->get('file')->add( $filepath, $submissionDir . '/' . uniqid() . '.' . $extension ); diff --git a/classes/doi/RegistrationAgencySettings.php b/classes/doi/RegistrationAgencySettings.php index 504b142a83c..784aab8e6cb 100644 --- a/classes/doi/RegistrationAgencySettings.php +++ b/classes/doi/RegistrationAgencySettings.php @@ -16,7 +16,6 @@ namespace PKP\doi; -use APP\core\Services; use APP\plugins\IDoiRegistrationAgency; use Illuminate\Validation\Validator; use PKP\components\forms\Field; @@ -40,7 +39,7 @@ public function __construct(IDoiRegistrationAgency $agencyPlugin) public function validate(array $props): array { /** @var PKPSchemaService $schemaService */ - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $validator = ValidatorFactory::make( $props, diff --git a/classes/doi/Repository.php b/classes/doi/Repository.php index ef869caa4c6..5c243e62e7a 100644 --- a/classes/doi/Repository.php +++ b/classes/doi/Repository.php @@ -15,7 +15,6 @@ namespace PKP\doi; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use Exception; use Illuminate\Support\Facades\App; @@ -155,7 +154,7 @@ public function validate(?Doi $object, array $props): array // The contextId must match an existing context $validator->after(function ($validator) use ($object, $props) { if (isset($props['contextId']) && !$validator->errors()->get('contextId')) { - if (!Services::get('context')->exists($props['contextId'])) { + if (!app()->get('context')->exists($props['contextId'])) { $validator->errors()->add('contextId', __('api.contexts.404.contextNotFound')); } } diff --git a/classes/emailTemplate/DAO.php b/classes/emailTemplate/DAO.php index 8cf3dea3dc2..ff388308a58 100644 --- a/classes/emailTemplate/DAO.php +++ b/classes/emailTemplate/DAO.php @@ -14,7 +14,6 @@ namespace PKP\emailTemplate; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use Exception; use Illuminate\Support\Facades\DB; @@ -277,7 +276,7 @@ public function installEmailTemplates( $this->installEmailTemplateLocaleData($templatesFile, $locales, $attrs['key']); if (isset($attrs['alternateTo'])) { - $contextIds = Services::get('context')->getIds(); + $contextIds = app()->get('context')->getIds(); foreach ($contextIds as $contextId) { $this->installAlternateEmailTemplates($contextId, $attrs['key']); } diff --git a/classes/emailTemplate/Repository.php b/classes/emailTemplate/Repository.php index cb637536557..37f58e7af54 100644 --- a/classes/emailTemplate/Repository.php +++ b/classes/emailTemplate/Repository.php @@ -13,7 +13,6 @@ namespace PKP\emailTemplate; -use APP\core\Services; use APP\emailTemplate\DAO; use APP\facades\Repo; use PKP\context\Context; @@ -105,7 +104,7 @@ public function validate(?EmailTemplate $object, array $props, Context $context) if (isset($props['contextId'])) { $validator->after(function ($validator) use ($props, $context) { - if (!Services::get('context')->exists($props['contextId'])) { + if (!app()->get('context')->exists($props['contextId'])) { $validator->errors()->add('contextId', __('api.contexts.404.contextNotFound')); } if ($context->getId() !== $props['contextId']) { diff --git a/classes/file/PKPFile.php b/classes/file/PKPFile.php index 2d6225d6ed9..d63ebc8198d 100644 --- a/classes/file/PKPFile.php +++ b/classes/file/PKPFile.php @@ -16,8 +16,6 @@ namespace PKP\file; -use APP\core\Services; - class PKPFile extends \PKP\core\DataObject { // @@ -128,7 +126,7 @@ public function setFileSize($fileSize) */ public function getNiceFileSize() { - return Services::get('file')->getNiceFileSize($this->getFileSize()); + return app()->get('file')->getNiceFileSize($this->getFileSize()); } diff --git a/classes/galley/Galley.php b/classes/galley/Galley.php index 2d9787aff0b..96fb553e312 100644 --- a/classes/galley/Galley.php +++ b/classes/galley/Galley.php @@ -16,7 +16,6 @@ namespace PKP\galley; -use APP\core\Services; use APP\facades\Repo; use PKP\facades\Locale; use PKP\i18n\LocaleMetadata; @@ -200,7 +199,7 @@ public function getLanguageNames(): array */ public function getLanguages(): array { - $props = Services::get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_GALLEY); + $props = app()->get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_GALLEY); $locales = array_map(fn (string $prop): array => array_keys($this->getData($prop) ?? []), $props); return collect([$this->getData('locale')]) ->concat($locales) diff --git a/classes/install/PKPInstall.php b/classes/install/PKPInstall.php index 3c90c51bb8d..741475c6295 100644 --- a/classes/install/PKPInstall.php +++ b/classes/install/PKPInstall.php @@ -29,7 +29,6 @@ namespace PKP\install; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use Illuminate\Support\Facades\Config as FacadesConfig; use PKP\config\Config; @@ -267,7 +266,7 @@ public function createData() Repo::emailTemplate()->dao->installEmailTemplates(Repo::emailTemplate()->dao->getMainEmailTemplatesFilename(), $this->installedLocales); // Install default site settings - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $site = $schemaService->setDefaults(PKPSchemaService::SCHEMA_SITE, $site, $site->getSupportedLocales(), $site->getPrimaryLocale()); $site->setData('contactEmail', $this->getParam('adminEmail'), $site->getPrimaryLocale()); $siteDao->updateObject($site); diff --git a/classes/institution/Repository.php b/classes/institution/Repository.php index 8bf401606f1..a116207a87a 100644 --- a/classes/institution/Repository.php +++ b/classes/institution/Repository.php @@ -14,7 +14,6 @@ namespace PKP\institution; use APP\core\Request; -use APP\core\Services; use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\plugins\Hook; @@ -117,7 +116,7 @@ public function validate(?Institution $object, array $props, array $allowedLocal // The contextId must match an existing context $validator->after(function ($validator) use ($props) { if (isset($props['contextId']) && !$validator->errors()->get('contextId')) { - $institutionContext = Services::get('context')->get($props['contextId']); + $institutionContext = app()->get('context')->get($props['contextId']); if (!$institutionContext) { $validator->errors()->add('contextId', __('manager.institutions.noContext')); } diff --git a/classes/jats/Repository.php b/classes/jats/Repository.php index 04bbf561617..544a848f42e 100644 --- a/classes/jats/Repository.php +++ b/classes/jats/Repository.php @@ -14,7 +14,6 @@ namespace PKP\jats; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\plugins\generic\jatsTemplate\classes\Article; use Exception; @@ -96,7 +95,7 @@ public function createDefaultJatsContent(int $publicationId, ?int $submissionId $publication = Repo::publication()->get($publicationId, $submissionId); $submission = Repo::submission()->get($publication->getData('submissionId')); - $context = Services::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $section = Repo::section()->get($submission->getSectionId()); $issue = null; @@ -150,7 +149,7 @@ public function addJatsFile( $submission->getId() ); - $fileId = Services::get('file')->add( + $fileId = app()->get('file')->add( $fileTmpName, $submissionDir . '/' . uniqid() . '.' . $extension ); @@ -186,7 +185,7 @@ public function addJatsFile( ); if (!empty($errors)) { - Services::get('file')->delete($fileId); + app()->get('file')->delete($fileId); throw new Exception(''. implode(', ', $errors)); } diff --git a/classes/mail/Mailable.php b/classes/mail/Mailable.php index df3080f8197..c435aee084a 100644 --- a/classes/mail/Mailable.php +++ b/classes/mail/Mailable.php @@ -28,7 +28,6 @@ namespace PKP\mail; -use APP\core\Services; use APP\decision\Decision; use APP\facades\Repo; use APP\mail\variables\ContextEmailVariable; @@ -596,7 +595,7 @@ public function attachSubmissionFile(int $id, string $name): self if (!$submissionFile) { throw new Exception('Tried to attach submission file ' . $id . ' that does not exist.'); } - $file = Services::get('file')->get($submissionFile->getData('fileId')); + $file = app()->get('file')->get($submissionFile->getData('fileId')); $this->attach( Config::getVar('files', 'files_dir') . '/' . $file->path, [ diff --git a/classes/mail/mailables/ChangeProfileEmailInvitationNotify.php b/classes/mail/mailables/ChangeProfileEmailInvitationNotify.php index b2c7ea41624..31d3443c5e8 100644 --- a/classes/mail/mailables/ChangeProfileEmailInvitationNotify.php +++ b/classes/mail/mailables/ChangeProfileEmailInvitationNotify.php @@ -16,7 +16,6 @@ namespace PKP\mail\mailables; -use APP\core\Services; use PKP\context\Context; use PKP\mail\Mailable; use PKP\mail\traits\Configurable; diff --git a/classes/migration/upgrade/v3_5_0/I9860_EditorialMastheadNavMenuItem.php b/classes/migration/upgrade/v3_5_0/I9860_EditorialMastheadNavMenuItem.php index 3a7a79213c0..db8c30a1023 100644 --- a/classes/migration/upgrade/v3_5_0/I9860_EditorialMastheadNavMenuItem.php +++ b/classes/migration/upgrade/v3_5_0/I9860_EditorialMastheadNavMenuItem.php @@ -14,7 +14,6 @@ namespace PKP\migration\upgrade\v3_5_0; -use APP\core\Services; use PKP\db\DAORegistry; use PKP\install\DowngradeNotSupportedException; use PKP\migration\Migration; @@ -32,7 +31,7 @@ public function up(): void $navigationMenuItemDao = DAORegistry::getDAO('NavigationMenuItemDAO'); /** @var NavigationMenuItemDAO $navigationMenuItemDao */ $navigationMenuItemAssignmentDao = DAORegistry::getDAO('NavigationMenuItemAssignmentDAO'); /** @var NavigationMenuItemAssignmentDAO $navigationMenuItemAssignmentDao */ - $contextIds = Services::get('context')->getIds(); + $contextIds = app()->get('context')->getIds(); foreach ($contextIds as $contextId) { // Create and insert new Editorial Masthead navigation menu item $navigationMenuItem = $navigationMenuItemDao->newDataObject(); diff --git a/classes/migration/upgrade/v3_5_0/InstallEmailTemplates.php b/classes/migration/upgrade/v3_5_0/InstallEmailTemplates.php index 7054bca4df8..a3f8a5ae947 100644 --- a/classes/migration/upgrade/v3_5_0/InstallEmailTemplates.php +++ b/classes/migration/upgrade/v3_5_0/InstallEmailTemplates.php @@ -14,7 +14,6 @@ namespace PKP\migration\upgrade\v3_5_0; -use APP\core\Services; use Exception; use Illuminate\Support\Facades\DB; use PKP\db\XMLDAO; @@ -42,7 +41,7 @@ public function up(): void throw new Exception('Unable to find entries in registry/emailTemplates.xml.'); } - $contextIds = Services::get('context')->getIds(); + $contextIds = app()->get('context')->getIds(); $locales = json_decode( DB::table('site')->pluck('installed_locales')->first() ); diff --git a/classes/plugins/ThemePlugin.php b/classes/plugins/ThemePlugin.php index 953d679884d..7d6d9da0994 100644 --- a/classes/plugins/ThemePlugin.php +++ b/classes/plugins/ThemePlugin.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\statistics\StatisticsHelper; use APP\template\TemplateManager; @@ -994,7 +993,7 @@ public function downloadStatsCacheMiss(int $submissionId): array $params['dateStart'] = $earliestDatePublished; } - $statsService = Services::get('publicationStats'); /** @var \App\services\StatsPublicationService $statsService */ + $statsService = app()->get('publicationStats'); /** @var \App\services\StatsPublicationService $statsService */ $data = $statsService->getTimeline($params['timelineInterval'], $params); return $data; } diff --git a/classes/publication/PKPPublication.php b/classes/publication/PKPPublication.php index b14c6bf8c6e..849eb63b9fe 100644 --- a/classes/publication/PKPPublication.php +++ b/classes/publication/PKPPublication.php @@ -19,7 +19,6 @@ namespace PKP\publication; use APP\author\Author; -use APP\core\Services; use APP\facades\Repo; use PKP\core\Core; use PKP\core\PKPString; @@ -453,7 +452,7 @@ public function getLanguageNames(): array */ public function getLanguages(?array ...$additionalLocales): array { - $getMProps = fn (string $schema): array => Services::get('schema')->getMultilingualProps($schema); + $getMProps = fn (string $schema): array => app()->get('schema')->getMultilingualProps($schema); $metadataprops = $getMProps(PKPSchemaService::SCHEMA_PUBLICATION); $authorProps = $getMProps(PKPSchemaService::SCHEMA_AUTHOR); diff --git a/classes/publication/Repository.php b/classes/publication/Repository.php index 702b93ac1a7..c829375ab29 100644 --- a/classes/publication/Repository.php +++ b/classes/publication/Repository.php @@ -15,7 +15,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\file\PublicFileManager; use APP\publication\DAO; @@ -299,7 +298,7 @@ public function add(Publication $publication): int $submissionContext = $this->request->getContext(); if ($submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $supportedLocales = $submission->getPublicationLanguages($submissionContext->getSupportedSubmissionMetadataLocales()); @@ -407,7 +406,7 @@ public function edit(Publication $publication, array $params): Publication if (array_key_exists('coverImage', $params)) { $submissionContext = $this->request->getContext(); if ($submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $supportedLocales = $submission->getPublicationLanguages($submissionContext->getSupportedSubmissionMetadataLocales()); @@ -551,7 +550,7 @@ public function publish(Publication $publication) $context = $submission->getData('contextId') === Application::get()->getRequest()->getContext()?->getId() ? Application::get()->getRequest()->getContext() - : Services::get('context')->get($submission->getData('contextId')); + : app()->get('context')->get($submission->getData('contextId')); event(new PublicationPublished($newPublication, $publication, $submission, $context)); } @@ -640,7 +639,7 @@ public function unpublish(Publication $publication) $context = $submission->getData('contextId') === Application::get()->getRequest()->getContext()->getId() ? Application::get()->getRequest()->getContext() - : Services::get('context')->get($submission->getData('contextId')); + : app()->get('context')->get($submission->getData('contextId')); event(new PublicationUnpublished($newPublication, $publication, $submission, $context)); } @@ -729,13 +728,13 @@ protected function _saveFileParam( // Get the submission context $submissionContext = $this->request->getContext(); if ($submissionContext->getId() !== $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $temporaryFileManager = new TemporaryFileManager(); $temporaryFile = $temporaryFileManager->getFile((int) $value['temporaryFileId'], $userId); $fileNameBase = join('_', ['submission', $submission->getId(), $publication->getId(), $settingName]); // eg - submission_1_1_coverImage - $fileName = Services::get('context')->moveTemporaryFile($submissionContext, $temporaryFile, $fileNameBase, $userId, $localeKey); + $fileName = app()->get('context')->moveTemporaryFile($submissionContext, $temporaryFile, $fileNameBase, $userId, $localeKey); if ($fileName) { if ($isImage) { diff --git a/classes/section/Repository.php b/classes/section/Repository.php index c179aaa3f05..cc19d51cf08 100644 --- a/classes/section/Repository.php +++ b/classes/section/Repository.php @@ -14,7 +14,6 @@ namespace PKP\section; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\section\DAO; use APP\section\Section; @@ -113,7 +112,7 @@ public function validate(?Section $object, array $props, Context $context): arra // The contextId must match an existing context $validator->after(function ($validator) use ($props) { if (isset($props['contextId']) && !$validator->errors()->get('contextId')) { - $sectionContext = Services::get('context')->get($props['contextId']); + $sectionContext = app()->get('context')->get($props['contextId']); if (!$sectionContext) { $validator->errors()->add('contextId', __('manager.sections.noContext')); } diff --git a/classes/services/PKPContextService.php b/classes/services/PKPContextService.php index a4ba497a47e..32638769831 100644 --- a/classes/services/PKPContextService.php +++ b/classes/services/PKPContextService.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\file\PublicFileManager; use APP\services\queryBuilders\ContextQueryBuilder; @@ -228,7 +227,7 @@ public function getProperties($context, $props, $args = null) } $supportedLocales = empty($args['supportedLocales']) ? $context->getSupportedFormLocales() : $args['supportedLocales']; - $values = Services::get('schema')->addMissingMultilingualValues(PKPSchemaService::SCHEMA_CONTEXT, $values, $supportedLocales); + $values = app()->get('schema')->addMissingMultilingualValues(PKPSchemaService::SCHEMA_CONTEXT, $values, $supportedLocales); Hook::call('Context::getProperties', [&$values, $context, $props, $args]); @@ -244,7 +243,7 @@ public function getProperties($context, $props, $args = null) */ public function getSummaryProperties($context, $args = null) { - $props = Services::get('schema')->getSummaryProps(PKPSchemaService::SCHEMA_CONTEXT); + $props = app()->get('schema')->getSummaryProps(PKPSchemaService::SCHEMA_CONTEXT); return $this->getProperties($context, $props, $args); } @@ -256,7 +255,7 @@ public function getSummaryProperties($context, $args = null) */ public function getFullProperties($context, $args = null) { - $props = Services::get('schema')->getFullProps(PKPSchemaService::SCHEMA_CONTEXT); + $props = app()->get('schema')->getFullProps(PKPSchemaService::SCHEMA_CONTEXT); return $this->getProperties($context, $props, $args); } @@ -268,7 +267,7 @@ public function getFullProperties($context, $args = null) */ public function validate($action, $props, $allowedLocales, $primaryLocale) { - $schemaService = Services::get('schema'); /** @var PKPSchemaService $schemaService */ + $schemaService = app()->get('schema'); /** @var PKPSchemaService $schemaService */ $validator = ValidatorFactory::make( $props, @@ -492,7 +491,7 @@ public function add($context, $request) // Allow plugins to extend the $localeParams for new property defaults Hook::call('Context::defaults::localeParams', [&$localeParams, $context, $request]); - $context = Services::get('schema')->setDefaults( + $context = app()->get('schema')->setDefaults( PKPSchemaService::SCHEMA_CONTEXT, $context, $context->getData('supportedLocales'), @@ -704,7 +703,7 @@ public function restoreLocaleDefaults($context, $request, $locale) // Allow plugins to extend the $localeParams for new property defaults Hook::call('Context::restoreLocaleDefaults::localeParams', [&$localeParams, $context, $request, $locale]); - $localeDefaults = Services::get('schema')->getLocaleDefaults(PKPSchemaService::SCHEMA_CONTEXT, $locale, $localeParams); + $localeDefaults = app()->get('schema')->getLocaleDefaults(PKPSchemaService::SCHEMA_CONTEXT, $locale, $localeParams); $params = []; foreach ($localeDefaults as $paramName => $value) { diff --git a/classes/services/PKPSiteService.php b/classes/services/PKPSiteService.php index e2e083615e9..8bbb8c76516 100644 --- a/classes/services/PKPSiteService.php +++ b/classes/services/PKPSiteService.php @@ -17,7 +17,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\file\PublicFileManager; use PKP\core\Core; use PKP\db\DAORegistry; @@ -51,7 +50,7 @@ public function getProperties($site, $props, $args = null) $values[$prop] = $site->getData($prop); } - $values = Services::get('schema')->addMissingMultilingualValues(PKPSchemaService::SCHEMA_SITE, $values, $site->getSupportedLocales()); + $values = app()->get('schema')->addMissingMultilingualValues(PKPSchemaService::SCHEMA_SITE, $values, $site->getSupportedLocales()); Hook::call('Site::getProperties', [&$values, $site, $props, $args]); @@ -77,7 +76,7 @@ public function getSummaryProperties($site, $args = null) */ public function getFullProperties($site, $args = null) { - $props = Services::get('schema')->getFullProps(PKPSchemaService::SCHEMA_SITE); + $props = app()->get('schema')->getFullProps(PKPSchemaService::SCHEMA_SITE); return $this->getProperties($site, $props, $args); } @@ -100,7 +99,7 @@ public function getFullProperties($site, $args = null) */ public function validate($props, $allowedLocales, $primaryLocale) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $validator = ValidatorFactory::make( $props, diff --git a/classes/site/SiteDAO.php b/classes/site/SiteDAO.php index 784634b2b02..75945503a84 100644 --- a/classes/site/SiteDAO.php +++ b/classes/site/SiteDAO.php @@ -16,7 +16,6 @@ namespace PKP\site; -use APP\core\Services; use Illuminate\Support\Facades\DB; use PKP\services\PKPSchemaService; @@ -61,7 +60,7 @@ public function newDataObject(): Site */ public function _fromRow(array $primaryRow, bool $callHook = true): Site { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $schema = $schemaService->get(PKPSchemaService::SCHEMA_SITE); $site = $this->newDataObject(); @@ -120,7 +119,7 @@ public function insertSite(Site $site): void */ public function updateObject(Site $site): void { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $schema = $schemaService->get(PKPSchemaService::SCHEMA_SITE); $sanitizedProps = $schemaService->sanitize(PKPSchemaService::SCHEMA_SITE, $site->_data); diff --git a/classes/submission/Repository.php b/classes/submission/Repository.php index f6627138218..ea6e9496c99 100644 --- a/classes/submission/Repository.php +++ b/classes/submission/Repository.php @@ -16,7 +16,6 @@ use APP\author\Author; use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\publication\Publication; use APP\section\Section; @@ -171,7 +170,7 @@ public function getWorkflowUrlByUserRoles(Submission $submission, ?int $userId = $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() != $submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $dispatcher = $request->getDispatcher(); @@ -304,7 +303,7 @@ public function validate(?Submission $submission, array $props, Context $context // The contextId must match an existing context $validator->after(function ($validator) use ($props) { if (isset($props['contextId']) && !$validator->errors()->get('contextId')) { - $submissionContext = Services::get('context')->exists($props['contextId']); + $submissionContext = app()->get('context')->exists($props['contextId']); if (!$submissionContext) { $validator->errors()->add('contextId', __('submission.submit.noContext')); } diff --git a/classes/submission/action/EditorAction.php b/classes/submission/action/EditorAction.php index 6ec8a665c2e..33df05d2a21 100644 --- a/classes/submission/action/EditorAction.php +++ b/classes/submission/action/EditorAction.php @@ -24,7 +24,6 @@ use PKP\core\Core; use PKP\core\PKPApplication; use PKP\core\PKPRequest; -use PKP\core\PKPServices; use PKP\core\PKPString; use PKP\db\DAORegistry; use PKP\invitation\invitations\ReviewerAccessInvite; @@ -137,7 +136,7 @@ public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $ // Send mail if (!$request->getUserVar('skipEmail')) { - $context = PKPServices::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $emailTemplate = Repo::emailTemplate()->getByKey($submission->getData('contextId'), $request->getUserVar('template')); $emailBody = $request->getUserVar('personalMessage'); $emailSubject = $emailTemplate->getLocalizedData('subject'); diff --git a/classes/submissionFile/Repository.php b/classes/submissionFile/Repository.php index 93b9b20750d..8381dfbfd13 100644 --- a/classes/submissionFile/Repository.php +++ b/classes/submissionFile/Repository.php @@ -15,7 +15,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\notification\NotificationManager; use APP\publication\Publication; @@ -487,7 +486,7 @@ public function delete(SubmissionFile $submissionFile): void ->includeDependentFiles(true) ->getCount(); if (!$countFileShares) { - Services::get('file')->delete($revision->fileId); + app()->get('file')->delete($revision->fileId); } } @@ -763,7 +762,7 @@ public function getRevisions(int $submissionFileId): Collection protected function notifyEditorsRevisionsUploaded(SubmissionFile $submissionFile): void { $submission = Repo::submission()->get($submissionFile->getData('submissionId')); - $context = Services::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $uploader = Repo::user()->get($submissionFile->getData('uploaderUserId')); $user = $this->request->getUser(); @@ -860,7 +859,7 @@ public function versionSubmissionFile( $oldFileId = $submissionFile->getData('fileId'); - $oldFile = Services::get('file')->get($oldFileId); + $oldFile = app()->get('file')->get($oldFileId); $submission = Repo::submission()->get($newPublication->getData('submissionId')); @@ -873,7 +872,7 @@ public function versionSubmissionFile( $newPublication->getData('submissionId') ); - $newFileId = Services::get('file')->add( + $newFileId = app()->get('file')->add( Config::getVar('files', 'files_dir') . '/' . $oldFile->path, $submissionDir . '/' . uniqid() . '.' . $extension ); diff --git a/classes/submissionFile/SubmissionFile.php b/classes/submissionFile/SubmissionFile.php index e31f2a60a48..6c21d1e4db5 100644 --- a/classes/submissionFile/SubmissionFile.php +++ b/classes/submissionFile/SubmissionFile.php @@ -16,7 +16,6 @@ namespace PKP\submissionFile; -use APP\core\Services; use APP\facades\Repo; use PKP\facades\Locale; use PKP\i18n\LocaleMetadata; @@ -400,7 +399,7 @@ public function getLanguageNames(): array */ public function getLanguages(): array { - $props = Services::get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_SUBMISSION_FILE); + $props = app()->get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_SUBMISSION_FILE); $locales = array_map(fn (string $prop): array => array_keys($this->getData($prop) ?? []), $props); return collect([$this->getData('locale')]) ->concat($locales) diff --git a/classes/submissionFile/maps/Schema.php b/classes/submissionFile/maps/Schema.php index b0311ed227c..ea0e68d69d5 100644 --- a/classes/submissionFile/maps/Schema.php +++ b/classes/submissionFile/maps/Schema.php @@ -15,7 +15,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use Illuminate\Support\Enumerable; use PKP\context\Context; @@ -127,7 +126,7 @@ protected function mapByProperties(array $props, SubmissionFile $submissionFile) } if ($prop === 'documentType') { - $output[$prop] = Services::get('file')->getDocumentType($submissionFile->getData('mimetype')); + $output[$prop] = app()->get('file')->getDocumentType($submissionFile->getData('mimetype')); continue; } @@ -171,7 +170,7 @@ protected function mapByProperties(array $props, SubmissionFile $submissionFile) } $files[] = [ - 'documentType' => Services::get('file')->getDocumentType($revision->mimetype), + 'documentType' => app()->get('file')->getDocumentType($revision->mimetype), 'fileId' => $revision->fileId, 'mimetype' => $revision->mimetype, 'path' => $revision->path, diff --git a/classes/sushi/CounterR5Report.php b/classes/sushi/CounterR5Report.php index 071cc3a2033..c7c02aa4a48 100644 --- a/classes/sushi/CounterR5Report.php +++ b/classes/sushi/CounterR5Report.php @@ -17,7 +17,6 @@ namespace PKP\sushi; -use APP\core\Services; use APP\facades\Repo; use DateTime; use PKP\context\Context; @@ -302,7 +301,7 @@ protected function checkDate($params): void // get the first month the usage data is available for COUNTER R5, it is either: // the next month of the COUNTER R5 start, or // this journal's first publication date. - $statsService = Services::get('sushiStats'); + $statsService = app()->get('sushiStats'); $counterR5StartDate = $statsService->getEarliestDate(); $firstDatePublished = Repo::publication()->getDateBoundaries( Repo::publication() diff --git a/classes/task/DepositDois.php b/classes/task/DepositDois.php index 5d8a142ca32..e894550b76e 100644 --- a/classes/task/DepositDois.php +++ b/classes/task/DepositDois.php @@ -16,7 +16,6 @@ namespace PKP\task; -use APP\core\Services; use APP\services\ContextService; use PKP\jobs\doi\DepositContext; use PKP\scheduledTask\ScheduledTask; @@ -37,7 +36,7 @@ public function getName(): string protected function executeActions(): bool { /** @var ContextService $contextService */ - $contextService = Services::get('context'); + $contextService = app()->get('context'); $contextIds = $contextService->getIds(['isEnabled' => true]); foreach ($contextIds as $contextId) { diff --git a/classes/task/EditorialReminders.php b/classes/task/EditorialReminders.php index 06dad33b842..30bb644abb8 100644 --- a/classes/task/EditorialReminders.php +++ b/classes/task/EditorialReminders.php @@ -16,7 +16,6 @@ namespace PKP\task; -use APP\core\Services; use APP\facades\Repo; use APP\services\ContextService; use PKP\jobs\email\EditorialReminder; @@ -35,7 +34,7 @@ public function getName(): string protected function executeActions(): bool { /** @var ContextService $contextService */ - $contextService = Services::get('context'); + $contextService = app()->get('context'); $contextIds = $contextService->getIds(['isEnabled' => true]); foreach ($contextIds as $contextId) { diff --git a/classes/task/PKPUsageStatsLoader.php b/classes/task/PKPUsageStatsLoader.php index a17bc033266..20e47273181 100644 --- a/classes/task/PKPUsageStatsLoader.php +++ b/classes/task/PKPUsageStatsLoader.php @@ -17,7 +17,6 @@ namespace PKP\task; use APP\core\Application; -use APP\core\Services; use APP\statistics\StatisticsHelper; use Illuminate\Support\Facades\Bus; use PKP\file\FileManager; @@ -142,7 +141,7 @@ protected function isDateValid(string $loadId): bool $date = substr($loadId, -12, 8); // Get the date when the version that uses the new log file format (and COUNTER R5) is installed. // Only the log files later than that day can be (regularly) processed here. - $statsService = Services::get('sushiStats'); + $statsService = app()->get('sushiStats'); $dateR5Installed = date('Ymd', strtotime($statsService->getEarliestDate())); if ($date < $dateR5Installed) { // the log file is in old log file format @@ -174,9 +173,9 @@ protected function isMonthValid(string $loadId, string $month): bool // If the daily metrics are not kept, and this is not the current month (which is kept in the DB) // the CLI script to reprocess the whole month should be called. if (!$site->getData('keepDailyUsageStats') && $month != $currentMonth && $month != $lastMonth) { - $statsService = Services::get('sushiStats'); + $statsService = app()->get('sushiStats'); $counterMonthExists = $statsService->monthExists($month); - $geoService = Services::get('geoStats'); + $geoService = app()->get('geoStats'); $geoMonthExists = $geoService->monthExists($month); if ($counterMonthExists || $geoMonthExists) { $this->addExecutionLogEntry(__( diff --git a/classes/task/PublishSubmissions.php b/classes/task/PublishSubmissions.php index ea22dcefd65..f392794463b 100644 --- a/classes/task/PublishSubmissions.php +++ b/classes/task/PublishSubmissions.php @@ -16,7 +16,6 @@ namespace PKP\task; -use APP\core\Services; use APP\facades\Repo; use APP\submission\Submission; use PKP\core\Core; @@ -37,7 +36,7 @@ public function getName(): string */ public function executeActions(): bool { - $contextIds = Services::get('context')->getIds([ + $contextIds = app()->get('context')->getIds([ 'isEnabled' => true, ]); foreach ($contextIds as $contextId) { diff --git a/classes/template/PKPTemplateManager.php b/classes/template/PKPTemplateManager.php index abe0fc5465b..9dbfc3b64e5 100644 --- a/classes/template/PKPTemplateManager.php +++ b/classes/template/PKPTemplateManager.php @@ -25,7 +25,6 @@ use APP\core\Application; use APP\core\PageRouter; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\file\PublicFileManager; use APP\submission\Submission; @@ -295,7 +294,7 @@ public function initialize(PKPRequest $request) } // Register Navigation Menus - $nmService = Services::get('navigationMenu'); + $nmService = app()->get('navigationMenu'); if (Application::isInstalled()) { Hook::add('LoadHandler', $nmService->_callbackHandleCustomNavigationMenuItems(...)); @@ -953,7 +952,7 @@ public function setupBackendPage() } else { $args = ['userId' => $request->getUser()->getId()]; } - $availableContexts = Services::get('context')->getManySummary($args); + $availableContexts = app()->get('context')->getManySummary($args); if ($request->getContext()) { $availableContexts = array_filter($availableContexts, function ($context) use ($request) { return $context->id !== $request->getContext()->getId(); @@ -2204,7 +2203,7 @@ public function smartyLoadNavigationMenuArea($params, $smarty) $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); if (isset($navigationMenus[0])) { $navigationMenu = $navigationMenus[0]; - Services::get('navigationMenu')->getMenuTree($navigationMenu); + app()->get('navigationMenu')->getMenuTree($navigationMenu); } diff --git a/classes/userGroup/Repository.php b/classes/userGroup/Repository.php index 6c508e92713..dcaf172669d 100644 --- a/classes/userGroup/Repository.php +++ b/classes/userGroup/Repository.php @@ -15,7 +15,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use Carbon\Carbon; use DateInterval; @@ -119,7 +118,7 @@ public function getSchemaMap(): maps\Schema */ public function validate($userGroup, $props, $allowedLocales, $primaryLocale) { - $schemaService = Services::get('schema'); + $schemaService = app()->get('schema'); $validator = ValidatorFactory::make( $props, diff --git a/controllers/api/file/FileApiHandler.php b/controllers/api/file/FileApiHandler.php index d1e7bc4263d..ad334ebaece 100644 --- a/controllers/api/file/FileApiHandler.php +++ b/controllers/api/file/FileApiHandler.php @@ -21,7 +21,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\handler\Handler; use Exception; @@ -109,7 +108,7 @@ public function downloadFile($args, $request) if (!$file) { throw new Exception('File ' . $fileId . ' is not a revision of submission file ' . $submissionFile->getId()); } - if (!Services::get('file')->fs->has($file->path)) { + if (!app()->get('file')->fs->has($file->path)) { $request->getDispatcher()->handle404(); } @@ -132,8 +131,8 @@ public function downloadFile($args, $request) ); } - $filename = Services::get('file')->formatFilename($file->path, $filename); - Services::get('file')->download((int) $fileId, $filename); + $filename = app()->get('file')->formatFilename($file->path, $filename); + app()->get('file')->download((int) $fileId, $filename); } /** @@ -162,7 +161,7 @@ public function downloadAllFiles($args, $request) $files = []; foreach ($submissionFiles as $submissionFile) { $path = $submissionFile->getData('path'); - $files[$path] = Services::get('file')->formatFilename($path, $submissionFile->getLocalizedData('name')); + $files[$path] = app()->get('file')->formatFilename($path, $submissionFile->getLocalizedData('name')); } $filename = !empty($args['nameLocaleKey']) diff --git a/controllers/api/file/PKPManageFileApiHandler.php b/controllers/api/file/PKPManageFileApiHandler.php index 1a1072fd291..150b24fab23 100644 --- a/controllers/api/file/PKPManageFileApiHandler.php +++ b/controllers/api/file/PKPManageFileApiHandler.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\handler\Handler; use APP\notification\NotificationManager; @@ -151,7 +150,7 @@ public function cancelFileUpload(array $args, Request $request): JSONMessage ); // Remove uploaded file - Services::get('file')->delete($revisedFileId); + app()->get('file')->delete($revisedFileId); $this->setupTemplate($request); return \PKP\db\DAO::getDataChangedEvent(); diff --git a/controllers/grid/admin/context/ContextGridHandler.php b/controllers/grid/admin/context/ContextGridHandler.php index e119ec3bd4b..ea887473ca7 100644 --- a/controllers/grid/admin/context/ContextGridHandler.php +++ b/controllers/grid/admin/context/ContextGridHandler.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\template\TemplateManager; use PKP\components\forms\context\PKPContextForm; use PKP\controllers\grid\feature\OrderGridItemsFeature; @@ -216,7 +215,7 @@ public function createContext($args, $request) */ public function editContext($args, $request) { - $contextService = Services::get('context'); + $contextService = app()->get('context'); $context = null; if ($request->getUserVar('rowId')) { @@ -281,7 +280,7 @@ public function deleteContext($args, $request) return new JSONMessage(false); } - $contextService = Services::get('context'); + $contextService = app()->get('context'); $context = $contextService->get((int) $request->getUserVar('rowId')); diff --git a/controllers/grid/admin/languages/AdminLanguageGridHandler.php b/controllers/grid/admin/languages/AdminLanguageGridHandler.php index 5185d36dddb..02a5390f53f 100644 --- a/controllers/grid/admin/languages/AdminLanguageGridHandler.php +++ b/controllers/grid/admin/languages/AdminLanguageGridHandler.php @@ -20,7 +20,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\notification\NotificationManager; use PKP\controllers\grid\GridColumn; @@ -423,7 +422,7 @@ protected function _updateContextLocaleSettings($request) { $site = $request->getSite(); $siteSupportedLocales = $site->getSupportedLocales(); - $contextService = Services::get('context'); + $contextService = app()->get('context'); $contextDao = Application::getContextDAO(); $contexts = $contextDao->getAll(); diff --git a/controllers/grid/languages/LanguageGridHandler.php b/controllers/grid/languages/LanguageGridHandler.php index cc1faecb023..195ffa3659b 100644 --- a/controllers/grid/languages/LanguageGridHandler.php +++ b/controllers/grid/languages/LanguageGridHandler.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\notification\NotificationManager; use PKP\controllers\grid\GridColumn; use PKP\controllers\grid\GridHandler; @@ -89,7 +88,7 @@ public function saveLanguageSetting($args, $request) $availableLocales = $this->getGridDataElements($request); $context = $request->getContext(); - $contextService = Services::get('context'); + $contextService = app()->get('context'); $permittedSettings = ['supportedLocales', 'supportedFormLocales', 'supportedSubmissionLocales', 'supportedSubmissionMetadataLocales']; if (in_array($settingName, $permittedSettings) && $locale) { @@ -180,7 +179,7 @@ public function setContextPrimaryLocale($args, $request) if (Locale::isLocaleValid($locale) && array_key_exists($locale, $availableLocales)) { // Make sure at least the primary locale is chosen as available - $context = Services::get('context')->edit( + $context = app()->get('context')->edit( $context, collect(['supportedLocales', 'supportedFormLocales']) ->mapWithKeys(fn ($name) => [$name => collect($context->getData($name))->push($locale)->unique()->sort()->values()]) @@ -218,7 +217,7 @@ public function setDefaultSubmissionLocale(array $args, Request $request): JSONM if (Locale::isSubmissionLocaleValid($locale) && array_key_exists($locale, $availableLocales)) { // Make sure at least the primary locale is chosen as available - Services::get('context')->edit( + app()->get('context')->edit( $context, [ 'supportedDefaultSubmissionLocale' => $locale, diff --git a/controllers/grid/languages/form/AddLanguageForm.php b/controllers/grid/languages/form/AddLanguageForm.php index 074bc4ab151..b49d7206789 100644 --- a/controllers/grid/languages/form/AddLanguageForm.php +++ b/controllers/grid/languages/form/AddLanguageForm.php @@ -17,7 +17,6 @@ namespace PKP\controllers\grid\languages\form; use APP\core\Application; -use APP\core\Services; use APP\template\TemplateManager; use PKP\facades\Locale; use PKP\form\Form; @@ -101,7 +100,7 @@ public function execute(...$functionArgs) ->values() ->toArray(); - Services::get('context')->edit( + app()->get('context')->edit( $context, [ 'supportedAddedSubmissionLocales' => $locales, diff --git a/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.php b/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.php index 58db4f448b1..e315203ef1e 100644 --- a/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.php +++ b/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.php @@ -17,7 +17,6 @@ namespace PKP\controllers\grid\navigationMenus; use APP\core\Application; -use APP\core\Services; use APP\template\TemplateManager; use PKP\controllers\grid\GridCellProvider; use PKP\controllers\grid\GridColumn; @@ -51,7 +50,7 @@ public function getTemplateVarsFromRowColumn($row, $column) switch ($columnId) { case 'title': $templateMgr = TemplateManager::getManager(Application::get()->getRequest()); - Services::get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $navigationMenuItem); + app()->get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $navigationMenuItem); return ['label' => $navigationMenuItem->getLocalizedTitle()]; default: diff --git a/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.php b/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.php index ceabbc84a25..39c69749d13 100644 --- a/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.php +++ b/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.php @@ -17,7 +17,6 @@ namespace PKP\controllers\grid\navigationMenus; use APP\core\Application; -use APP\core\Services; use APP\template\TemplateManager; use PKP\controllers\grid\GridCellProvider; use PKP\controllers\grid\GridColumn; @@ -80,7 +79,7 @@ public function getTemplateVarsFromRowColumn($row, $column) $templateMgr = TemplateManager::getManager(Application::get()->getRequest()); foreach ($items as $item) { - Services::get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $item); + app()->get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $item); $navigationMenusTitles = $navigationMenusTitles . $item->getLocalizedTitle() . ', '; } diff --git a/controllers/grid/navigationMenus/form/NavigationMenuForm.php b/controllers/grid/navigationMenus/form/NavigationMenuForm.php index ea417da89ee..20606216477 100644 --- a/controllers/grid/navigationMenus/form/NavigationMenuForm.php +++ b/controllers/grid/navigationMenus/form/NavigationMenuForm.php @@ -18,7 +18,6 @@ namespace PKP\controllers\grid\navigationMenus\form; -use APP\core\Services; use APP\template\TemplateManager; use PKP\db\DAORegistry; use PKP\form\Form; @@ -106,10 +105,10 @@ public function fetch($request, $template = null, $display = false) }); foreach ($unassignedItems as $unassignedItem) { - Services::get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $unassignedItem); + app()->get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $unassignedItem); } - $navigationMenuItemTypes = Services::get('navigationMenu')->getMenuItemTypes(); + $navigationMenuItemTypes = app()->get('navigationMenu')->getMenuItemTypes(); $typeConditionalWarnings = []; foreach ($navigationMenuItemTypes as $type => $settings) { @@ -142,7 +141,7 @@ public function initData() $navigationMenu = $navigationMenusDao->getById($this->_navigationMenuId); if ($navigationMenu != null) { - Services::get('navigationMenu')->getMenuTree($navigationMenu); + app()->get('navigationMenu')->getMenuTree($navigationMenu); $this->_data = [ 'title' => $navigationMenu->getTitle(), diff --git a/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.php b/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.php index 56d21b536f7..3fa0dac1652 100755 --- a/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.php +++ b/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.php @@ -16,7 +16,6 @@ namespace PKP\controllers\grid\navigationMenus\form; -use APP\core\Services; use APP\template\TemplateManager; use PKP\db\DAORegistry; use PKP\facades\Locale; @@ -89,7 +88,7 @@ public function fetch($request, $template = null, $display = false) 'supportEmail' => __('plugins.generic.tinymce.variables.supportContactEmail', ['value' => $context->getData('supportEmail')]), ]); } - $types = Services::get('navigationMenu')->getMenuItemTypes(); + $types = app()->get('navigationMenu')->getMenuItemTypes(); $typeTitles = [0 => __('grid.navigationMenus.navigationMenu.selectType')]; foreach ($types as $type => $settings) { @@ -108,7 +107,7 @@ public function fetch($request, $template = null, $display = false) } } - $customTemplates = Services::get('navigationMenu')->getMenuItemCustomEditTemplates(); + $customTemplates = app()->get('navigationMenu')->getMenuItemCustomEditTemplates(); $templateArray = [ 'navigationMenuItemTypeTitles' => $typeTitles, @@ -131,7 +130,7 @@ public function initData() $navigationMenuItem = $navigationMenuItemDao->getById($this->navigationMenuItemId); if ($navigationMenuItem) { - Services::get('navigationMenu') + app()->get('navigationMenu') ->setAllNMILocalizedTitles($navigationMenuItem); $formData = [ @@ -181,7 +180,7 @@ public function execute(...$functionParams) } else { $localizedTitlesFromDB = $navigationMenuItem->getTitle(null); - Services::get('navigationMenu') + app()->get('navigationMenu') ->setAllNMILocalizedTitles($navigationMenuItem); $localizedTitles = $navigationMenuItem->getTitle(null); diff --git a/controllers/grid/settings/languages/ManageLanguageGridHandler.php b/controllers/grid/settings/languages/ManageLanguageGridHandler.php index 3a3d0fc3968..f9204a4f4b2 100644 --- a/controllers/grid/settings/languages/ManageLanguageGridHandler.php +++ b/controllers/grid/settings/languages/ManageLanguageGridHandler.php @@ -17,7 +17,6 @@ namespace PKP\controllers\grid\settings\languages; use APP\core\Request; -use APP\core\Services; use APP\notification\NotificationManager; use PKP\controllers\grid\languages\LanguageGridHandler; use PKP\core\JSONMessage; @@ -117,7 +116,7 @@ public function reloadLocale($args, $request) return new JSONMessage(false); } - $context = Services::get('context')->restoreLocaleDefaults($context, $request, $locale); + $context = app()->get('context')->restoreLocaleDefaults($context, $request, $locale); $notificationManager = new NotificationManager(); $notificationManager->createTrivialNotification( diff --git a/controllers/grid/users/author/form/PKPAuthorForm.php b/controllers/grid/users/author/form/PKPAuthorForm.php index c59d79e4e92..33e09aee4cc 100644 --- a/controllers/grid/users/author/form/PKPAuthorForm.php +++ b/controllers/grid/users/author/form/PKPAuthorForm.php @@ -19,7 +19,6 @@ namespace PKP\controllers\grid\users\author\form; use APP\author\Author; -use APP\core\Services; use APP\facades\Repo; use APP\publication\Publication; use APP\template\TemplateManager; @@ -206,7 +205,7 @@ public function execute(...$functionParams) { $publication = $this->getPublication(); /** @var Publication $publication */ $submission = Repo::submission()->get($publication->getData('submissionId')); - $context = Services::get('context')->get($submission->getData('contextId')); + $context = app()->get('context')->get($submission->getData('contextId')); $author = $this->getAuthor(); if (!$author) { diff --git a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php index e58c500f75c..3bb20cf6422 100644 --- a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php +++ b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php @@ -17,7 +17,6 @@ namespace PKP\controllers\grid\users\reviewer\form; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\submission\Submission; use APP\template\TemplateManager; @@ -95,7 +94,7 @@ public function initData() public function fetch($request, $template = null, $display = false) { // Get submission context - $submissionContext = Services::get('context')->get($this->getSubmission()->getData('contextId')); + $submissionContext = app()->get('context')->get($this->getSubmission()->getData('contextId')); // Pass along the request vars $actionArgs = $request->getUserVars(); diff --git a/controllers/modals/publish/PublishHandler.php b/controllers/modals/publish/PublishHandler.php index 530d80563bd..1cf2c2e8a23 100644 --- a/controllers/modals/publish/PublishHandler.php +++ b/controllers/modals/publish/PublishHandler.php @@ -18,7 +18,6 @@ use APP\components\forms\publication\PublishForm; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\handler\Handler; use APP\publication\Publication; @@ -94,7 +93,7 @@ public function publish($args, $request) $submissionContext = $request->getContext(); if (!$submissionContext || $submissionContext->getId() !== $this->submission->getData('contextId')) { - $submissionContext = Services::get('context')->get($this->submission->getData('contextId')); + $submissionContext = app()->get('context')->get($this->submission->getData('contextId')); } $primaryLocale = $submissionContext->getPrimaryLocale(); diff --git a/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.php b/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.php index 9b041e89d06..8f8c2299480 100644 --- a/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.php +++ b/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\submission\Submission; use PKP\db\DAORegistry; @@ -193,7 +192,7 @@ public function execute(...$functionParams) $extension = $fileManager->parseFileExtension($_FILES['uploadedFile']['name']); $submissionDir = Repo::submissionFile()->getSubmissionDir($request->getContext()->getId(), $this->getData('submissionId')); - $fileId = Services::get('file')->add( + $fileId = app()->get('file')->add( $_FILES['uploadedFile']['tmp_name'], $submissionDir . '/' . uniqid() . '.' . $extension ); diff --git a/jobs/email/EditorialReminder.php b/jobs/email/EditorialReminder.php index 26524af1c5a..9f86d66068c 100644 --- a/jobs/email/EditorialReminder.php +++ b/jobs/email/EditorialReminder.php @@ -17,7 +17,6 @@ namespace PKP\jobs\email; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\notification\NotificationManager; use APP\submission\Submission; @@ -57,7 +56,7 @@ public function handle(): void } /** @var Context $context */ - $context = Services::get('context')->get($this->contextId); + $context = app()->get('context')->get($this->contextId); $editor = Repo::user()->get($this->editorId); // Don't use the request locale because this job is diff --git a/jobs/notifications/StatisticsReportMail.php b/jobs/notifications/StatisticsReportMail.php index 46dda0339d7..0ddeb48e935 100644 --- a/jobs/notifications/StatisticsReportMail.php +++ b/jobs/notifications/StatisticsReportMail.php @@ -17,7 +17,6 @@ namespace PKP\jobs\notifications; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\notification\NotificationManager; use DateTimeImmutable; @@ -57,13 +56,13 @@ public function handle() $locale = $context->getPrimaryLocale(); $template = Repo::emailTemplate()->getByKey($this->contextId, StatisticsReportNotify::getEmailTemplateKey()); - $editorialTrends = Services::get('editorialStats')->getOverview([ + $editorialTrends = app()->get('editorialStats')->getOverview([ 'contextIds' => [$context->getId()], 'dateStart' => $this->dateStart->format('Y-m-d'), 'dateEnd' => $this->dateEnd->format('Y-m-d'), ]); - $editorialTrendsTotal = Services::get('editorialStats')->getOverview(['contextIds' => [$context->getId()]]); - $totalSubmissions = Services::get('editorialStats')->countSubmissionsReceived(['contextIds' => [$context->getId()]]); + $editorialTrendsTotal = app()->get('editorialStats')->getOverview(['contextIds' => [$context->getId()]]); + $totalSubmissions = app()->get('editorialStats')->countSubmissionsReceived(['contextIds' => [$context->getId()]]); $formatter = IntlDateFormatter::create( $locale, IntlDateFormatter::FULL, @@ -128,7 +127,7 @@ protected function createCsvAttachment(array $editorialTrends, array $editorialT foreach (Application::getApplicationStages() as $stageId) { $file->fputcsv([ __(Application::getWorkflowStageName($stageId), [], $locale), - Services::get('editorialStats')->countActiveByStages($stageId) + app()->get('editorialStats')->countActiveByStages($stageId) ]); } diff --git a/jobs/statistics/CompileMonthlyMetrics.php b/jobs/statistics/CompileMonthlyMetrics.php index 7fd13cc5057..f700787961b 100644 --- a/jobs/statistics/CompileMonthlyMetrics.php +++ b/jobs/statistics/CompileMonthlyMetrics.php @@ -16,7 +16,6 @@ namespace PKP\jobs\statistics; -use APP\core\Services; use PKP\jobs\BaseJob; use PKP\site\Site; @@ -49,14 +48,14 @@ public function handle(): void $currentMonth = date('Ym'); $lastMonth = date('Ym', strtotime('last month')); - $geoService = Services::get('geoStats'); + $geoService = app()->get('geoStats'); $geoService->deleteMonthlyMetrics($this->month); $geoService->addMonthlyMetrics($this->month); if (!$this->site->getData('keepDailyUsageStats') && $this->month != $currentMonth && $this->month != $lastMonth) { $geoService->deleteDailyMetrics($this->month); } - $counterService = Services::get('sushiStats'); + $counterService = app()->get('sushiStats'); $counterService->deleteMonthlyMetrics($this->month); $counterService->addMonthlyMetrics($this->month); if (!$this->site->getData('keepDailyUsageStats') && $this->month != $currentMonth && $this->month != $lastMonth) { diff --git a/pages/admin/AdminHandler.php b/pages/admin/AdminHandler.php index f7b0a136f6a..32113d5fefa 100644 --- a/pages/admin/AdminHandler.php +++ b/pages/admin/AdminHandler.php @@ -18,7 +18,6 @@ use APP\components\forms\context\ContextForm; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use APP\file\PublicFileManager; use APP\handler\Handler; @@ -204,7 +203,7 @@ public function settings($args, $request) $locales = $site->getSupportedLocaleNames(); $locales = array_map(fn (string $locale, string $name) => ['key' => $locale, 'label' => $name], array_keys($locales), $locales); - $contexts = Services::get('context')->getManySummary(); + $contexts = app()->get('context')->getManySummary(); $siteAppearanceForm = new PKPSiteAppearanceForm($apiUrl, $locales, $site, $baseUrl, $temporaryFileApiUrl); $siteConfigForm = new PKPSiteConfigForm($apiUrl, $locales, $site); @@ -261,7 +260,7 @@ public function settings($args, $request) private function siteSettingsAvailability(): array { // The multi context UI is also displayed when the journal has no contexts - $isMultiContextSite = Services::get('context')->getCount() !== 1; + $isMultiContextSite = app()->get('context')->getCount() !== 1; return [ 'siteSetup' => true, 'languages' => true, @@ -296,7 +295,7 @@ public function wizard($args, $request) $request->getDispatcher()->handle404(); } - $contextService = Services::get('context'); + $contextService = app()->get('context'); $context = $contextService->get((int) $args[0]); if (empty($context)) { diff --git a/pages/authorDashboard/PKPAuthorDashboardHandler.php b/pages/authorDashboard/PKPAuthorDashboardHandler.php index 579339496d9..ab48e2fe483 100644 --- a/pages/authorDashboard/PKPAuthorDashboardHandler.php +++ b/pages/authorDashboard/PKPAuthorDashboardHandler.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\decision\Decision; use APP\facades\Repo; use APP\handler\Handler; @@ -167,7 +166,7 @@ public function setupTemplate($request) $user = $request->getUser(); $submissionContext = $request->getContext(); if ($submission->getData('contextId') !== $submissionContext->getId()) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $contextUserGroups = Repo::userGroup()->getByRoleIds([Role::ROLE_ID_AUTHOR], $submission->getData('contextId')); diff --git a/pages/navigationMenu/NavigationMenuItemHandler.php b/pages/navigationMenu/NavigationMenuItemHandler.php index d883358fce1..cfc3d74e65d 100644 --- a/pages/navigationMenu/NavigationMenuItemHandler.php +++ b/pages/navigationMenu/NavigationMenuItemHandler.php @@ -17,7 +17,6 @@ namespace PKP\pages\navigationMenu; use APP\core\Application; -use APP\core\Services; use APP\handler\Handler; use APP\template\TemplateManager; use PKP\core\PKPRequest; @@ -76,7 +75,7 @@ public function preview($args, $request) $navigationMenuItem->setContent((array) $request->getUserVar('content'), null); $navigationMenuItem->setTitle((array) $request->getUserVar('title'), null); - Services::get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $navigationMenuItem); + app()->get('navigationMenu')->transformNavMenuItemTitle($templateMgr, $navigationMenuItem); $templateMgr->assign('title', $navigationMenuItem->getLocalizedTitle()); diff --git a/pages/stats/PKPStatsHandler.php b/pages/stats/PKPStatsHandler.php index b44875d7962..897d27d5f66 100644 --- a/pages/stats/PKPStatsHandler.php +++ b/pages/stats/PKPStatsHandler.php @@ -18,7 +18,6 @@ use APP\core\Application; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\handler\Handler; use APP\template\TemplateManager; @@ -88,9 +87,9 @@ public function editorial($args, $request) 'contextIds' => [$context->getId()], ]; - $totals = Services::get('editorialStats')->getOverview($args); - $averages = Services::get('editorialStats')->getAverages($args); - $dateRangeTotals = Services::get('editorialStats')->getOverview( + $totals = app()->get('editorialStats')->getOverview($args); + $averages = app()->get('editorialStats')->getAverages($args); + $dateRangeTotals = app()->get('editorialStats')->getOverview( array_merge( $args, [ @@ -156,7 +155,7 @@ public function editorial($args, $request) foreach (Application::getApplicationStages() as $stageId) { $activeByStage[] = [ 'name' => __(Application::getWorkflowStageName($stageId)), - 'count' => Services::get('editorialStats')->countActiveByStages($stageId, $args), + 'count' => app()->get('editorialStats')->countActiveByStages($stageId, $args), 'color' => Application::getWorkflowStageColor($stageId), ]; } @@ -243,7 +242,7 @@ public function publications($args, $request) $dateEnd = date('Y-m-d', strtotime('yesterday')); $count = 30; - $timeline = Services::get('publicationStats')->getTimeline(PKPStatisticsHelper::STATISTICS_DIMENSION_DAY, [ + $timeline = app()->get('publicationStats')->getTimeline(PKPStatisticsHelper::STATISTICS_DIMENSION_DAY, [ 'assocTypes' => [Application::ASSOC_TYPE_SUBMISSION], 'contextIds' => [$context->getId()], 'count' => $count, @@ -372,7 +371,7 @@ public function context($args, $request) $dateStart = date('Y-m-d', strtotime('-31 days')); $dateEnd = date('Y-m-d', strtotime('yesterday')); - $timeline = Services::get('contextStats')->getTimeline(PKPStatisticsHelper::STATISTICS_DIMENSION_DAY, [ + $timeline = app()->get('contextStats')->getTimeline(PKPStatisticsHelper::STATISTICS_DIMENSION_DAY, [ 'dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'contextIds' => [$context->getId()] diff --git a/pages/workflow/PKPWorkflowHandler.php b/pages/workflow/PKPWorkflowHandler.php index c16bb5cbeb1..7831785a78f 100644 --- a/pages/workflow/PKPWorkflowHandler.php +++ b/pages/workflow/PKPWorkflowHandler.php @@ -20,7 +20,6 @@ use APP\core\Application; use APP\core\PageRouter; use APP\core\Request; -use APP\core\Services; use APP\facades\Repo; use APP\handler\Handler; use APP\publication\Publication; @@ -150,7 +149,7 @@ public function index($args, $request) $submissionContext = $request->getContext(); if ($submission->getData('contextId') !== $submissionContext->getId()) { - $submissionContext = Services::get('context')->get($submission->getData('contextId')); + $submissionContext = app()->get('context')->get($submission->getData('contextId')); } $workflowStages = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); diff --git a/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.php b/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.php index 7b6c2ec44b0..c1e1e74fc6d 100644 --- a/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.php +++ b/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.php @@ -17,7 +17,6 @@ namespace PKP\plugins\importexport\native\filter; use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; use PKP\core\Core; use PKP\core\PKPApplication; @@ -327,7 +326,7 @@ public function handleRevisionElement($node) clearstatcache(true, $temporaryFilename); $fileManager = new FileManager(); $submissionDir = Repo::submissionFile()->getSubmissionDir($submission->getData('contextId'), $submission->getId()); - $newFileId = Services::get('file')->add( + $newFileId = app()->get('file')->add( $temporaryFilename, $submissionDir . '/' . uniqid() . '.' . $node->getAttribute('extension') ); diff --git a/tools/buildSwagger.php b/tools/buildSwagger.php index 091a8c6e154..aa7b865107e 100644 --- a/tools/buildSwagger.php +++ b/tools/buildSwagger.php @@ -15,7 +15,6 @@ * documentation. */ -use APP\core\Services; use PKP\decision\DecisionType; use PKP\file\FileManager; @@ -80,7 +79,7 @@ public function execute() } $editDefinition = $summaryDefinition = $readDefinition = ['type' => 'object', 'properties' => []]; - $entitySchema = Services::get('schema')->get($definition, true); + $entitySchema = app()->get('schema')->get($definition, true); foreach ($entitySchema->properties as $propName => $propSchema) { $editPropSchema = clone $propSchema; $readPropSchema = clone $propSchema; diff --git a/tools/reprocessUsageStatsMonth.php b/tools/reprocessUsageStatsMonth.php index a01320039e1..41909ed7cf8 100644 --- a/tools/reprocessUsageStatsMonth.php +++ b/tools/reprocessUsageStatsMonth.php @@ -14,7 +14,6 @@ * @brief CLI tool to reprocess the usage stats log files for a month. */ -use APP\core\Services; use APP\tasks\UsageStatsLoader; require(dirname(__FILE__, 4) . '/tools/bootstrap.php'); @@ -58,8 +57,8 @@ public function usage(): void public function execute(): void { // Remove the month from the monthly DB tables - $counterService = Services::get('sushiStats'); - $geoService = Services::get('geoStats'); + $counterService = app()->get('sushiStats'); + $geoService = app()->get('geoStats'); $counterService->deleteMonthlyMetrics($this->month); $geoService->deleteMonthlyMetrics($this->month); // Check if all log files from that month are in usageEventLogs folder??? diff --git a/tools/setVersionTool.php b/tools/setVersionTool.php index bdcb2bd9865..121fa31f5c6 100644 --- a/tools/setVersionTool.php +++ b/tools/setVersionTool.php @@ -15,7 +15,6 @@ */ use APP\core\Application; -use APP\core\Services; use APP\facades\Repo; require(dirname(__FILE__, 4) . '/tools/bootstrap.php'); @@ -28,7 +27,7 @@ class SetVersionTool extends \PKP\cliTool\CommandLineTool public function execute() { $request = Application::get()->getRequest(); - $contextIds = Services::get('context')->getIds(); + $contextIds = app()->get('context')->getIds(); foreach ($contextIds as $contextId) { $submissions = Repo::submission() ->getCollector()