Commit bfb87111 authored by jonnybradley's avatar jonnybradley

Various notices and warning combined fixes

[bp/r65938][FIX] h5p: Prevent notices when running from CLI 
[bp/r65940][FIX] trackers: notices fixed in r65939 meant that missing files attached to tracker items were not being reported as missing, so add some feedback - this should be improved... 
[bp/r65939][FIX] various notices 
[bp/r65956][FIX] notices: Check for numeric val in sub fn 
[bp/r65957][FIX] notices: No need to clean_xml on empty data (loadXML issues a warning)
parent 1eefc0a3
......@@ -45,7 +45,7 @@ class H5P_H5PTiki implements H5PFrameworkInterface
self::$h5p_path = 'storage/public';
if ($this->getOption('cron_last_run') < time() - 86400) {
if ($this->getOption('cron_last_run') < time() - 86400 && ! empty($_SERVER['HTTP_HOST'])) {
// Cron not run in >24h, trigger it
// Determine full URL
......
......@@ -18,7 +18,9 @@ class Math_Formula_Function_Sub extends Math_Formula_Function
$out = array_shift($elements);
foreach ($elements as $element) {
$out -= $element;
if (is_numeric($element)) {
$out -= $element;
}
}
return $out;
......
......@@ -602,7 +602,15 @@ class Tracker_Field_Files extends Tracker_Field_Abstract implements Tracker_Fiel
if (! $sortOrder) { // re-order result into order they were attached
$out2 = [];
foreach ($ids as $id) {
$out2["$id"] = $out[$id];
if (isset($out[$id])) {
$out2["$id"] = $out[$id];
} else {
Feedback::warning(tr('File #%0 missing (was attached to trackerfield #%1 on item #%2)',
$id,
$this->getConfiguration('fieldId'),
$this->getItemId()
));
}
}
$out = $out2;
}
......
......@@ -4266,6 +4266,10 @@ class FileGalLib extends TikiLib
{
global $prefs;
if (empty($data)) {
return '';
}
$perms = Perms::get([
'file gallery',
$galleryId
......
......@@ -138,15 +138,15 @@ class FileMetadata
*/
private function setBestMetadata()
{
if (isset($this->typemeta['reconciled']) && count($this->typemeta['reconciled']) > 0) {
if (! empty($this->typemeta['reconciled'])) {
$this->typemeta['best'] = $this->typemeta['reconciled'];
} elseif (isset($this->typemeta['combined']) && count($this->typemeta['combined']) > 0) {
} elseif (! empty($this->typemeta['combined'])) {
$this->typemeta['best'] = $this->typemeta['combined'];
} elseif (isset($this->basicinfo) && count($this->basicinfo) > 0) {
} elseif (! empty($this->basicinfo)) {
$this->typemeta['best'] = ['basiconly' => true, 'Basic Information' =>
['File Data' => $this->basicinfo]];
} else {
$this->typemeta['best'] = false;
$this->typemeta['best'] = [];
}
}
......@@ -190,7 +190,7 @@ class FileMetadata
//add extraction time
$metarray['reconciled'][$sumtab] = $extractarray + $metarray['reconciled'][$sumtab];
}
if (is_array($metarray['combined'])) {
if (isset($metarray['combined']) && is_array($metarray['combined'])) {
$metarray['combined'] = [$sumtab => [$bheader => $metaObj->basicinfo]] + $metarray['combined'];
} else {
$metarray['combined'][$sumtab][$bheader] = $metaObj->basicinfo;
......
......@@ -265,6 +265,8 @@ class ReconcileExifIptcXmp
*/
function reconcileAllMeta($metadata)
{
$types = [];
//check which metadata types exist
foreach ($this->alltypes as $alltype => $val) {
if ($metadata[$alltype] !== false) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment