Example #1
0
 /**
  * Show a list of all available, running and finished tasks.
  */
 public function index()
 {
     $query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(db::expr("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
     $stalled_count = $query->count();
     if ($stalled_count) {
         log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
     }
     $view = new Admin_View("admin.html");
     $view->page_title = t("Maintenance tasks");
     $view->content = new View("admin_maintenance.html");
     $view->content->task_definitions = task::get_definitions();
     $view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
     $view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
     print $view;
     // Do some maintenance while we're in here
     db::build()->delete("caches")->where("expiration", "<>", 0)->where("expiration", "<=", time())->execute();
     module::deactivate_missing_modules();
 }
Example #2
0
 /**
  * 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);
     // Before we check the active modules, deactivate any that are missing.
     module::deactivate_missing_modules();
     $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;
 }