Exemplo n.º 1
0
 private static function upgradeModuleStep(GWF_Module $module, $version)
 {
     GWF_Log::logInstall(sprintf('Upgrading module %s to v%.02f.', $module->getName(), $version));
     $name = $module->getName();
     $vstr = str_replace('.', '_', sprintf('%.02f', $version));
     $path = sprintf('%smodule/%s/Upgrade_%s_%s.php', GWF_CORE_PATH, $name, $name, $vstr);
     if (Common::isFile($path)) {
         require_once $path;
         $func = sprintf('Upgrade_%s_%s', $name, $vstr);
         if (!function_exists($func)) {
             return GWF_HTML::err('ERR_METHOD_MISSING', array($func, $module->display('module_name')));
         }
         $result = call_user_func($func, $module);
         if ($result === true || $result === '' || $result === NULL) {
         } else {
             return $result;
         }
     }
     if (false === $module->saveVar('module_version', $version)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $msg = sprintf('Upgraded module %s to version %.02f.', $module->getName(), $version);
     GWF_Log::logInstall($msg);
     echo GWF_HTML::message('GWF', $msg);
     return '';
 }