• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Task类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Task的典型用法代码示例。如果您正苦于以下问题:PHP Task类的具体用法?PHP Task怎么用?PHP Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Task类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: add

 public function add(Task $task)
 {
     if (!$this->hasUniqueTaskName($task->name())) {
         throw new Exception(sprintf('Task name (%s) is not unique!', $task->name()));
     }
     $this->tasks[] = $task;
 }
开发者ID:adrianpietka,项目名称:kava,代码行数:7,代码来源:Tasks.php


示例2: testIsRunning

 public function testIsRunning()
 {
     $task = new Task(['exec' => 'sleep 1']);
     $this->assertFalse($task->isRunning());
     $task->run();
     $this->assertTrue($task->isRunning());
 }
开发者ID:SubZtep,项目名称:php-cron,代码行数:7,代码来源:TaskTest.php


示例3: process

 public function process(Task $task = null)
 {
     if (empty($task)) {
         $task = new Task($this->path, $this->filename, $this->extension, $this->config['public_path']);
     }
     // Can we read the original file and write in the original path?
     if (!$task->isValid()) {
         return $this->halt();
     }
     // Can we operate in this path?
     if (!preg_match($this->config['path_mask'], trim(str_replace($this->config['public_path'], '', $task->origPath), DIRECTORY_SEPARATOR))) {
         return $this->halt();
     }
     // Is a valid task name and can we call the action?
     $callable = $this->getActionCallable($task->name);
     if ($callable === false) {
         return $this->halt();
     } else {
         $task->image = \WideImage\WideImage::load($task->origFile);
         // Create destination path
         if (!file_exists($task->destPath) and !is_dir($task->destPath)) {
             @mkdir($task->destPath, 0775, true);
         }
         if (call_user_func($callable, $task) !== false) {
             // If the action does not return false explicitly...
             $this->reload();
             // SUCCESS exit point: reload the image URL
         }
     }
     $this->halt();
 }
开发者ID:rperello,项目名称:picnic,代码行数:31,代码来源:Server.php


示例4: run

 public function run()
 {
     $this->db->query("UPDATE " . DB_PREFIX . "customer c \r\n        SET congrats = 1 \r\n        WHERE DAY(birthday) <> '" . $this->db->escape(date('d')) . "' \r\n        AND MONTH(birthday) <> '" . $this->db->escape(date('m')) . "'");
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer c \r\n        WHERE DAY(birthday) = '" . $this->db->escape(date('d')) . "' \r\n        AND MONTH(birthday) = '" . $this->db->escape(date('m')) . "'\r\n        AND congrats = 1");
     if ($query->num_rows && (int) $this->config->get('marketing_email_happy_birthday')) {
         $params = array('job' => 'send_birthday', 'newsletter_id' => (int) $this->config->get('marketing_email_happy_birthday'));
         $this->load->library('task');
         $task = new Task($this->registry);
         $task->object_id = (int) $this->config->get('marketing_email_happy_birthday');
         $task->object_type = 'newsletter';
         $task->task = 'happy_birthday';
         $task->type = 'send';
         $task->time_exec = date('Y-m-d') . ' 08:00:00';
         $task->params = $params;
         $task->time_interval = "";
         $task->time_last_exec = "";
         $task->run_once = true;
         $task->status = 1;
         $task->date_start_exec = date('Y-m-d') . ' 08:00:00';
         $task->date_end_exec = date('Y-m-d') . ' 23:00:00';
         foreach ($query->rows as $customer) {
             $params = array('customer_id' => $customer['customer_id'], 'fullname' => $customer['firstname'] . " " . $customer['lastname'], 'company' => $customer['company'], 'rif' => $customer['rif'], 'telephone' => $customer['telephone'], 'email' => $customer['email']);
             $queue = array("params" => $params, "status" => 1, "time_exec" => date('Y-m-d') . ' 08:00:00');
             $task->addQueue($queue);
             $this->db->query("UPDATE " . DB_PREFIX . "customer c SET congrats = 0 WHERE customer_id = '" . (int) $customer['customer_id'] . "'");
         }
         $task->createSendTask();
     }
 }
