Skip to content

Commit

Permalink
Merge branch '4.x-dev' into 6210-cli-archiving-related-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed Oct 31, 2020
2 parents f81d617 + 2e51cac commit 3aeb55f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
34 changes: 20 additions & 14 deletions core/Archive/ArchiveInvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,36 +452,42 @@ public function markArchivesOverlappingRangeAsInvalidated(array $idSites, array
* @param int[]|string $idSites A list of idSites or 'all'
* @param string $plugin
* @param string|null $report
* @param string|null $lastNMonthsToInvalidate eg, last12
* @param Date|null $startDate
* @throws \Exception
* @api
*/
public function reArchiveReport($idSites, string $plugin, string $report = null, string $lastNMonthsToInvalidate = null)
public function reArchiveReport($idSites, string $plugin, string $report = null, Date $startDate = null)
{
$lastNMonthsToInvalidate = $lastNMonthsToInvalidate ?: Config::getInstance()->General['rearchive_reports_in_past_last_n_months'];
if (empty($lastNMonthsToInvalidate)) {
return;
}
if (empty($startDate)) {
$lastNMonthsToInvalidate = Config::getInstance()->General['rearchive_reports_in_past_last_n_months'];
if (empty($lastNMonthsToInvalidate)) {
return;
}

$lastNMonthsToInvalidate = (int) substr($lastNMonthsToInvalidate, 4);
if (empty($lastNMonthsToInvalidate)) {
return;
$lastNMonthsToInvalidate = (int) substr($lastNMonthsToInvalidate, 4);
if (empty($lastNMonthsToInvalidate)) {
return;
}

$date2 = Date::yesterday();
$startDate = $date2->subMonth($lastNMonthsToInvalidate)->setDay(1);
}

if ($idSites === 'all') {
$idSites = $this->getAllSitesId();
}

$date2 = Date::yesterday();
$date1 = $date2->subMonth($lastNMonthsToInvalidate)->setDay(1);

$dates = [];
$date = $date1;
$date = $startDate;
while ($date->isEarlier($date2)) {
$dates[] = $date;
$date = $date->addDay(1);
}

if (empty($dates)) {
return;
}

$name = $plugin;
if (!empty($report)) {
$name .= '.' . $report;
Expand All @@ -492,7 +498,7 @@ public function reArchiveReport($idSites, string $plugin, string $report = null,
$segmentDatesToInvalidate = $this->getSegmentArchiving()->getSegmentArchivesToInvalidate($idSite);
foreach ($segmentDatesToInvalidate as $info) {
$latestDate = Date::factory($info['date']);
$latestDate = $latestDate->isEarlier($date1) ? $latestDate : $date1;
$latestDate = $latestDate->isEarlier($startDate) ? $latestDate : $startDate;

$datesToInvalidateForSegment = [];

Expand Down
4 changes: 2 additions & 2 deletions core/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static function setupProfilerXHProf($mainRun = false, $setupDuringTrackin
$hasTidewaysXhprof = function_exists('tideways_xhprof_enable') || function_exists('tideways_enable');

if (!$hasXhprof && !$hasTidewaysXhprof) {
$xhProfPath = PIWIK_INCLUDE_PATH . '/vendor/facebook/xhprof/extension/modules/xhprof.so';
$xhProfPath = PIWIK_INCLUDE_PATH . '/vendor/lox/xhprof/extension/modules/xhprof.so';
throw new Exception("Cannot find xhprof_enable, make sure to 1) install xhprof: run 'composer install --dev' and build the extension, and 2) add 'extension=$xhProfPath' to your php.ini.");
}

Expand Down Expand Up @@ -301,7 +301,7 @@ function xhprof_error($out)
if (strlen($baseUrlStored) > strlen($baseUrl)) {
$baseUrl = $baseUrlStored;
}
$baseUrl = $baseUrlStored . "vendor/facebook/xhprof/xhprof_html/?source=$profilerNamespace&run=$runId";
$baseUrl = $baseUrlStored . "vendor/lox/xhprof/xhprof_html/?source=$profilerNamespace&run=$runId";

$out .= "Profiler report is available at:\n";
$out .= "<a href='$baseUrl'>$baseUrl</a>";
Expand Down
4 changes: 4 additions & 0 deletions plugins/CoreHome/javascripts/materialize-bc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function () {
jQuery.htmlPrefilter = function( html ) {
return html;
};

$(document).ready(function () {
window.Materialize = window.M;
$.fn.sideNav = $.fn.sidenav;
Expand Down

0 comments on commit 3aeb55f

Please sign in to comment.