diff options
author | shadlaws <shad@shadlaws.com> | 2013-02-20 17:30:27 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-02-20 17:30:27 +0100 |
commit | 94aadf03dadbfa01ba1744df60c97b6f3094ae88 (patch) | |
tree | 3506ae79188b69ada194d69984b9dcd9bc147b4e /modules/gallery/helpers/module.php | |
parent | 2a6896e2a51833f45cd48bca0b5048cc9633c9bd (diff) |
#2008 - Add warnings if some active modules are obsolete.
- added module::get_obsolete_modules_message function
- put message on admin/dashboard
- put message on admin/modules
- put message on upgrader
- updated unit test golden file xss_data
Diffstat (limited to 'modules/gallery/helpers/module.php')
-rw-r--r-- | modules/gallery/helpers/module.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index df258e87..d7429121 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -541,4 +541,34 @@ class module_Core { static function get_version($module_name) { return module::get($module_name)->version; } + + /** + * Check if obsolete modules are active and, if so, return a warning message. + * If none are found, return null. + */ + static function get_obsolete_modules_message() { + // This is the obsolete modules list. Any active module that's on the list + // with version number at or below the one given will be considered obsolete. + // It is hard-coded here, and may be updated with future releases of Gallery. + $obsolete_modules = array("videos" => 4, "noffmpeg" => 1, "videodimensions" => 1, + "digibug" => 2); + + $modules_found = array(); + foreach ($obsolete_modules as $module => $version) { + if (module::is_active($module) && (module::get_version($module) <= $version)) { + $modules_found[] = $module; + } + } + + if ($modules_found) { + // Need this to be on one super-long line or else the localization scanner may not work. + // (ref: http://sourceforge.net/apps/trac/gallery/ticket/1321) + return t("Recent upgrades to Gallery have made the following modules obsolete: %modules. We recommend that you <a href=\"%url_mod\">deactivate</a> the module(s). For more information, please see the <a href=\"%url_doc\">documentation page</a>.", + array("modules" => implode(", ", $modules_found), + "url_mod" => url::site("admin/modules"), + "url_doc" => "http://codex.galleryproject.org/Gallery3:User_guide:Obsolete_modules")); + } + + return null; + } } |