开发者ID:josueaponte7,项目名称:necotienda_standalone,代码行数:29,代码来源:birthday.php


示例5: __construct

 /**
  * Constructs the entity
  * 
  * @access public
  * @param \Zepi\Core\Utils\Entity\Task $task
  * @param integer $pid
  */
 public function __construct(Task $task, $pid)
 {
     $this->task = $task;
     $this->pid = $pid;
     $this->startTime = time();
     $this->restartTime = time() + $task->getResetTime() + rand(1, 5);
 }
开发者ID:zepi,项目名称:turbo-base,代码行数:14,代码来源:Process.php


示例6: get

 function get($criteria = null, $order = null)
 {
     $sql = "SELECT tasks.*, CONCAT(users.first_name, ' ', users.last_name) AS assigned_to_name\n                FROM tasks\n                LEFT JOIN users ON users.id = tasks.assigned_to";
     if (isset($criteria) && is_numeric($criteria)) {
         $sql .= " WHERE tasks.id = {$criteria}";
         $task = parent::get_one($sql);
         $this->update_status();
         return $task;
     } else {
         $sql = $this->add_criteria($sql, $criteria);
         $sql = $this->modify_sql_for_user_type($sql);
         $sql = $this->add_order_by($sql, $order);
         $tasks = parent::get($sql);
         foreach ($tasks as &$task) {
             //create the invoice
             $task_object = new Task($task);
             //todo: i don't think this makes any sense because the invoice status will already be updated when I create the invoice using new Invoice
             //store the current task status as it exists in the database
             $old_status = $task_object->status_text;
             //update the task status
             $task_object->update_status();
             //if the old status and the new status do not match, then we need to save this task back to the database.
             if ($old_status != (string) $task_object->status_text) {
                 //todo:make sure this isn't saving each time
                 $task_object->save(false);
             }
             //we need to add the status text back the task array, since we're sending the array to the client,
             //not the object
             $task['status_text'] = $task_object->status_text;
         }
         return $tasks;
     }
 }
开发者ID:neevan1e,项目名称:Done,代码行数:33,代码来源:task.php


示例7: view

 function view($id = null)
 {
     if (is_null($id)) {
         echo "error: no id supplied";
         return false;
     }
     $this->load->library('bitly');
     $this->form_validation->set_rules('name', 'Task Name', 'required|trim');
     $data = array();
     $docket = new Docket();
     $task = new Task();
     $user = new User();
     if (!$docket->where('shared', 1)->where('id', $id)->count()) {
         redirect('dockets');
     } else {
         $data['docket'] = $docket->get_by_id($id);
     }
     if ($docket->short_url == '') {
         $docket->short_url = $this->bitly->shorten(base_url() . 'index.php/pub/view/' . $docket->id);
         $docket->save();
     }
     if ($task->where('completed', 0)->where_related_docket('id', $docket->id)->count() == 0) {
         $data['pending_tasks'] = array();
     } else {
         $data['pending_tasks'] = $task->where('completed', 0)->where_related_docket('id', $docket->id)->get()->all;
     }
     if ($task->where('completed', 1)->where_related_docket('id', $docket->id)->count() == 0) {
         $data['completed_tasks'] = array();
     } else {
         $data['completed_tasks'] = $task->where('completed', 1)->where_related_docket('id', $docket->id)->get()->all;
     }
     $data['user'] = $user->get_by_id($docket->user_id);
     $this->load->view('pub/view', $data);
 }
开发者ID:narendranag,项目名称:dockets,代码行数:34,代码来源:pub.php


示例8: find

 public function find($id)
 {
     $events = $this->eventStore->find($id);
     $task = new Task();
     $task->replay($events);
     return $task;
 }
