Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Dec 31, 2024
1 parent a714f5d commit 3278960
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 184 deletions.
4 changes: 2 additions & 2 deletions www/controllers/Layout/Container/vars/tasks/log.vars.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

// If the task has a json log in database (new format)
} else {
$loggingController = new \Controllers\Task\Log\Log($taskId);
$taskLogController = new \Controllers\Task\Log\Log($taskId);

// Get raw params from the task
$rawParams = json_decode($taskInfo['Raw_params'], true);
Expand All @@ -35,7 +35,7 @@
$envId = null;

// Get log content
$content = $loggingController->getContent();
$content = $taskLogController->getContent();

// If log content is empty
if (empty($content)) {
Expand Down
58 changes: 29 additions & 29 deletions www/controllers/Repo/Mirror/Deb.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Deb extends \Controllers\Repo\Mirror\Mirror
*/
private function downloadReleaseFile()
{
$this->loggingSubStepController->new('getting-release', 'GETTING INRELEASE / RELEASE FILE', 'From ' . $this->url . '/dists/' . $this->dist . '/');
$this->taskLogSubStepController->new('getting-release', 'GETTING INRELEASE / RELEASE FILE', 'From ' . $this->url . '/dists/' . $this->dist . '/');

/**
* Check that Release.xx file exists before downloading it to prevent error message displaying for nothing
Expand Down Expand Up @@ -42,7 +42,7 @@ private function downloadReleaseFile()
throw new Exception('No <code>InRelease</code> or <code>Release</code> file has been found in the source repository <code>' . $this->url . '/dists/' . $this->dist . '/</code> (looked for <code>InRelease</code>, <code>Release</code> and <code>Release.gpg</code>). Is the URL of the repository correct?');
}

$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

/**
Expand All @@ -66,7 +66,7 @@ private function parseReleaseFile()
* If the arch is 'src' then the indices file is named 'Sources'
*/
if ($arch == 'src') {
$this->loggingSubStepController->new('searching-source-indices', 'SEARCHING FOR SOURCES INDICES FILE LOCATION');
$this->taskLogSubStepController->new('searching-source-indices', 'SEARCHING FOR SOURCES INDICES FILE LOCATION');

/**
* Sources pattern to search in the Release file
Expand All @@ -79,7 +79,7 @@ private function parseReleaseFile()
* If the arch is not 'src' then the indices file is named 'Packages'
*/
if ($arch != 'src') {
$this->loggingSubStepController->new('searching-packages-indices', 'SEARCHING FOR PACKAGES INDICES FILE FOR ARCH ' . strtoupper($arch));
$this->taskLogSubStepController->new('searching-packages-indices', 'SEARCHING FOR PACKAGES INDICES FILE FOR ARCH ' . strtoupper($arch));

/**
* Packages pattern to search in the Release file
Expand Down Expand Up @@ -126,7 +126,7 @@ private function parseReleaseFile()
$this->packagesIndicesLocation[] = array('location' => $location, 'checksum' => $checksum);
}

$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();

/**
* Then ignore all next Packages.xx/Sources.xx indices file from the same arch as at least one has been found
Expand Down Expand Up @@ -161,7 +161,7 @@ private function parseReleaseFile()
* Process research of Translation files for each requested translation language
*/
if (!empty($this->translation)) {
$this->loggingSubStepController->new('searching-translation', 'SEARCHING FOR TRANSLATION FILE LOCATION');
$this->taskLogSubStepController->new('searching-translation', 'SEARCHING FOR TRANSLATION FILE LOCATION');

foreach ($this->translation as $translation) {
/**
Expand Down Expand Up @@ -198,7 +198,7 @@ private function parseReleaseFile()
throw new Exception('No <code>Translation</code> file location has been found. There may have no translation available for this repository.');
}

$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

unset($content);
Expand All @@ -209,7 +209,7 @@ private function parseReleaseFile()
*/
private function parsePackagesIndiceFile()
{
$this->loggingSubStepController->new('retrieving-deb-packages-list', 'RETRIEVING DEB PACKAGES LIST');
$this->taskLogSubStepController->new('retrieving-deb-packages-list', 'RETRIEVING DEB PACKAGES LIST');

/**
* Process research for each Package file (could have multiple if multiple archs have been specified)
Expand Down Expand Up @@ -296,7 +296,7 @@ private function parsePackagesIndiceFile()
throw new Exception('No packages found in <code>Packages</code> indices file');
}

$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

/**
Expand All @@ -311,7 +311,7 @@ private function parseSourcesIndiceFile()
return;
}

$this->loggingSubStepController->new('retrieving-sources-packages-list', 'RETRIEVING SOURCES PACKAGES LIST');
$this->taskLogSubStepController->new('retrieving-sources-packages-list', 'RETRIEVING SOURCES PACKAGES LIST');

/**
* Process research for each Sources file
Expand Down Expand Up @@ -454,7 +454,7 @@ private function parseSourcesIndiceFile()
throw new Exception('No packages found in <code>Sources</code> indices file');
}

$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

/**
Expand Down Expand Up @@ -507,7 +507,7 @@ private function checkReleaseGPGSignature()
continue;
}

$this->loggingSubStepController->new('checking-' . $releaseFile['name'] . 'gpg-signature', 'CHECKING ' . strtoupper($releaseFile['name']) . ' FILE GPG SIGNATURE');
$this->taskLogSubStepController->new('checking-' . $releaseFile['name'] . 'gpg-signature', 'CHECKING ' . strtoupper($releaseFile['name']) . ' FILE GPG SIGNATURE');

/**
* Check that GPG signature is valid (signed with a known key)
Expand All @@ -524,7 +524,7 @@ private function checkReleaseGPGSignature()
*/
$this->validReleaseFile = $releaseFile['name'];

$this->loggingSubStepController->completed('GPG signature is valid');
$this->taskLogSubStepController->completed('GPG signature is valid');

break;
} catch (Exception $e) {
Expand All @@ -533,7 +533,7 @@ private function checkReleaseGPGSignature()
}

if (DEB_INVALID_SIGNATURE == 'ignore') {
$this->loggingSubStepController->warning($e->getMessage());
$this->taskLogSubStepController->warning($e->getMessage());
continue;
}
}
Expand Down Expand Up @@ -631,7 +631,7 @@ private function downloadDebPackages($url)
/**
* Print URL from which packages are downloaded
*/
$this->loggingSubStepController->new('downloading-packages', 'DOWNLOADING PACKAGES', 'From ' . $url);
$this->taskLogSubStepController->new('downloading-packages', 'DOWNLOADING PACKAGES', 'From ' . $url);

/**
* Count total packages to print progression during syncing
Expand All @@ -652,7 +652,7 @@ private function downloadDebPackages($url)
/**
* Output package to download to log file
*/
$this->loggingSubStepController->new('downloading-package-' . $packageCounter, 'DOWNLOADING PACKAGE (' . $packageCounter . '/' . $totalPackages . ')', $url . '/' . $debPackageLocation);
$this->taskLogSubStepController->new('downloading-package-' . $packageCounter, 'DOWNLOADING PACKAGE (' . $packageCounter . '/' . $totalPackages . ')', $url . '/' . $debPackageLocation);

/**
* Before downloading package, check if there is enough disk space left (2GB minimum)
Expand All @@ -678,7 +678,7 @@ private function downloadDebPackages($url)
* If package is not in the list of packages to include, skip it
*/
if (!$isIn) {
$this->loggingSubStepController->warning('Not in the list of packages to include (ignoring)');
$this->taskLogSubStepController->warning('Not in the list of packages to include (ignoring)');
continue;
}
}
Expand All @@ -700,7 +700,7 @@ private function downloadDebPackages($url)
* If package is in the list of packages to exclude, skip it
*/
if ($isIn) {
$this->loggingSubStepController->warning('In the list of packages to exclude (ignoring)');
$this->taskLogSubStepController->warning('In the list of packages to exclude (ignoring)');
continue;
}
}
Expand All @@ -715,7 +715,7 @@ private function downloadDebPackages($url)
* First check if package has arch in its name, else ignore it
*/
if (!preg_match('/(amd64|arm64|armel|armhf|i386|mips|mips64el|mipsel|ppc64el|s390x|all).deb$/', $debPackageName)) {
$this->loggingSubStepController->warning('Package does not have a valid arch in its name (ignoring)');
$this->taskLogSubStepController->warning('Package does not have a valid arch in its name (ignoring)');
}

/**
Expand All @@ -740,7 +740,7 @@ private function downloadDebPackages($url)
*/
if (file_exists($absoluteDir . '/' . $debPackageName)) {
if ($this->checksum($absoluteDir . '/' . $debPackageName, $debPackageChecksum)) {
$this->loggingSubStepController->completed('Already exists (ignoring)');
$this->taskLogSubStepController->completed('Already exists (ignoring)');
continue;
}
}
Expand All @@ -758,7 +758,7 @@ private function downloadDebPackages($url)
throw new Exception('Cannot create hard link to package: ' . $this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName);
}

$this->loggingSubStepController->completed('Linked to previous snapshot');
$this->taskLogSubStepController->completed('Linked to previous snapshot');

continue;
}
Expand All @@ -781,11 +781,11 @@ private function downloadDebPackages($url)
/**
* Print OK if package has been downloaded and verified successfully
*/
$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

// Set the main substep as completed
$this->loggingSubStepController->completed('', 'downloading-packages');
$this->taskLogSubStepController->completed('', 'downloading-packages');

unset($this->debPackagesLocation, $totalPackages, $packageCounter);
}
Expand Down Expand Up @@ -819,7 +819,7 @@ private function downloadDebSourcesPackages($url)
/**
* Print URL from which sources packages are downloaded
*/
$this->loggingSubStepController->new('downloading-sources-packages', 'DOWNLOADING SOURCES PACKAGES', 'From ' . $url);
$this->taskLogSubStepController->new('downloading-sources-packages', 'DOWNLOADING SOURCES PACKAGES', 'From ' . $url);

/**
* Count total packages to print progression during syncing
Expand All @@ -840,7 +840,7 @@ private function downloadDebSourcesPackages($url)
/**
* Output source package to download to log file
*/
$this->loggingSubStepController->new('downloading-source-package-' . $packageCounter, 'DOWNLOADING SOURCE PACKAGE (' . $packageCounter . '/' . $totalPackages . ')', $sourcePackageLocation);
$this->taskLogSubStepController->new('downloading-source-package-' . $packageCounter, 'DOWNLOADING SOURCE PACKAGE (' . $packageCounter . '/' . $totalPackages . ')', $sourcePackageLocation);

/**
* Before downloading package, check if there is enough disk space left (2GB minimum)
Expand All @@ -854,7 +854,7 @@ private function downloadDebSourcesPackages($url)
* been downloaded or linked already from another arch)
*/
if (file_exists($absoluteDir . '/' . $sourcePackageName)) {
$this->loggingSubStepController->completed('Already exists (ignoring)');
$this->taskLogSubStepController->completed('Already exists (ignoring)');
continue;
}

Expand All @@ -875,7 +875,7 @@ private function downloadDebSourcesPackages($url)
/**
* Print OK if source package has been downloaded and verified successfully
*/
$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

unset($this->sourcesPackagesLocation, $totalPackages, $packageCounter);
Expand Down Expand Up @@ -908,7 +908,7 @@ private function downloadTranslation()
/**
* Output package to download to log file
*/
$this->loggingSubStepController->new('downloading-translation', 'DOWNLOADING TRANSLATION', $translationUrl);
$this->taskLogSubStepController->new('downloading-translation', 'DOWNLOADING TRANSLATION', $translationUrl);

/**
* Download
Expand All @@ -927,7 +927,7 @@ private function downloadTranslation()
/**
* Print OK if package has been downloaded and verified successfully
*/
$this->loggingSubStepController->completed();
$this->taskLogSubStepController->completed();
}

unset($this->translationsLocation);
Expand Down
8 changes: 4 additions & 4 deletions www/controllers/Repo/Mirror/Mirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Mirror
protected $packagesToInclude = [];
protected $packagesToExclude = [];

protected $loggingStepController;
protected $loggingSubStepController;
protected $taskLogStepController;
protected $taskLogSubStepController;

public function __construct(int $taskId)
{
$this->taskId = $taskId;
$this->loggingStepController = new \Controllers\Task\Log\Step($taskId);
$this->loggingSubStepController = new \Controllers\Task\Log\SubStep($taskId);
$this->taskLogStepController = new \Controllers\Task\Log\Step($taskId);
$this->taskLogSubStepController = new \Controllers\Task\Log\SubStep($taskId);
}

public function setTaskId(string $taskId)
Expand Down
Loading

0 comments on commit 3278960

Please sign in to comment.