GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing raw.githubusercontent.com — raw.githubusercontent.com

'renderOpenmostCommunicationAfterEvents', 'Widget.filterWidgets' => 'addOpenmostCommunicationWidgets', 'Template.beforeContent' => 'renderOpenmostCommunication', 'Db.getTablesInstalled' => 'getTablesInstalled', 'SitesManager.deleteSite.end' => 'onSiteDeleted', 'UsersManager.deleteUser' => 'onUserDeleted', 'Archiver.addRecordBuilders' => 'addRecordBuilders', 'Report.addReports' => 'addReports', // after the other plugins, to see the subcategories they add 'Category.addSubcategories' => ['function' => 'addSubcategories', 'after' => true], 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', // after ScheduledReports lists the reports 'ScheduledReports.getReportMetadata' => ['function' => 'removeReportsWithoutKnownColumns', 'after' => true], ]; } public function install() { ReportsDao::install(); Configuration::install(); } public function uninstall() { ReportsDao::uninstall(); } public function getTablesInstalled(&$allTablesInstalled) { $allTablesInstalled = array_merge($allTablesInstalled, ReportsDao::getTableNames()); } public function onSiteDeleted($idSite) { (new ReportsDao())->removeSite((int) $idSite); } public function onUserDeleted($login) { (new ReportsDao())->clearAuthor((string) $login); } /** * One SavedReport per visual report and funnel of every site: the event carries no site and core caches the * list per requested site, while one request can archive several sites. Each builder checks the archived site * against its placement in isEnabled(). */ public function addRecordBuilders(array &$recordBuilders): void { foreach ((new ReportsDao())->getAll() as $report) { if (in_array($report['type'], [ReportDefinition::TYPE_VISUAL, ReportDefinition::TYPE_FUNNEL], true)) { $recordBuilders[] = new SavedReport($report); } } } /** * One report per saved report placed on the requested site. * * @param Report[] $reports */ public function addReports(array &$reports): void { $idSite = self::requestedSite(); if ($idSite === null) { return; } foreach ((new ReportsDao())->getForSiteCached($idSite) as $row) { $report = new GetSavedReport(); $report->initFromRow($row, $idSite); $reports[] = $report; } } /** * Creates the subcategories chosen for saved reports that no plugin declares in their category. * * @param Subcategory[] $subcategories */ public function addSubcategories(array &$subcategories): void { $idSite = self::requestedSite(); if ($idSite === null) { return; } $existing = []; foreach ($subcategories as $subcategory) { $existing[$subcategory->getCategoryId() . '|' . $subcategory->getId()] = true; } foreach (PluginManager::getInstance()->findMultipleComponents('Categories', Subcategory::class) as $class) { $subcategory = StaticContainer::getContainer()->make($class); $existing[$subcategory->getCategoryId() . '|' . $subcategory->getId()] = true; } $order = 200; foreach ((new ReportsDao())->getForSiteCached($idSite) as $row) { $id = GetSavedReport::pageId($row); $key = $row['category'] . '|' . $id; if ($row['category'] === '' || isset($existing[$key])) { continue; } $existing[$key] = true; $subcategory = new Subcategory(); $subcategory->setCategoryId($row['category']); $subcategory->setId($id); // a page of its own is named after its report $subcategory->setName($row['subcategory'] !== '' ? $row['subcategory'] : $row['name']); $subcategory->setOrder($order++); $subcategories[] = $subcategory; } } /** * A raw SQL report whose result columns are only known once it ran ("*", an expression without alias) would * be sent without columns, so it cannot be scheduled. */ public function removeReportsWithoutKnownColumns(&$availableReportMetadata, $reportType = null, $idSite = null): void { if (!is_array($availableReportMetadata) || !$idSite) { return; } $dao = new ReportsDao(); $availableReportMetadata = array_values(array_filter($availableReportMetadata, function ($metadata) use ($dao, $idSite) { if (($metadata['module'] ?? '') !== 'DataExplorer' || empty($metadata['parameters'][GetSavedReport::PARAMETER])) { return true; } $row = $dao->getCached((int) $metadata['parameters'][GetSavedReport::PARAMETER]); if ($row === null) { return false; } $report = new GetSavedReport(); $report->initFromRow($row, (int) $idSite, false); return $report->hasKnownColumns(); })); } public function getStylesheetFiles(array &$stylesheets): void { $stylesheets[] = 'plugins/DataExplorer/stylesheets/explorer.less'; } public function getJsFiles(array &$jsFiles): void { $jsFiles[] = 'plugins/DataExplorer/javascripts/treemapColors.js'; } public function getClientSideTranslationKeys(array &$translationKeys): void { $translationKeys = array_merge($translationKeys, self::CLIENT_SIDE_TRANSLATION_KEYS); } /** * The site of the request, idSites for API.getReportMetadata, like core reports registered per site. */ private static function requestedSite(): ?int { $idSite = Common::getRequestVar('idSite', 0, 'int'); if ($idSite > 0) { return $idSite; } $idSites = Common::getRequestVar('idSites', '', null); if (is_array($idSites) && count($idSites) === 1) { $idSites = reset($idSites); } if (is_scalar($idSites) && ctype_digit((string) $idSites) && (int) $idSites > 0) { return (int) $idSites; } return null; } /** * Invalidates the DataExplorer archives of every placed site over the last invalidation_months months, so the * next core:archive run builds the report (new revision, new record name) over that history. * * @param array $report a hydrated row of ReportsDao */ public function invalidateHistory(array $report): void { $placement = $report['placement'] ?? null; if (!in_array($report['type'] ?? '', [ReportDefinition::TYPE_VISUAL, ReportDefinition::TYPE_FUNNEL], true) || !$placement instanceof Placement) { return; } $siteIds = $placement->isAllWebsites() ? Access::doAsSuperUser(fn () => SitesManagerAPI::getInstance()->getAllSitesId()) : $placement->getSiteIds(); $sitesByToday = []; foreach ($siteIds as $idSite) { $today = Date::factoryInTimezone('today', Site::getTimezoneFor($idSite))->toString(); $sitesByToday[$today][] = (int) $idSite; } $invalidator = StaticContainer::get(ArchiveInvalidator::class); $months = Configuration::getInvalidationMonths(); foreach ($sitesByToday as $today => $ids) { $end = Date::factory($today); $dates = []; for ($day = $end->subPeriod($months, 'month'); !$day->isLater($end); $day = $day->addDay(1)) { $dates[] = $day; } $invalidator->markArchivesAsInvalidated($ids, $dates, 'day', null, true, false, $this->getPluginName()); } } public function renderOpenmostCommunication(&$out, $layout, $module = '', $action = '') { OpenmostCommunication::beforeContent($out, (string) $layout, (string) $module, (string) $action, $this->getPluginName()); } public function addOpenmostCommunicationWidgets($list) { OpenmostCommunication::filterWidgets($list, $this->getPluginName()); } public function renderOpenmostCommunicationAfterEvents(&$out, $dataTable = null) { OpenmostCommunication::afterEventsReport($out, $this->getPluginName()); } }
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.