當前位置: 首頁>>代碼示例>>PHP>>正文


PHP task::get_definitions方法代碼示例

本文整理匯總了PHP中task::get_definitions方法的典型用法代碼示例。如果您正苦於以下問題:PHP task::get_definitions方法的具體用法?PHP task::get_definitions怎麽用?PHP task::get_definitions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在task的用法示例。


在下文中一共展示了task::get_definitions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 static function start($task_callback, $context = array())
 {
     $tasks = task::get_definitions();
     $task = task::create($tasks[$task_callback], array());
     $task->log(t("Task %task_name started (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)));
     return $task;
 }
開發者ID:kandsten,項目名稱:gallery3,代碼行數:7,代碼來源:task.php

示例2: start

 /**
  * Start a new task
  * @param string $task_callback
  */
 public function start($task_callback)
 {
     access::verify_csrf();
     $tasks = task::get_definitions();
     $task = task::create($tasks[$task_callback], array());
     $view = new View("admin_maintenance_task.html");
     $view->task = $task;
     log::info("tasks", t("Task %task_name started (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)), html::anchor(url::site("admin/maintenance"), t("maintenance")));
     print $view;
 }
開發者ID:xafr,項目名稱:gallery3,代碼行數:14,代碼來源:admin_maintenance.php

示例3: 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(new Database_Expression("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;
 }
開發者ID:andyst,項目名稱:gallery3,代碼行數:18,代碼來源:admin_maintenance.php


注:本文中的task::get_definitions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。