本文整理匯總了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;
}