开发者ID:QafooLabs,项目名称:symfony-testing2,代码行数:7,代码来源:Repository.php


示例9: load

 public function load($clusterName)
 {
     $result = $this->awsClient->listTasks(['cluster' => $clusterName, 'serviceName' => $this->serviceName, 'maxResults' => 99, 'nextToken' => '']);
     //get existing tasks
     foreach ($result['taskArns'] as $taskArn) {
         $task = new Task();
         $task->setArn($taskArn);
         if (!$task->init($this->creds)) {
             return false;
         }
         if (!$task->load($clusterName)) {
             return false;
         }
         $this->tasks[$taskArn] = $task;
     }
     //get task def
     $details = $this->awsClient->describeServices(['cluster' => $clusterName, 'services' => [$this->serviceName]]);
     $this->taskDefinition = $details['services'][0]['taskDefinition'];
     $this->taskDef = new TaskDef();
     $this->taskDef->init($this->creds);
     $this->taskDef->load($this->taskDefinition);
     //other service items
     $this->status = $details['services'][0]['status'];
     $this->minHealthyPercent = $details['services'][0]['deploymentConfiguration']['minimumHealthyPercent'];
     $this->maxPercent = $details['services'][0]['deploymentConfiguration']['maximumPercent'];
     $this->desiredTaskCount = $details['services'][0]['desiredCount'];
     $this->pendingTaskCount = $details['services'][0]['pendingCount'];
     $this->runningTaskCount = $details['services'][0]['runningCount'];
     return true;
 }
开发者ID:cablelabs,项目名称:aws-php,代码行数:30,代码来源:Service.php


示例10: delete

 function delete()
 {
     $delete_result = parent::delete();
     $task = new Task($this->task_id);
     $task->update_total_time();
     return $delete_result;
 }
开发者ID:neevan1e,项目名称:Done,代码行数:7,代码来源:timeentry.php


示例11: createtask_POST

