diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 063b62771..542bb4ca2 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -1409,7 +1409,8 @@ class e_media $newpath = $this->checkFileExtension($newpath, $img_data['media_type']); - if(!rename($oldpath, $newpath)) // e_MEDIA.$newpath was working before. + + if(!is_file($oldpath) || !rename($oldpath, $newpath)) // e_MEDIA.$newpath was working before. { $this->log("Couldn't move file from ".realpath($oldpath)." to ".e_MEDIA.$newpath); $mes->add("Couldn't move file from ".$oldpath." to ".$newpath, E_MESSAGE_ERROR); @@ -1432,7 +1433,7 @@ class e_media { $mes->add("Importing Media: ".$file, E_MESSAGE_SUCCESS); $this->log("Importing Media: ".$file." successful"); - return $img_data['media_url']; + return $img_data['media_url']; } else { @@ -1458,7 +1459,7 @@ class e_media return "_icon_svg"; } - $sizes = array(16,32,48,64); + $sizes = array(16,32,48,64,128); $dimensions = $img['media_dimensions']; diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 3a3faab48..0bf46dd35 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -1956,6 +1956,44 @@ class e107plugin } + /** + * @TODO @see https://github.com/e107inc/e107/issues/5295 + * @param $function + * @param $folder + * @param $tag + * @return array + */ + public function XmlAdminIcons($function, $folder, $tag) + { + $this->log("Running ".__FUNCTION__); + + $iconTypes = ['icon', 'iconSmall', 'icon128']; + $ret = []; + + if($function === 'install' || $function === 'update') + { + foreach ($tag['link'] as $link) + { + $attrib = $link['@attributes']; + + foreach($iconTypes as $key) + { + if(!empty($attrib[$key]) && str_ends_with($attrib[$key], '.png')) + { + $path = e_PLUGIN.$folder."/".$attrib[$key]; + $file = basename($path); + + } + + } + + } + } + + return $ret; + + } + /** * Returns details of a plugin from the plugin table from it's ID * @deprecated @@ -3004,6 +3042,7 @@ class e107plugin if (varset($plug_vars['adminLinks'])) { $this->XmlAdminLinks($function, $plug_vars['adminLinks']); + // $this->XmlAdminIcons($function, $plug_vars['adminLinks']); // @TODO } if (!empty($plug_vars['siteLinks'])) diff --git a/e107_tests/tests/unit/e107pluginTest.php b/e107_tests/tests/unit/e107pluginTest.php index e611ffd4f..fbda95899 100644 --- a/e107_tests/tests/unit/e107pluginTest.php +++ b/e107_tests/tests/unit/e107pluginTest.php @@ -240,6 +240,26 @@ } */ +/* + public function testXmlAdminIcons() + { + $plugin = e107::getPlug(); + $installed = $plugin->getInstalled(); + fwrite(STDERR, print_r($installed, true)); + + if(!$data = $plugin->load('_blank')->getMeta()) + { + $this::fail("Couldn't load plugin meta"); + } + + $this::assertNotEmpty($data['adminLinks']); + + $status = $this->ep->XmlAdminIcons('install', '_blank', $data['adminLinks']); + + fwrite(STDERR, print_r($status, true)); + } +*/ + public function testXmlSiteLinks() { $plugVars = array (