HEX
Server: Apache
System: Linux dev.epsylon.net 3.10.0-1160.144.1.el7.tuxcare.els2.x86_64 #1 SMP Sun Feb 15 11:22:42 UTC 2026 x86_64
User: graficav (1037)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/graficav/holatimbres.cl/modules/blockadvertising/upgrade/install-0.9.php
<?php

if (!defined('_PS_VERSION_'))
	exit;

function upgrade_module_0_9($module)
{
	$module_path = $module->getLocalPath();
	$img_folder_path = $module->getLocalPath().'img';
	$fixture_img_path = $module->getLocalPath().'img'.DIRECTORY_SEPARATOR.'fixtures';

	if (!Tools::file_exists_cache($img_folder_path))
		mkdir($img_folder_path);

	if (!Tools::file_exists_cache($fixture_img_path))
		mkdir($fixture_img_path);

	$files = scandir($module->getLocalPath());

	foreach ($files as $file)
	{
		if (strncmp($file, 'advertising', 11) == 0)
		{
			if ($file == 'advertising.jpg')
				copy($module_path.$file, $fixture_img_path.DIRECTORY_SEPARATOR.$file);
			else
				copy($module_path.$file, $img_folder_path.DIRECTORY_SEPARATOR.$file);

			unlink($module_path.$file);
		}
	}

	Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('blockadvertising.tpl'));

	return true;
}