function createtask_POST(Web &$w)
{
    $w->Task->navigation($w, "Create Task");
    // unserialise input from step I and store in array: arr_req
    $arr_req = unserialize($w->request('formone'));
    // set relevant dt variables with: Today.
    $arr_req['dt_assigned'] = Date('c');
    $arr_req['dt_first_assigned'] = Date('c');
    // insert Task into database
    $task = new Task($w);
    $task->fill($arr_req);
    $task->insert();
    // if insert is successful, store additional fields as task data
    // we do not want to store data from step I, the task_id (as a key=>value pair) nor the FLOW_SID
    if ($task->id) {
        foreach ($_POST as $name => $value) {
            if ($name != "formone" && $name != "FLOW_SID" && $name != "task_id" && $name !== CSRF::getTokenID()) {
                $tdata = new TaskData($w);
                $arr = array("task_id" => $task->id, "key" => $name, "value" => $value);
                $tdata->fill($arr);
                $tdata->insert();
                unset($arr);
            }
        }
        // return to task dashboard
        $w->msg("Task " . $task->title . " added", "/task/viewtask/" . $task->id);
    } else {
        // if task insert was unsuccessful, say as much
        $w->msg("The Task could not be created. Please inform the IT Group", "/task/index/");
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:31,代码来源:createtask.php


示例12: after

 public function after()
 {
     echo "after\n";
     $insert = 0;
     // 判断是否插入表
     $class_name = get_class($this);
     $type = str_replace('Event', '', $class_name);
     $task = new Task();
     if ($this->event_rs['err_no'] > 0) {
         //  代表错误
         $task->is_success = 0;
         $this->event_rs['class'] = $this->class;
         $this->event_rs['param'] = $this->param;
         if ($this->retry_cnt >= 3) {
             $insert = 1;
         }
     } else {
         $task->is_success = 1;
         $insert = 1;
     }
     // 成功则入库 第一次失败则不入库 第三次失败才一起入库
     $task->create_time = time();
     $task->retry_cnt = $this->retry_cnt;
     $task->event = $type;
     $task->param = json_encode($this->param);
     if ($insert > 0) {
         $task->save();
     }
     $this->event_rs['retry_cnt'] = $this->retry_cnt;
 }
开发者ID:hytzxd,项目名称:swoole-doc,代码行数:30,代码来源:EventBase.php


示例13: addTask

 /**
  * Proxies task adding.
  *
  * @param      Task The task that is being added.
  *
  * @author     Noah Fontes <[email protected]>
  * @since      1.0.0
  */
 public function addTask(Task $task)
 {
     if ($this->target === null) {
         throw new BuildException('Tasks can not be added to a proxy target without a concrete target');
     }
     $task->setOwningTarget($this->target);
     $this->target->addTask($task);
 }
开发者ID:horros,项目名称:agavi,代码行数:16,代码来源:AgaviProxyTarget.class.php


示例14: smarty_function_task

/**
 * get task information for the specified task
 */
function smarty_function_task($params, &$smarty)
{
    $t = new Task();
    if (!Check::digits($params['task_id'], $empty = false)) {
        return;
    }
    $smarty->assign('task', $t->getone($params['task_id']));
}
开发者ID:Maharaja1,项目名称:drdata,代码行数:11,代码来源:function.task.php


示例15: smarty_function_forms

/**
 * take our raw form data and make a data structure out of it
 * that can be used in templates
 */
function smarty_function_forms($params, &$smarty)
{
    if (!Check::digits($params['task_id'], $empty = false)) {
        return;
    }
    $t = new Task();
    $smarty->assign('forms', $t->parseforms($params['task_id']));
}
开发者ID:Maharaja1,项目名称:drdata,代码行数:12,代码来源:function.forms.php


示例16: eventAjaxTaskCategoryDelete

 function eventAjaxTaskCategoryDelete(EventControler $evctl)
 {
     $this->getId($evctl->id);
     $this->delete();
     $update_task_category = new Task();
     $update_task_category->updateTaskCategory($evctl->id);
     $evctl->addOutputValue('ok');
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:8,代码来源:TaskCategory.class.php


示例17: runTask

 protected function runTask(Project $project, Task $task)
 {
     // Add if the client has not already done so
     if (!$task->getProject()) {
         $task->setProject($project);
     }
     $task->main();
 }
开发者ID:halfer,项目名称:Meshing,代码行数:8,代码来源:Task.php


示例18: addTask

 public function addTask()
 {
     $projectId = $this->request_stack["arguments"][0];
     $task = new Task();
     $taskId = $task->setProject(ProjectQuery::create()->findOneById($projectId))->setEmployee(EmployeeQuery::create()->findOneById((new Cookie())->get("employee_id")))->save();
     $redirect = new Request();
     $redirect->redirect("task", "edit", array("id" => $task->getId()));
 }
开发者ID:xama5,项目名称:uver-erp,代码行数:8,代码来源:Router.php


示例19: __construct

 /**
  * @param Task|object $proxy
  * @param mixed $elementTag The element to wrap.
  */
 public function __construct($proxy, $elementTag)
 {
     $this->wrappedObject = $proxy;
     $this->elementTag = $elementTag;
     if ($proxy instanceof Task) {
         $proxy->setRuntimeConfigurableWrapper($this);
     }
 }
开发者ID:codebubb,项目名称:web_ssh,代码行数:12,代码来源:RuntimeConfigurable.php


示例20: dotaskadd

 function dotaskadd($data, $form)
 {
     $submission = new Task();
     $submission->write();
     $form->saveInto($submission);
     $submission->write();
     Controller::curr()->redirectBack();
 }
开发者ID:micschk,项目名称:SilverProject,代码行数:8,代码来源:addTaskPage.php



注:本文中的Task类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TaskPeer类代码示例发布时间:2022-05-23
下一篇:
PHP Taobao_RequestCheckUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap