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


PHP category::get_newest_version方法代码示例

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


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

示例1: renderd_gen_conf

function renderd_gen_conf() {
  global $root_path;
  global $lists_dir;

  $conf=fopen("$root_path/data/renderd.conf", "w");

  if(file_exists("$root_path/data/renderd.conf.template"))
    $template=file_get_contents("$root_path/data/renderd.conf.template");
  else
    $template=file_get_contents("$root_path/src/renderd.conf.template");
  fwrite($conf, $template);

  if(file_exists("$root_path/data/renderd.conf.local")) {
    $template=file_get_contents("$root_path/data/renderd.conf.local");
    fwrite($conf, $template);
  }

  foreach(category_list() as $f=>$tags) {
    print "check state of category '$f'\n";
    $category=new category($f);
    $cat_version=$category->get_newest_version();
    $recompile=false;

    if(!file_exists("$lists_dir/$f.renderd")) {
      $recompile=true;
    }
    else {
      $c=$category->get_renderd_config();

      if((!isset($c['VERSION']))||($cat_version!=$c['VERSION']))
	$recompile=true;
    }

    if($recompile) {
      print "  (re-)compiling $f\n";
      $category->compile();
    }

    $conf_part=file_get_contents("$lists_dir/$f.renderd");
    fwrite($conf, $conf_part);
  }

  global $renderd_files;
  if($renderd_files) foreach($renderd_files as $file) {
    if(file_exists($file)) {
      fwrite($conf, file_get_contents($file));
    }
  }
  
  $renderd=array();
  call_hooks("renderd_get_maps", &$renderd);

  foreach($renderd as $id=>$entry) {
    fwrite($conf, renderd_print_entry($id, $entry));
  }

  // generate dummy entry in renderd.conf to avoid renderd-bug
  global $data_path;
  fwrite($conf, "[dummy]\n");
  fwrite($conf, "URI=/tiles/dummy/\n");
  fwrite($conf, "XML=/home/osm/data/render_dummy.xml\n");
  fwrite($conf, "HOST=dummy.host\n");

  fclose($conf);
}
开发者ID:plepe,项目名称:OpenStreetBrowser,代码行数:65,代码来源:mcp.php

示例2: category_restore

function category_restore($id, $param=array()) {
  global $db_central;
  global $current_user;

  if(!isset($param['version']))
    return false;

  $cat=new category($id);
  $newest=$cat->get_newest_version();

  $pg_id=postgre_escape($id);
  $pg_version=postgre_escape($param['version']);
  $pg_newest=postgre_escape($newest);
  $future=uniqid();
  $pg_future=postgre_escape($future);

  // compile version tags
  $version_tags=new tags();
  $version_tags->set("user", $current_user->username);
  $version_tags->set("date", Date("c"));
  $version_tags->set("msg", "Restore version '{$param['version']}'");
  $pg_version_tags=array_to_hstore($version_tags->data());

  $sql ="begin;";
  $sql.="insert into category (select $pg_id, tags, $pg_future, Array[$pg_newest], $pg_version_tags  from category where version=$pg_version);";
  $sql.="insert into category_rule (select $pg_id, rule_id, tags, $pg_future from category_rule where version=$pg_version);";
  $sql.="delete from category_current where category_id=$pg_id;";
  $sql.="insert into category_current values ($pg_id, $pg_future, now());";
  $sql.="commit;";

  sql_query($sql, $db_central);

  return array("status"=>true, "version"=>$future);
}
开发者ID:plepe,项目名称:OpenStreetBrowser,代码行数:34,代码来源:categories.php


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