Skip to content

Commit

Permalink
Merge pull request #1199 from PeterMis/wolf-2.3.11
Browse files Browse the repository at this point in the history
Wolf 2.3.11
  • Loading branch information
dasgarner authored Jul 12, 2021
2 parents 81b97ad + 4e939b8 commit 6293297
Show file tree
Hide file tree
Showing 33 changed files with 244 additions and 142 deletions.
18 changes: 9 additions & 9 deletions db/migrations/20180130073838_install_migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private function addStructure()
->addColumn('userName', 'string', ['limit' => 50])
->addColumn('userPassword', 'string', ['limit' => 255])
->addColumn('loggedIn', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY])
->addColumn('lastAccessed', 'datetime', ['null' => true])
->addColumn('lastAccessed', 'datetime', ['null' => true, 'default' => null])
->addColumn('email', 'string', ['limit' => 255, 'null' => true, 'default' => null])
->addColumn('homePageId', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 1])
->addColumn('retired', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 0])
Expand Down Expand Up @@ -304,8 +304,8 @@ private function addStructure()
->addColumn('expires', 'integer', ['default' => null, 'null' => true])
->addColumn('released', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 1])
->addColumn('apiRef', 'string', ['limit' => 254, 'default' => null, 'null' => true])
->addColumn('createdDt', 'datetime')
->addColumn('modifiedDt', 'datetime')
->addColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addForeignKey('userId', 'user', 'userId')
->save();

Expand Down Expand Up @@ -348,8 +348,8 @@ private function addStructure()
$layout
->addColumn('layout', 'string', ['limit' => 254])
->addColumn('userId', 'integer')
->addColumn('createdDt', 'datetime')
->addColumn('modifiedDt', 'datetime')
->addColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('description', 'string', ['limit' => 254, 'default' => null, 'null' => true])
->addColumn('retired', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 0])
->addColumn('duration', 'integer')
Expand Down Expand Up @@ -945,14 +945,14 @@ private function addStructure()
$stat = $this->table('stat', ['id' => 'statId']);
$stat
->addColumn('type', 'string', ['limit' => 20])
->addColumn('statDate', 'datetime')
->addColumn('statDate', 'datetime', ['null' => true, 'default' => null])
->addColumn('scheduleId', 'integer')
->addColumn('displayId', 'integer')
->addColumn('layoutId', 'integer', ['default' => null, 'null' => true])
->addColumn('mediaId', 'integer', ['default' => null, 'null' => true])
->addColumn('widgetId', 'integer', ['default' => null, 'null' => true])
->addColumn('start', 'datetime')
->addColumn('end', 'datetime', ['default' => null, 'null' => true])
->addColumn('start', 'datetime', ['null' => true, 'default' => null])
->addColumn('end', 'datetime', ['null' => true, 'default' => null])
->addColumn('tag', 'string', ['limit' => 254, 'default' => null, 'null' => true])
->addIndex('statDate')
->addIndex(['displayId', 'end', 'type'])
Expand All @@ -973,7 +973,7 @@ private function addStructure()
$log = $this->table('log', ['id' => 'logId']);
$log
->addColumn('runNo', 'string', ['limit' => 10])
->addColumn('logDate', 'datetime')
->addColumn('logDate', 'datetime', ['null' => true, 'default' => null])
->addColumn('channel', 'string', ['limit' => 20])
->addColumn('type', 'string', ['limit' => 254])
->addColumn('page', 'string', ['limit' => 50])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function up()

$media = $this->table('media');
$media
->addColumn('createdDt', 'datetime')
->addColumn('modifiedDt', 'datetime')
->addColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->save();

