Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ function ($container) {
);

// Register strategies.
$service->registerStrategy('file', $container->get(FileVectorizationStrategy::class));
$service->registerStrategy('object', $container->get(ObjectVectorizationStrategy::class));
$service->registerStrategy(entityType: 'file', strategy: $container->get(FileVectorizationStrategy::class));
$service->registerStrategy(entityType: 'object', strategy: $container->get(ObjectVectorizationStrategy::class));

return $service;
}
Expand Down Expand Up @@ -605,8 +605,8 @@ public function boot(IBootContext $context): void
$jobList = $container->get(id: 'OCP\BackgroundJob\IJobList');

// Check if the nightly warmup job is already registered.
if ($jobList->has(SolrNightlyWarmupJob::class, null) === false) {
$jobList->add(SolrNightlyWarmupJob::class);
if ($jobList->has(class: SolrNightlyWarmupJob::class, argument: null) === false) {
$jobList->add(job: SolrNightlyWarmupJob::class);
$logger->info(
message: '🌙 SOLR Nightly Warmup Job registered successfully',
context: [
Expand All @@ -619,8 +619,8 @@ public function boot(IBootContext $context): void
}

// Register recurring cron file text extraction job.
if ($jobList->has(CronFileTextExtractionJob::class, null) === false) {
$jobList->add(CronFileTextExtractionJob::class);
if ($jobList->has(class: CronFileTextExtractionJob::class, argument: null) === false) {
$jobList->add(job: CronFileTextExtractionJob::class);
$logger->info(
message: '🔄 Cron File Text Extraction Job registered successfully',
context: [
Expand All @@ -634,8 +634,8 @@ public function boot(IBootContext $context): void

// Register recurring webhook retry job.
$webhookRetryJobClass = 'OCA\OpenRegister\Cron\WebhookRetryJob';
if ($jobList->has($webhookRetryJobClass, null) === false) {
$jobList->add($webhookRetryJobClass);
if ($jobList->has(class: $webhookRetryJobClass, argument: null) === false) {
$jobList->add(job: $webhookRetryJobClass);
$logger->info(
message: '🔄 Webhook Retry Job registered successfully',
context: [
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/FileTextExtractionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function run($argument): void

try {
// Extract text using TextExtractionService.
$this->textExtractionService->extractFile($fileId, false);
$this->textExtractionService->extractFile(fileId: $fileId, forceReextraction: false);

$processingTime = round((microtime(true) - $startTime) * 1000, 2);

Expand Down
8 changes: 4 additions & 4 deletions lib/BackgroundJob/SolrNightlyWarmupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ protected function run($argument): void
$schemaMapper = \OC::$server->get(SchemaMapper::class);

// Check if SOLR is enabled and available.
if ($this->isSolrEnabledAndAvailable($solrService, $settingsService, $logger) === false) {
if ($this->isSolrEnabledAndAvailable(solrService: $solrService, settingsService: $settingsService, logger: $logger) === false) {
$logger->info(message: 'SOLR Nightly Warmup Job skipped - SOLR not enabled or available');
return;
}

// Get warmup configuration from settings.
$config = $this->getWarmupConfiguration($settingsService, $logger);
$config = $this->getWarmupConfiguration(_settingsService: $settingsService, _logger: $logger);

// Get all schemas for comprehensive warmup.
$schemas = $schemaMapper->findAll();
Expand Down Expand Up @@ -153,15 +153,15 @@ protected function run($argument): void
'conflicts_resolved' => $result['operations']['conflicts_resolved'] ?? 0,
'performance_metrics' => [
'total_time_ms' => $result['execution_time_ms'] ?? 0,
'objects_per_second' => $this->calculateObjectsPerSecond($result, $executionTime),
'objects_per_second' => $this->calculateObjectsPerSecond(result: $result, executionTime: $executionTime),
'next_run' => date('Y-m-d H:i:s', time() + self::DEFAULT_INTERVAL),
],
'operations_summary' => $this->summarizeOperations($result['operations'] ?? []),
]
);

// Log performance statistics for monitoring.
$this->logPerformanceStats($result, $executionTime, $logger);
$this->logPerformanceStats(result: $result, executionTime: $executionTime, logger: $logger);
} else {
$logger->error(
'❌ SOLR Nightly Warmup Job Failed',
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/SolrWarmupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function run($argument): void
$schemaMapper = \OC::$server->get(SchemaMapper::class);

// Check if SOLR is available before proceeding.
if ($this->isSolrAvailable($solrService, $logger) === false) {
if ($this->isSolrAvailable(solrService: $solrService, logger: $logger) === false) {
$logger->warning(
message: 'SOLR Warmup Job skipped - SOLR not available',
context: [
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/ApplicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function update(int $id): JSONResponse
unset($data['owner']);
unset($data['created']);

$application = $this->applicationService->update($id, $data);
$application = $this->applicationService->update(id: $id, data: $data);

return new JSONResponse(data: $application, statusCode: Http::STATUS_OK);
} catch (Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/AuditTrailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function objects(string $register, string $schema, string $id): JSONRespo
);

// Get total count for pagination.
$total = $this->logService->count($register, $schema, $id);
$total = $this->logService->count(register: $register, schema: $schema, id: $id);

// Return paginated results.
return new JSONResponse(
Expand Down
8 changes: 4 additions & 4 deletions lib/Controller/DeletedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public function topDeleters(): JSONResponse
public function restore(string $id): JSONResponse
{
try {
$object = $this->objectEntityMapper->find($id, null, null, true);
$object = $this->objectEntityMapper->find(identifier: $id, register: null, schema: null, includeDeleted: true);

if ($object->getDeleted() === null) {
return new JSONResponse(
Expand All @@ -340,7 +340,7 @@ public function restore(string $id): JSONResponse

// Clear the deleted status.
$object->setDeleted(null);
$this->objectEntityMapper->update($object, true);
$this->objectEntityMapper->update(entity: $object, includeDeleted: true);

return new JSONResponse(
data: [
Expand Down Expand Up @@ -412,7 +412,7 @@ public function restoreMultiple(): JSONResponse
try {
if ($object->getDeleted() !== null) {
$object->setDeleted(null);
$this->objectEntityMapper->update($object, true);
$this->objectEntityMapper->update(entity: $object, includeDeleted: true);
$restored++;
} else {
// Object exists but is not deleted.
Expand Down Expand Up @@ -461,7 +461,7 @@ public function restoreMultiple(): JSONResponse
public function destroy(string $id): JSONResponse
{
try {
$object = $this->objectEntityMapper->find($id, null, null, true);
$object = $this->objectEntityMapper->find(identifier: $id, register: null, schema: null, includeDeleted: true);

if ($object->getDeleted() === null) {
return new JSONResponse(
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/EndpointsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public function test(int $id): JSONResponse

$testData = $this->request->getParams()['data'] ?? [];

$result = $this->endpointService->testEndpoint($endpoint, $testData);
$result = $this->endpointService->testEndpoint(endpoint: $endpoint, testData: $testData);

if ($result['success'] === true) {
return new JSONResponse(
Expand Down Expand Up @@ -448,7 +448,7 @@ public function logs(int $id): JSONResponse
$limit = (int) ($this->request->getParam('limit') ?? 50);
$offset = (int) ($this->request->getParam('offset') ?? 0);

$logs = $this->endpointLogMapper->findByEndpoint($id, $limit, $offset);
$logs = $this->endpointLogMapper->findByEndpoint(endpointId: $id, limit: $limit, offset: $offset);

return new JSONResponse(
data: [
Expand Down Expand Up @@ -552,7 +552,7 @@ public function allLogs(): JSONResponse
// If endpoint_id is provided and valid, use findByEndpoint method.
if ($endpointId !== null && $endpointId !== '' && $endpointId !== '0') {
$endpointIdInt = (int) $endpointId;
$logs = $this->endpointLogMapper->findByEndpoint($endpointIdInt, $limit, $offset);
$logs = $this->endpointLogMapper->findByEndpoint(endpointId: $endpointIdInt, limit: $limit, offset: $offset);
// Get total count for this endpoint.
$allLogsForEndpoint = $this->endpointLogMapper->findByEndpoint($endpointIdInt, null, null);
$total = count($allLogsForEndpoint);
Expand Down
57 changes: 49 additions & 8 deletions lib/Controller/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,23 +368,64 @@ public function createMultipart(
* @var array<int, int>|null $errorArray
* @var array<int, int>|null $sizeArray
*/
$typeArray = is_array($files['type'] ?? null) ? $files['type'] : null;
$tmpNameArray = is_array($files['tmp_name'] ?? null) ? $files['tmp_name'] : null;
if (is_array($files['type'] ?? null) === true) {
$typeArray = $files['type'];
} else {
$typeArray = null;
}

if (is_array($files['tmp_name'] ?? null) === true) {
$tmpNameArray = $files['tmp_name'];
} else {
$tmpNameArray = null;
}
/*
* @var array<int, int>|null $errorArray
*/
$errorArray = is_array($files['error'] ?? null) ? $files['error'] : null;
if (is_array($files['error'] ?? null) === true) {
$errorArray = $files['error'];
} else {
$errorArray = null;
}
/*
* @var array<int, int>|null $sizeArray
*/
$sizeArray = is_array($files['size'] ?? null) ? $files['size'] : null;
if (is_array($files['size'] ?? null) === true) {
$sizeArray = $files['size'];
} else {
$sizeArray = null;
}

if ($typeArray !== null && isset($typeArray[$i]) === true) {
$typeValue = $typeArray[$i];
} else {
$typeValue = '';
}

if ($tmpNameArray !== null && isset($tmpNameArray[$i]) === true) {
$tmpNameValue = $tmpNameArray[$i];
} else {
$tmpNameValue = '';
}

if (is_array($errorArray) === true && isset($errorArray[$i]) === true) {
$errorValue = $errorArray[$i];
} else {
$errorValue = UPLOAD_ERR_NO_FILE;
}

if (is_array($sizeArray) === true && isset($sizeArray[$i]) === true) {
$sizeValue = $sizeArray[$i];
} else {
$sizeValue = 0;
}

$uploadedFiles[] = [
'name' => $fileName[$i] ?? '',
'type' => ($typeArray !== null && isset($typeArray[$i])) ? $typeArray[$i] : '',
'tmp_name' => ($tmpNameArray !== null && isset($tmpNameArray[$i])) ? $tmpNameArray[$i] : '',
'error' => (is_array($errorArray) && isset($errorArray[$i])) ? $errorArray[$i] : UPLOAD_ERR_NO_FILE,
'size' => (is_array($sizeArray) && isset($sizeArray[$i])) ? $sizeArray[$i] : 0,
'type' => $typeValue,
'tmp_name' => $tmpNameValue,
'error' => $errorValue,
'size' => $sizeValue,
'share' => $data['share'] === 'true',
'tags' => $tags,
];
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/RegistersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function show($id): JSONResponse
$extend = [$extend];
}

$register = $this->registerService->find($id, []);
$register = $this->registerService->find(id: $id, extend: []);
$registerArr = $register->jsonSerialize();
// If '@self.stats' is requested, attach statistics to the register.
if (in_array('@self.stats', $extend, true) === true) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/SchemasController.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function show($id): JSONResponse
$extend = [$extend];
}

$schema = $this->schemaMapper->find($id, []);
$schema = $this->schemaMapper->find(id: $id, extend: []);
$schemaArr = $schema->jsonSerialize();

// Add extendedBy property showing UUIDs of schemas that extend this schema.
Expand Down
16 changes: 8 additions & 8 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public function massValidateObjects(): JSONResponse
if ($mode === 'parallel') {
$this->processJobsParallel(batchJobs: $batchJobs, objectMapper: $objectMapper, objectService: $objectService, results: $results, collectErrors: $collectErrors, parallelBatches: 4, logger: $logger);
} else {
$this->processJobsSerial($batchJobs, $objectMapper, $objectService, $results, $collectErrors, $logger);
$this->processJobsSerial(batchJobs: $batchJobs, objectMapper: $objectMapper, objectService: $objectService, results: $results, collectErrors: $collectErrors, logger: $logger);
}

// Calculate final metrics.
Expand Down Expand Up @@ -2844,7 +2844,7 @@ public function warmupSolrIndex(): JSONResponse

// Phase 1: Use GuzzleSolrService directly for SOLR operations.
$guzzleSolrService = $this->container->get(GuzzleSolrService::class);
$result = $guzzleSolrService->warmupIndex([], $maxObjects, $mode, $collectErrors, $batchSize, $schemaIds);
$result = $guzzleSolrService->warmupIndex(schemas: [], maxObjects: $maxObjects, mode: $mode, collectErrors: $collectErrors, batchSize: $batchSize, schemaIds: $schemaIds);
return new JSONResponse(data: $result);
} catch (\Exception $e) {
// **ERROR VISIBILITY**: Let exceptions bubble up with full details.
Expand Down Expand Up @@ -3443,7 +3443,7 @@ public function testEmbedding(): JSONResponse

// Delegate to VectorEmbeddingService for testing.
$vectorService = $this->container->get('OCA\OpenRegister\Service\VectorEmbeddingService');
$result = $vectorService->testEmbedding($provider, $config, $testText);
$result = $vectorService->testEmbedding(provider: $provider, config: $config, testText: $testText);

// Return appropriate status code.
$statusCode = 400;
Expand Down Expand Up @@ -3512,7 +3512,7 @@ public function testChat(): JSONResponse

// Delegate to ChatService for testing.
$chatService = $this->container->get('OCA\OpenRegister\Service\ChatService');
$result = $chatService->testChat($provider, $config, $testMessage);
$result = $chatService->testChat(provider: $provider, config: $config, testMessage: $testMessage);

// Return appropriate status code.
$statusCode = 400;
Expand Down Expand Up @@ -4071,7 +4071,7 @@ public function inspectSolrIndex(): JSONResponse
$guzzleSolrService = $this->container->get(GuzzleSolrService::class);

// Search documents in SOLR.
$result = $guzzleSolrService->inspectIndex($query, $start, $rows, $fields);
$result = $guzzleSolrService->inspectIndex(query: $query, start: $start, rows: $rows, fields: $fields);

if ($result['success'] === true) {
return new JSONResponse(
Expand Down Expand Up @@ -4636,7 +4636,7 @@ public function copySolrCollection(string $sourceCollection, string $targetColle
{
try {
$guzzleSolrService = $this->container->get(GuzzleSolrService::class);
$result = $guzzleSolrService->copyCollection($sourceCollection, $targetCollection, $copyData);
$result = $guzzleSolrService->copyCollection(sourceCollection: $sourceCollection, targetCollection: $targetCollection, copyData: $copyData);

return new JSONResponse(data: $result);
} catch (\Exception $e) {
Expand Down Expand Up @@ -4735,7 +4735,7 @@ public function semanticSearch(string $query, int $limit=10, array $filters=[],
$vectorService = $this->container->get(VectorEmbeddingService::class);

// Perform semantic search.
$results = $vectorService->semanticSearch($query, $limit, $filters, $provider);
$results = $vectorService->semanticSearch(query: $query, limit: $limit, filters: $filters, provider: $provider);

return new JSONResponse(
data: [
Expand Down Expand Up @@ -4798,7 +4798,7 @@ public function hybridSearch(
$vectorService = $this->container->get(VectorEmbeddingService::class);

// Perform hybrid search.
$result = $vectorService->hybridSearch($query, $solrFilters, $limit, $weights, $provider);
$result = $vectorService->hybridSearch(query: $query, solrFilters: $solrFilters, limit: $limit, weights: $weights, provider: $provider);

// Ensure result is an array for spread operator.
$resultArray = is_array($result) === true ? $result : [];
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/ViewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function show(string $id): JSONResponse
);
}

$view = $this->viewService->find($id, $userId);
$view = $this->viewService->find(id: $id, owner: $userId);

return new JSONResponse(
data: [
Expand Down Expand Up @@ -472,7 +472,7 @@ public function patch(string $id): JSONResponse
}

// Get existing view.
$view = $this->viewService->find($id, $userId);
$view = $this->viewService->find(id: $id, owner: $userId);

$data = $this->request->getParams();

Expand Down Expand Up @@ -590,7 +590,7 @@ public function destroy(string $id): JSONResponse
);
}

$this->viewService->delete($id, $user->getUID());
$this->viewService->delete(id: $id, owner: $user->getUID());

return new JSONResponse(
data: [
Expand Down
Loading