Skip to content

Commit

Permalink
Scoping using the updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
snake14 committed Oct 30, 2023
1 parent 3ea790a commit cad809f
Show file tree
Hide file tree
Showing 3,339 changed files with 157,442 additions and 204,551 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 2 additions & 5 deletions ApiQuotaHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Matomo - free/libre analytics platform
*
Expand All @@ -16,29 +17,25 @@ class ApiQuotaHelper
* Calculate the daily maximum api quota available for the instance
* @return int
*/
public function getMaxDailyApiQuota(): int
public function getMaxDailyApiQuota() : int
{
//Local installation. No limitations from google applicable
return -1;
}

public function getBalanceApiQuota()
{
return $this->getMaxDailyApiQuota();
}

public function saveApiUsed($numQueries)
{
//No need to save since it's a local installation
return;
}

public function trackEvent($event, $name)
{
//DI to takeover on ConnectAccount
return;
}

public function getImportCountForTheDay()
{
//Local installation. No limitations from google applicable
Expand Down
12 changes: 4 additions & 8 deletions CannotImportCustomDimensionException.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<?php

/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Plugins\GoogleAnalyticsImporter;


class CannotImportCustomDimensionException extends \Exception
{
/**
* @var \Google\Service\Analytics\CustomDimension
*/
private $gaCustomDimension;

private $reason;

public function __construct(\Google\Service\Analytics\CustomDimension $gaCustomDimension, $reason)
public function __construct(\Matomo\Dependencies\GoogleAnalyticsImporter\Google\Service\Analytics\CustomDimension $gaCustomDimension, $reason)
{
parent::__construct("Unable to import the '{$gaCustomDimension->getName()}' custom dimension: $reason.");
parent::__construct("Unable to import the '{$gaCustomDimension->getName()}' custom dimension: {$reason}.");
$this->gaCustomDimension = $gaCustomDimension;
$this->reason = $reason;
}

}
}
12 changes: 4 additions & 8 deletions CannotImportCustomDimensionGA4Exception.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<?php

/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Plugins\GoogleAnalyticsImporter;


class CannotImportCustomDimensionGA4Exception extends \Exception
{
/**
* @var \Google\Analytics\Admin\V1alpha\CustomDimension
*/
private $gaCustomDimension;

private $reason;

public function __construct(\Google\Analytics\Admin\V1alpha\CustomDimension $gaCustomDimension, $reason)
public function __construct(\Matomo\Dependencies\GoogleAnalyticsImporter\Google\Analytics\Admin\V1alpha\CustomDimension $gaCustomDimension, $reason)
{
parent::__construct("Unable to import the '{$gaCustomDimension->getDisplayName()}' custom dimension: $reason.");
parent::__construct("Unable to import the '{$gaCustomDimension->getDisplayName()}' custom dimension: {$reason}.");
$this->gaCustomDimension = $gaCustomDimension;
$this->reason = $reason;
}

}
}
11 changes: 4 additions & 7 deletions CannotImportGoalException.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
<?php

/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Plugins\GoogleAnalyticsImporter;


class CannotImportGoalException extends \Exception
{
/**
* @var \Google\Service\Analytics\Goal
*/
private $gaGoal;

private $reason;

/**
* CannotImportGoalException constructor.
* @param \Google\Service\Analytics\Goal $gaGoal
* @param string $string
*/
public function __construct(\Google\Service\Analytics\Goal $gaGoal, $reason)
public function __construct(\Matomo\Dependencies\GoogleAnalyticsImporter\Google\Service\Analytics\Goal $gaGoal, $reason)
{
parent::__construct("Unable to import the '{$gaGoal->getName()}' goal: $reason.");
parent::__construct("Unable to import the '{$gaGoal->getName()}' goal: {$reason}.");
$this->gaGoal = $gaGoal;
$this->reason = $reason;
}
}
}
5 changes: 2 additions & 3 deletions CannotProcessImportException.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Plugins\GoogleAnalyticsImporter;


class CannotProcessImportException extends \Exception
{
public function __construct($message)
{
parent::__construct($message);
}
}
}
22 changes: 6 additions & 16 deletions Commands/ArchiveImportedData.php
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
<?php

/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

namespace Piwik\Plugins\GoogleAnalyticsImporter\Commands;

use Piwik\Container\StaticContainer;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugins\GoogleAnalyticsImporter\ImportStatus;
use Piwik\Plugins\GoogleAnalyticsImporter\Logger\LogToSingleFileProcessor;
use Piwik\Plugins\GoogleAnalyticsImporter\Tasks;

class ArchiveImportedData extends ConsoleCommand
{
protected function configure()
{
$this->setName('googleanalyticsimporter:archive-imported-data');
$this->setDescription('Initiates core:archive for an imported site. This is run automatically every day, but can be run manually if needed.'
. ' All it really does is call core:archive w/ a few custom parameters so data from years back gets archived.');
$this->setDescription('Initiates core:archive for an imported site. This is run automatically every day, but can be run manually if needed.' . ' All it really does is call core:archive w/ a few custom parameters so data from years back gets archived.');
$this->addRequiredValueOption('idSite', null, 'The ID of the imported site to initiate archiving for.');
}

/**
* @return int
*/
protected function doExecute(): int
protected function doExecute() : int
{
$input = $this->getInput();
$output = $this->getOutput();
$idSite = (int) $input->getOption('idSite');

LogToSingleFileProcessor::handleLogToSingleFileInCliCommand($idSite);

$importStatus = StaticContainer::get(ImportStatus::class);

try {
$status = $importStatus->getImportStatus($idSite);
} catch (\Exception $ex) {
$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "No import found for site ID = $idSite.");
$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "No import found for site ID = {$idSite}.");
return self::FAILURE;
}

$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "Starting core:archive for site ID = $idSite.");

Tasks::startArchive($status, $wait = true);

$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "Starting core:archive for site ID = {$idSite}.");
Tasks::startArchive($status, $wait = \true);
$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "Done.");

return self::SUCCESS;
}
}
Loading

0 comments on commit cad809f

Please sign in to comment.