$this->execute('UPDATE `module` SET validextensions = CONCAT(validextensions, \',ipk\') WHERE module = \'genericfile\' LIMIT 1;');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function up()
$playlist = $this->table('playlist');
$playlist
->addColumn('regionId', 'integer', ['null' => true])
->addColumn('createdDt', 'datetime')
->addColumn('modifiedDt', 'datetime')
->addColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('duration', 'integer', ['default' => 0])
->addColumn('requiresDurationUpdate', 'integer', ['default' => 0, 'limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY])
->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ class MediaTableEditedIdIndexMigration extends AbstractMigration
*/
public function change()
{
$this->execute('UPDATE `media` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `media` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$table = $this->table('media');
$table
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addIndex('editedMediaId')
->update();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ public function change()
{
$table = $this->table('playlist');

$this->execute('UPDATE `playlist` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `playlist` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$table
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('isDynamic', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 0])
->addColumn('filterMediaName', 'string', ['limit' => 255, 'null' => true, 'default' => null])
->addColumn('filterMediaTags', 'string', ['limit' => 255, 'null' => true, 'default' => null])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ public function change()
// We must ensure that the IDs are added as we expect (don't rely on auto_increment)
$this->execute('INSERT INTO `status` (`id`, `status`) VALUES (1, \'Published\'), (2, \'Draft\'), (3, \'Pending Approval\')');

$this->execute('UPDATE `layout` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `layout` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

// Add a reference to the Layout and Playlist tables for "parentId"
$layout = $this->table('layout');
$layout
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('parentId', 'integer', ['default' => null, 'null' => true])
->addColumn('publishedStatusId', 'integer', ['default' => 1])
->addForeignKey('publishedStatusId', 'status')
Expand Down
5 changes: 5 additions & 0 deletions db/migrations/20190214102508_add_layout_enable_stat.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class AddLayoutEnableStat extends AbstractMigration
/** @inheritdoc */
public function change()
{
$this->execute('UPDATE `layout` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `layout` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$table = $this->table('layout');
$table
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('enableStat', 'integer', ['null' => true])
->save();
}
Expand Down
5 changes: 5 additions & 0 deletions db/migrations/20190214102516_add_media_enable_stat.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class AddMediaEnableStat extends AbstractMigration
/** @inheritdoc */
public function change()
{
$this->execute('UPDATE `media` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `media` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$table = $this->table('media');
$table
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('enableStat', 'string', ['null' => true])
->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ public function change()
$layoutTable = $this->table('layout');

if (!$layoutTable->hasColumn('publishedDate')) {
$this->execute('UPDATE `layout` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `layout` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$layoutTable
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('publishedDate', 'datetime', ['null' => true, 'default' => null])
->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function change()
$table = $this->table('layouthistory', ['id' => 'layoutHistoryId']);
$table->addColumn('campaignId', 'integer')
->addColumn('layoutId', 'integer')
->addColumn('publishedDate', 'datetime')
->addColumn('publishedDate', 'datetime', ['null' => true, 'default' => null])
->addForeignKey('campaignId', 'campaign', 'campaignId')
->create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class PlaylistDurationUpdateAtTimestamp extends AbstractMigration
/** @inheritDoc */
public function change()
{
$this->execute('UPDATE `playlist` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `playlist` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$table = $this->table('playlist');
$table
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('requiresDurationUpdate', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_REGULAR, 'default' => 0, 'null' => false])
->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ public function change()
$playlistTable = $this->table('playlist');

if (!$playlistTable->hasColumn('enableStat')) {
$this->execute('UPDATE `playlist` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `playlist` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$playlistTable
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('enableStat', 'string', ['null' => true])
->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ public function change()

// Add a new column to Layout table - autoApplyTransitions
if (!$layoutTable->hasColumn('autoApplyTransitions')) {
$this->execute('UPDATE `layout` SET createdDt = \'1970-01-01 00:00:00\' WHERE createdDt < \'2000-01-01\'');
$this->execute('UPDATE `layout` SET modifiedDt = \'1970-01-01 00:00:00\' WHERE modifiedDt < \'2000-01-01\'');

$layoutTable
->changeColumn('createdDt', 'datetime', ['null' => true, 'default' => null])
->changeColumn('modifiedDt', 'datetime', ['null' => true, 'default' => null])
->addColumn('autoApplyTransitions', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'default' => 0])
->save();
}

}
}
4 changes: 4 additions & 0 deletions lib/Controller/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,10 @@ public function moveCms($displayId)
throw new InvalidArgumentException(__('Provided CMS URL is invalid'), 'newCmsUrl');
}

if (!v::stringType()->length(1, 40)->validate($newCmsAddress)) {
throw new InvalidArgumentException(__('New CMS URL can have maximum of 40 characters'), 'newCmsUrl');
}

if ($newCmsKey == '') {
throw new InvalidArgumentException(__('Provided CMS Key is invalid'), 'newCmsKey');
}
Expand Down
9 changes: 6 additions & 3 deletions lib/Controller/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,11 @@ public function bandwidthData()
if ($displayId != 0)
$SQL .= ', bandwidthtype.name AS type ';

$SQL .= ' FROM `bandwidth`
LEFT OUTER JOIN `display`
// For user with limited access, return only data for displays this user has permissions to.
$joinType = ($this->getUser()->isSuperAdmin()) ? 'LEFT OUTER JOIN' : 'INNER JOIN';

$SQL .= ' FROM `bandwidth` ' .
$joinType . ' `display`
ON display.displayid = bandwidth.displayid AND display.displayId IN (' . implode(',', $displayIds) . ') ';

if ($displayId != 0)
Expand Down Expand Up @@ -1098,7 +1101,7 @@ public function timeDisconnectedData()
}

$body .= '
GROUP BY display.display
GROUP BY display.display, display.displayId
';

// Sorting?
Expand Down
20 changes: 10 additions & 10 deletions lib/Entity/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,22 @@ public function delete($options = [])
*/
private function add()
{
// The originalFileName column has limit of 254 characters
// if the filename basename that we are about to save is still over the limit, attempt to strip query string
// we cannot make any operations directly on $this->fileName, as that might be still needed to processDownloads
$fileName = basename($this->fileName);
if (strpos(basename($fileName), '?') && $this->mediaType == 'module') {
$fileName = substr(basename($fileName), 0, strpos(basename($fileName), '?'));
}

$this->mediaId = $this->getStore()->insert('
INSERT INTO `media` (`name`, `type`, duration, originalFilename, userID, retired, moduleSystemFile, released, apiRef, valid, `createdDt`, `modifiedDt`, `enableStat`)
VALUES (:name, :type, :duration, :originalFileName, :userId, :retired, :moduleSystemFile, :released, :apiRef, :valid, :createdDt, :modifiedDt, :enableStat)
', [
'name' => $this->name,
'type' => $this->mediaType,
'duration' => $this->duration,
'originalFileName' => basename($this->fileName),
'originalFileName' => $fileName,
'userId' => $this->ownerId,
'retired' => $this->retired,
'moduleSystemFile' => (($this->moduleSystemFile) ? 1 : 0),
Expand All @@ -738,7 +746,6 @@ private function add()
'modifiedDt' => date('Y-m-d H:i:s'),
'enableStat' => $this->enableStat
]);

}

/**
Expand Down Expand Up @@ -878,20 +885,13 @@ public function saveFile()
// Resize image dimensions if threshold exceeds
$this->assessDimensions();

// If we are saving module file that has ? in the basename, make sure we remove that here and update fileName in database
// we cannot do this on queue download, as we need full url as fileName to download it in processDownloads
if (strpos(basename($this->fileName), '?') && $this->mediaType == 'module') {
$this->fileName = substr(basename($this->fileName), 0, strpos(basename($this->fileName), '?'));
}

// Update the MD5 and storedAs to suit
$this->getStore()->update('UPDATE `media` SET md5 = :md5, fileSize = :fileSize, storedAs = :storedAs, expires = :expires, released = :released, originalFileName = :originalFileName, valid = 1 WHERE mediaId = :mediaId', [
$this->getStore()->update('UPDATE `media` SET md5 = :md5, fileSize = :fileSize, storedAs = :storedAs, expires = :expires, released = :released, valid = 1 WHERE mediaId = :mediaId', [
'fileSize' => $this->fileSize,
'md5' => $this->md5,
'storedAs' => $this->storedAs,
'expires' => $this->expires,
'released' => $this->released,
'originalFileName' => basename($this->fileName),
'mediaId' => $this->mediaId
]);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Factory/ScheduleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ public function query($sortOrder = null, $filterBy = [])
WHERE 1 = 1
';

if ($this->getUser()->userTypeId != 4 && ($this->getUser()->isSuperAdmin() && $this->getUser()->showContentFrom != 2)) {
// Hide dooh Schedules from standard view.
if ($this->getUser()->showContentFrom == 1 && $this->getUser()->userTypeId != 4 && $this->getSanitizer()->getInt('disableUserCheck', $filterBy) !== 1) {
$sql .= ' AND `schedule`.userId IN (SELECT userId FROM user WHERE userTypeId <> 4) ';
}

Expand Down
12 changes: 8 additions & 4 deletions lib/Weather/DarkSkyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ private function processItemIntoDay($day, $item)
$day->temperatureEveningRound = $day->temperatureRound;

// Wind direction
foreach (self::cardinalDirections() as $dir => $angles) {
if ($day->windBearing >= $angles[0] && $day->windBearing < $angles[1]) {
$day->windDirection = $dir;
break;
if ($day->windBearing !== null && $day->windBearing !== 0) {
foreach (self::cardinalDirections() as $dir => $angles) {
if ($day->windBearing >= $angles[0] && $day->windBearing < $angles[1]) {
$day->windDirection = $dir;
break;
}
}
} else {
$day->windDirection = '--';
}

// Map icon
Expand Down
2 changes: 2 additions & 0 deletions lib/Widget/ForecastIo.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ private function makeSubstitutions($data, $source, $timezone = NULL)
// Match that in the array
if (isset($data[$replace])) {
$source = str_replace($sub, $data[$replace], $source);
} else {
$source = str_replace($sub, '', $source);
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions lib/Xmds/Soap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,17 @@ protected function doSubmitStats($serverKey, $hardwareKey, $statXml)
continue;
}

// check maximum retention period against stat date, do not record if it's older than max stat age
$maxAge = intval($this->getConfig()->getSetting('MAINTENANCE_STAT_MAXAGE'));
if ($maxAge != 0) {
$maxAgeDate = Date::now()->subDays($maxAge);

if ($todt->isBefore($maxAgeDate)) {
$this->getLog()->debug('Stat older than max retention period, skipping.');
continue;
}
}

// Important - stats will now send display entity instead of displayId
$stats = [
'type' => $type,
Expand Down
Loading

0 comments on commit 6293297

Please sign in to comment.