Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2014-11-13 12:45:05 +0300
committerdiosmosis <benaka@piwik.pro>2014-11-13 12:45:05 +0300
commite596b71231113941b43809e0adc9af608e797645 (patch)
treebbe492d166839be95976eed16c965786d9084f42 /core/DataTable.php
parentd07d24c59780587c58727a5295951a2dfcb8fc58 (diff)
Move goal translations and metric docs to metric classes from Goals visualization. Allow these values as defaults for translations in visualizations, and fix a bug in GoalsTable where sort was improperly applied if no data was in the data table. Also include in-memory caching for Goals.getGoals API method.
Diffstat (limited to 'core/DataTable.php')
-rw-r--r--core/DataTable.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/DataTable.php b/core/DataTable.php
index 16839631e5..bdb7ef4f99 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -1679,4 +1679,21 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess
{
$this->deleteRow($offset);
}
-}
+
+ /**
+ * Returns the ID of the site a table is related to based on the 'site' metadata entry,
+ * or null if there is none.
+ *
+ * @param DataTable $table
+ * @return int|null
+ */
+ public static function getSiteIdFromMetadata(DataTable $table)
+ {
+ $site = $table->getMetadata('site');
+ if (empty($site)) {
+ return null;
+ } else {
+ return $site->getId();
+ }
+ }
+} \ No newline at end of file