Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release prep (4.0.0) #2037

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
- master
- develop
- release23
- release32
- westphal
- release33

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ RUN mkdir /var/www/cms/openooh \
&& curl -o /var/www/cms/openooh/specification.json https://raw.githubusercontent.com/openooh/venue-taxonomy/main/specification.json

# Help Links
RUN curl -o /var/www/cms/help-links.yaml https://raw.githubusercontent.com/xibosignage/xibo-manual/develop/help-links.yaml || true
RUN curl -o /var/www/cms/help-links.yaml https://raw.githubusercontent.com/xibosignage/xibo-manual/master/help-links.yaml || true

# Git commit fallback
RUN echo $GIT_COMMIT > /var/www/cms/commit.sha
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/schedule.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Campaigns', function() {
});
});

it('should schedule an event campaign that has no priority, no recurrence', function() {
it.skip('should schedule an event campaign that has no priority, no recurrence', function() {
// Set up intercepts with aliases
cy.intercept({
url: '/display?start=*',
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Campaigns', function() {
cy.get('#schedule-grid').contains(campaignSchedule1);
});

it('should schedule an event layout that has no priority, no recurrence', function() {
it.skip('should schedule an event layout that has no priority, no recurrence', function() {
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: display1},
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('Campaigns', function() {
cy.contains('Added Event');
});

it('should schedule an event command/overlay layout that has no priority, no recurrence', function() {
it.skip('should schedule an event command/overlay layout that has no priority, no recurrence', function() {
cy.intercept({
url: '/displaygroup?*',
query: {displayGroup: display1},
Expand Down
31 changes: 21 additions & 10 deletions db/migrations/20220915100902_add_fonts_table_migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function change()

// create fonts sub-folder in the library location
$libraryLocation = $this->fetchRow('
SELECT `setting`.value
SELECT `setting`.`value`
FROM `setting`
WHERE `setting`.setting = \'LIBRARY_LOCATION\'')[0] ?? null;
WHERE `setting`.`setting` = \'LIBRARY_LOCATION\'')[0] ?? null;

// New installs won't have a library location yet (if they are non-docker).
if (!empty($libraryLocation)) {
Expand All @@ -64,39 +64,50 @@ public function change()
}

// Fix any potential incorrect dates in modifiedDt
$this->execute('UPDATE `media` SET `media`.modifiedDt = `media`.createdDt WHERE `media`.modifiedDt < \'2000-01-01\'');
$this->execute('UPDATE `media` SET `media`.modifiedDt = `media`.createdDt WHERE `media`.modifiedDt < \'2000-01-01\'');//phpcs:ignore

// get all existing font records in media table and convert them
foreach ($this->fetchAll('SELECT mediaId, name, type, createdDt, modifiedDt, storedAs, md5, fileSize, originalFileName FROM `media` WHERE media.type = \'font\'') as $fontMedia) {
foreach ($this->fetchAll('SELECT mediaId, name, type, createdDt, modifiedDt, storedAs, md5, fileSize, originalFileName FROM `media` WHERE media.type = \'font\'') as $fontMedia) {//phpcs:ignore
$table
->insert([
'createdAt' => $fontMedia['createdDt'],
'modifiedAt' => $fontMedia['modifiedDt'],
'name' => $fontMedia['name'],
'fileName' => $fontMedia['originalFileName'],
'familyName' => strtolower(preg_replace('/\s+/', ' ', preg_replace('/\d+/u', '', $fontMedia['name']))),
'familyName' => strtolower(preg_replace(
'/\s+/',
' ',
preg_replace('/\d+/u', '', $fontMedia['name'])
)),
'size' => $fontMedia['fileSize'],
'md5' => $fontMedia['md5']
])
->save();

// move the stored files with new id to fonts folder
rename($libraryLocation . $fontMedia['storedAs'], $libraryLocation . 'fonts/' . $fontMedia['originalFileName']);
rename(
$libraryLocation . $fontMedia['storedAs'],
$libraryLocation . 'fonts/' . $fontMedia['originalFileName']
);

// remove any potential widget links (there shouldn't be any)
$this->execute('DELETE FROM `lktagmedia` WHERE `lktagmedia`.`mediaId` = ' . $fontMedia['mediaId']);

// remove any potential tagLinks from font media files
// otherwise we risk failing the migration on the next step when we remove records from media table.
$this->execute('DELETE FROM `lktagmedia` WHERE `lktagmedia`.mediaId = ' . $fontMedia['mediaId']);
$this->execute('DELETE FROM `lktagmedia` WHERE `lktagmedia`.`mediaId` = ' . $fontMedia['mediaId']);
}

// delete font records from media table
$this->execute('DELETE FROM `media` WHERE media.type = \'font\'');
$this->execute('DELETE FROM `media` WHERE `media`.`type` = \'font\'');
}

// delete "module" record for fonts
$this->execute('DELETE FROM `module` WHERE `module`.moduleId = \'core-font\'');
$this->execute('DELETE FROM `module` WHERE `module`.`moduleId` = \'core-font\'');

// remove fonts.css file records from media table
$this->execute('DELETE FROM `media` WHERE media.originalFileName = \'fonts.css\' AND media.type = \'module\' AND media.moduleSystemFile = 1 ');
$this->execute('DELETE FROM `media` WHERE `media`.`originalFileName` = \'fonts.css\' AND `media`.`type` = \'module\' AND `media`.`moduleSystemFile` = 1 ');//phpcs:ignore

// remove fonts.css from library folder
if (file_exists($libraryLocation . 'fonts.css')) {
@unlink($libraryLocation . 'fonts.css');
Expand Down
4 changes: 2 additions & 2 deletions lib/Connector/AlphaVantageConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private function getStockResults(DataProviderInterface $dataProvider): void
protected function getStockQuote(string $symbol, ?int $isPaidPlan): array
{
try {
$cache = $this->getPool()->getItem('/widget/Stocks/'.md5($symbol));
$cache = $this->getPool()->getItem('/widget/stock/'.md5($symbol));
$cache->setInvalidationMethod(Invalidation::SLEEP, 5000, 15);

$data = $cache->get();
Expand Down Expand Up @@ -497,7 +497,7 @@ private function getCurrenciesResults(DataProviderInterface $dataProvider): void
private function getCurrencyExchangeRate(string $fromCurrency, string $toCurrency, bool $isPaidPlan)
{
try {
$cache = $this->getPool()->getItem('/widget/Currency/' . md5($fromCurrency . $toCurrency . $isPaidPlan));
$cache = $this->getPool()->getItem('/widget/currency/' . md5($fromCurrency . $toCurrency . $isPaidPlan));
$cache->setInvalidationMethod(Invalidation::SLEEP, 5000, 15);

$data = $cache->get();
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/MenuBoardProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function addForm(Request $request, Response $response, $id): Response
* name="price",
* in="formData",
* description="Menu Board Product price",
* type="decimal",
* type="number",
* required=false
* ),
* @SWG\Parameter(
Expand Down Expand Up @@ -512,7 +512,7 @@ public function editForm(Request $request, Response $response, $id): Response
* name="price",
* in="formData",
* description="Menu Board Product price",
* type="decimal",
* type="number",
* required=false
* ),
* @SWG\Parameter(
Expand Down
21 changes: 14 additions & 7 deletions lib/Entity/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
private $combinedConfig;

/** @var \Xibo\Entity\DisplayProfile the resolved DisplayProfile for this Display */
private $_displayProfile;

Check warning on line 521 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Property name "$_displayProfile" should not be prefixed with an underscore to indicate visibility

private $datesToFormat = ['auditingUntil'];

Expand All @@ -528,7 +528,7 @@
*/
private $commands = null;

public static $saveOptionsMinimum = ['validate' => false, 'audit' => false];
public static $saveOptionsMinimum = ['validate' => false, 'audit' => false, 'setModifiedDt' => false];

/**
* @var ConfigServiceInterface
Expand Down Expand Up @@ -568,7 +568,7 @@
* @param DisplayProfileFactory $displayProfileFactory
* @param DisplayFactory $displayFactory
*/
public function __construct($store, $log, $dispatcher, $config, $displayGroupFactory, $displayProfileFactory, $displayFactory, $folderFactory)

Check warning on line 571 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 146 characters
{
$this->setCommonDependencies($store, $log, $dispatcher);
$this->excludeProperty('mediaInventoryXml');
Expand Down Expand Up @@ -627,7 +627,7 @@
*/
public function getDisplayProfile()
{
if ($this->_displayProfile === null) {

Check failure on line 630 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Blank line found at start of control structure

try {
if ($this->displayProfileId == 0) {
Expand All @@ -646,7 +646,7 @@

// Set our display profile
$this->_displayProfile = $displayProfile;

Check failure on line 649 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Blank line found at end of control structure
}

return $this->_displayProfile;
Expand Down Expand Up @@ -733,7 +733,7 @@
throw new InvalidArgumentException(__('The latitude entered is not valid.'), 'latitude');

if ($this->bandwidthLimit !== null && !v::intType()->min(0)->validate($this->bandwidthLimit)) {
throw new InvalidArgumentException(__('Bandwidth limit must be a whole number greater than 0.'), 'bandwidthLimit');

Check warning on line 736 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 127 characters
}
}

Expand Down Expand Up @@ -803,7 +803,8 @@
$options = array_merge([
'validate' => true,
'audit' => true,
'checkDisplaySlotAvailability' => true
'checkDisplaySlotAvailability' => true,
'setModifiedDt' => true,
], $options);

if ($options['validate']) {
Expand All @@ -825,7 +826,7 @@
if ($this->displayId == null || $this->displayId == 0) {
$this->add();
} else {
$this->edit();
$this->edit($options);
}

if ($options['audit'] && $this->getChangedProperties() != []) {
Expand Down Expand Up @@ -943,7 +944,7 @@
* @throws GeneralException
* @throws NotFoundException
*/
private function edit()
private function edit($options = [])
{
$this->getStore()->update('
UPDATE display
Expand Down Expand Up @@ -1110,10 +1111,16 @@
'manageDisplayLinks' => false,
'manageDynamicDisplayLinks' => false,
'allowNotify' => true,
'saveTags' => $saveTags
'saveTags' => $saveTags,
'setModifiedDt' => $options['setModifiedDt'],
]);
} else {
$this->store->update('UPDATE displaygroup SET `modifiedDt` = :modifiedDt WHERE displayGroupId = :displayGroupId', [
} else if ($options['setModifiedDt']) {
// Bump the modified date.
$this->store->update('
UPDATE displaygroup
SET `modifiedDt` = :modifiedDt
WHERE displayGroupId = :displayGroupId
', [
'modifiedDt' => Carbon::now()->format(DateFormatHelper::getSystemFormat()),
'displayGroupId' => $this->displayGroupId
]);
Expand Down Expand Up @@ -1173,7 +1180,7 @@
// Only get an option if set from the override config on this display
foreach ($this->overrideConfig as $row) {
if ($row['name'] == $key || $row['name'] == ucfirst($key)) {
$return = array_key_exists('value', $row) ? $row['value'] : ((array_key_exists('default', $row)) ? $row['default'] : $default);

Check warning on line 1183 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 147 characters
break;
}
}
Expand All @@ -1181,7 +1188,7 @@
// Get the option from the combined array of config
foreach ($this->combinedConfig as $row) {
if ($row['name'] == $key || $row['name'] == ucfirst($key)) {
$return = array_key_exists('value', $row) ? $row['value'] : ((array_key_exists('default', $row)) ? $row['default'] : $default);

Check warning on line 1191 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 147 characters
break;
}
}
Expand All @@ -1189,7 +1196,7 @@
// Get the option from the profile only
foreach ($this->profileConfig as $row) {
if ($row['name'] == $key || $row['name'] == ucfirst($key)) {
$return = array_key_exists('value', $row) ? $row['value'] : ((array_key_exists('default', $row)) ? $row['default'] : $default);

Check warning on line 1199 in lib/Entity/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 147 characters
break;
}
}
Expand Down
17 changes: 10 additions & 7 deletions lib/Entity/DisplayGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,21 +620,22 @@
'manageDisplayLinks' => true,
'manageDynamicDisplayLinks' => true,
'allowNotify' => true,
'saveTags' => true
'saveTags' => true,
'setModifiedDt' => true,
], $options);

// Should we allow notification or not?
$this->allowNotify = $options['allowNotify'];

if ($options['validate'])
if ($options['validate']) {
$this->validate();
}

if ($this->displayGroupId == null || $this->displayGroupId == 0) {
$this->add();
$this->loaded = true;
}
else if ($options['saveGroup']) {
$this->edit();
} else if ($options['saveGroup']) {
$this->edit($options);
}

if ($options['saveTags']) {
Expand Down Expand Up @@ -783,7 +784,7 @@
]);
}

private function edit()
private function edit($options = [])
{
$this->getLog()->debug(sprintf('Updating Display Group. %s, %d', $this->displayGroup, $this->displayGroupId));

Expand Down Expand Up @@ -820,7 +821,9 @@
'dynamicCriteriaTagsLogicalOperator' => $this->dynamicCriteriaTagsLogicalOperator ?? 'OR',
'bandwidthLimit' => $this->bandwidthLimit,
'userId' => $this->userId,
'modifiedDt' => Carbon::now()->format(DateFormatHelper::getSystemFormat()),
'modifiedDt' => $options['setModifiedDt']
? Carbon::now()->format(DateFormatHelper::getSystemFormat())
: $this->modifiedDt,
'folderId' => $this->folderId,
'permissionsFolderId' => $this->permissionsFolderId,
'ref1' => $this->ref1,
Expand All @@ -838,7 +841,7 @@
*/
private function manageDisplayLinks($manageDynamic = true)
{
$this->getLog()->debug('Manage display links. Manage Dynamic = ' . $manageDynamic . ', Dynamic = ' . $this->isDynamic);

Check warning on line 844 in lib/Entity/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 127 characters
$difference = [];

if ($this->isDynamic == 1 && $manageDynamic) {
Expand All @@ -859,13 +862,13 @@
'useRegexForName' => true
]);

$this->getLog()->debug(sprintf('There are %d original displays and %d displays that match the filter criteria now.', count($originalDisplays), count($this->displays)));

Check warning on line 865 in lib/Entity/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 180 characters

// Map our arrays to simple displayId lists
$displayIds = array_map(function ($element) { return $element->displayId; }, $this->displays);
$originalDisplayIds = array_map(function ($element) { return $element->displayId; }, $originalDisplays);

$difference = array_merge(array_diff($displayIds, $originalDisplayIds), array_diff($originalDisplayIds, $displayIds));

Check warning on line 871 in lib/Entity/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 130 characters

// This is a dynamic display group
// only manage the links that have changed
Expand Down
11 changes: 8 additions & 3 deletions lib/Entity/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@
'audit' => true,
'import' => false,
'appendCountOnDuplicate' => false,
'setModifiedDt' => true,
], $options);

if ($options['validate']) {
Expand Down Expand Up @@ -1014,7 +1015,7 @@
}

// Delete widget history
$this->getStore()->update('DELETE FROM `widgethistory` WHERE layoutHistoryId IN (SELECT layoutHistoryId FROM `layouthistory` WHERE campaignId = :campaignId)', ['campaignId' => $this->campaignId]);

Check warning on line 1018 in lib/Entity/Layout.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 208 characters

// Delete layout history
$this->getStore()->update('DELETE FROM `layouthistory` WHERE campaignId = :campaignId', ['campaignId' => $this->campaignId]);
Expand Down Expand Up @@ -2235,7 +2236,8 @@
'audit' => false,
'validate' => false,
'notify' => $options['notify'],
'collectNow' => $options['collectNow']
'collectNow' => $options['collectNow'],
'setModifiedDt' => false,
]);

$this->hasBuilt = true;
Expand Down Expand Up @@ -2526,7 +2528,7 @@
{
$options = array_merge([
'notify' => true,
'collectNow' => true
'collectNow' => true,
], $options);

$this->getLog()->debug('Editing Layout ' . $this->layout . '. Id = ' . $this->layoutId);
Expand Down Expand Up @@ -2554,7 +2556,10 @@
WHERE layoutID = :layoutid
';

$time = Carbon::now()->format(DateFormatHelper::getSystemFormat());
// Only set the modified date if requested.
$time = ($options['setModifiedDt'])
? Carbon::now()->format(DateFormatHelper::getSystemFormat())
: $this->modifiedDt;

$this->getStore()->update($sql, array(
'layoutid' => $this->layoutId,
Expand Down
8 changes: 7 additions & 1 deletion lib/Factory/ModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ public function __construct(string $cachePath, PoolInterface $pool, Twig $twig,
*/
public function createDataProvider(Module $module, Widget $widget): DataProviderInterface
{
return new DataProvider($module, $widget, $this->config->getGuzzleProxy(), $this->getSanitizerService());
return new DataProvider(
$module,
$widget,
$this->config->getGuzzleProxy(),
$this->getSanitizerService(),
$this->pool,
);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Widget/Compatibility/CalendarWidgetCompatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public function upgradeWidget(Widget $widget, int $fromSchema, int $toSchema): b
// Did we originally come from an agenda (the old calendar widget)
if ($widget->getOriginalValue('type') === 'calendar') {
$newTemplateId = 'event_custom_html';

// New options names.
$widget->changeOption('template', 'text');
} else {
// We are a calendaradvanced
// Calendar type is either 1=schedule, 2=daily, 3=weekly or 4=monthly.
Expand Down
7 changes: 4 additions & 3 deletions lib/Widget/Compatibility/WorldClockWidgetCompatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ public function upgradeWidget(Widget $widget, int $fromSchema, int $toSchema): b
}
}

// If overriden, we need to tranlate the legacy options to the new values
// We need to tranlate the legacy options to the new values
$widget->changeOption('clockCols', 'numCols');
$widget->changeOption('clockRows', 'numRows');

if ($overrideTemplate == 1) {
$widget->setOptionValue('template_html', 'cdata', $widget->getOptionValue('mainTemplate', ''));
$widget->setOptionValue('template_style', 'cdata', $widget->getOptionValue('styleSheet', ''));
$widget->setOptionValue('numCols', 'attrib', $widget->getOptionValue('clockCols', 1));
$widget->setOptionValue('numRows', 'attrib', $widget->getOptionValue('clockRows', 1));
$widget->setOptionValue('widgetDesignWidth', 'attrib', $widget->getOptionValue('widgetOriginalWidth', '250'));
$widget->setOptionValue('widgetDesignHeight', 'attrib', $widget->getOptionValue('widgetOriginalHeight', '250'));
}
Expand Down
Loading
Loading