本文整理汇总了PHP中module::deactivate_missing_modules方法的典型用法代码示例。如果您正苦于以下问题:PHP module::deactivate_missing_modules方法的具体用法?PHP module::deactivate_missing_modules怎么用?PHP module::deactivate_missing_modules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::deactivate_missing_modules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 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();
}
示例2: get_obsolete_modules_message
/**
* 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;
}