当前位置: 首页>>代码示例>>PHP>>正文


PHP search::update方法代码示例

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


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

示例1: activate

 static function activate() {
   // Update the root item.  This is a quick hack because the search module is activated as part
   // of the official install, so this way we don't start off with a "your index is out of date"
   // banner.
   search::update(model_cache::get("item", 1));
   search::check_index();
 }
开发者ID:HelixiR,项目名称:gallery3,代码行数:7,代码来源:search_installer.php

示例2: update_index

 static function update_index($task)
 {
     try {
         $completed = $task->get("completed", 0);
         $start = microtime(true);
         foreach (ORM::factory("item")->join("search_records", "items.id", "search_records.item_id", "left")->where("search_records.item_id", "IS", null)->or_where("search_records.dirty", "=", 1)->find_all(100) as $item) {
             // The query above can take a long time, so start the timer after its done
             // to give ourselves a little time to actually process rows.
             if (!isset($start)) {
                 $start = microtime(true);
             }
             search::update($item);
             $completed++;
             if (microtime(true) - $start > 0.75) {
                 break;
             }
         }
         list($remaining, $total, $percent) = search::stats();
         $task->set("completed", $completed);
         if ($remaining == 0 || !($remaining + $completed)) {
             $task->done = true;
             $task->state = "success";
             site_status::clear("search_index_out_of_date");
             $task->percent_complete = 100;
         } else {
             $task->percent_complete = round(100 * $completed / ($remaining + $completed));
         }
         $task->status = t2("one record updated, index is %percent% up-to-date", "%count records updated, index is %percent% up-to-date", $completed, array("percent" => $percent));
     } catch (Exception $e) {
         $task->done = true;
         $task->state = "error";
         $task->status = $e->getMessage();
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:34,代码来源:search_task.php

示例3: update_index

 static function update_index($task)
 {
     try {
         $completed = $task->get("completed", 0);
         $start = microtime(true);
         foreach (ORM::factory("item")->join("search_records", "items.id", "search_records.item_id", "left")->where("search_records.item_id", null)->orwhere("search_records.dirty", 1)->find_all() as $item) {
             if (microtime(true) - $start > 1.5) {
                 break;
             }
             search::update($item);
             $completed++;
         }
         list($remaining, $total, $percent) = search::stats();
         $task->set("completed", $completed);
         if ($remaining == 0 || !($remaining + $completed)) {
             $task->done = true;
             $task->state = "success";
             site_status::clear("search_index_out_of_date");
             $task->percent_complete = 100;
         } else {
             $task->percent_complete = round(100 * $completed / ($remaining + $completed));
         }
         $task->status = t2("one record updated, index is %percent% up-to-date", "%count records updated, index is %percent% up-to-date", $completed, array("percent" => $percent));
     } catch (Exception $e) {
         $task->done = true;
         $task->state = "error";
         $task->status = $e->getMessage();
     }
 }
开发者ID:shai,项目名称:gallery3,代码行数:29,代码来源:search_task.php

示例4: item_related_update

 static function item_related_update($item)
 {
     search::update($item);
 }
开发者ID:jhilden,项目名称:gallery3,代码行数:4,代码来源:search_event.php


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