Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'ymettier/master' into master

  • Loading branch information...
commit e9e9e8d8c3fd25eaa9ad259de48f029e8a6df803 2 parents 1aafd57 + 6cd5c89
@ymettier ymettier authored
View
8 bin/aggregator
@@ -49,13 +49,15 @@ $conf .= " <aggregator>
}
}
-file_put_contents('etc/aggregator.conf.tmp', $conf);
+$localconf = file_exists('etc/aggregator.local.conf') ? file_get_contents('etc/aggregator.local.conf') : '';
$oldconf = file_exists('etc/aggregator.conf') ? file_get_contents('etc/aggregator.conf') : '';
+if($localconf) {
+ $conf .= $localconf;
+}
if ($oldconf != $conf) {
+ file_put_contents('etc/aggregator.conf.tmp', $conf);
rename('etc/aggregator.conf.tmp', 'etc/aggregator.conf');
echo "etc/aggregator.conf updated\n";
-} else {
- unlink('etc/aggregator.conf.tmp');
}
?>
View
8 bin/get_all_children_path
@@ -0,0 +1,8 @@
+#!/usr/bin/php
+<?php
+require 'lib/common.php';
+$jstree = new json_tree();
+foreach ($jstree->_get_children($argv[1], true, "root") as $k => $v) {
+ print $v['_path_']."\n";
+}
+?>
View
7 lib/class.tree.php
@@ -57,17 +57,17 @@ function _get_node($id) {
$this->db->nextr();
return $this->db->nf() === 0 ? false : $this->db->get_row("assoc");
}
- function _get_children($id, $recursive = false) {
+ function _get_children($id, $recursive = false, $path = "") {
global $childrens_cache;
if(is_array($childrens_cache) && isset($childrens_cache[$id.($recursive ? 'recursive' : 'notrecursive')])) {
return $childrens_cache[$id];
}
$childrens = array();
if($recursive) {
- $childrens = $this->_get_children($id);
+ $childrens = $this->_get_children($id, false, $path);
foreach($childrens as $cid => $cdata) {
if ( $cdata['type'] != 'default') {
- foreach($this->_get_children($cdata['id'], true) as $cid2 => $cdata2) {
+ foreach($this->_get_children($cdata['id'], true, $cdata['_path_']) as $cid2 => $cdata2) {
$childrens[$cdata2['type'] == 'default' ? $cdata2['title'] : 'aggregator_'.$cdata2['id']] = $cdata2;
}
}
@@ -78,6 +78,7 @@ function _get_children($id, $recursive = false) {
$this->db->query("SELECT `".implode("` , `", $this->fields)."` FROM `".$this->table."` WHERE `".$this->fields["parent_id"]."` = ".(int) $id." ORDER BY `".$this->fields[$sort]."` ASC");
while($this->db->nextr()) {
$tmp = $this->db->get_row("assoc");
+ $tmp["_path_"] = $path." -> ".$tmp['title'];
$childrens[$tmp['type'] == 'default' ? $tmp['title'] : 'aggregator_'.$tmp['id']] = $tmp;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.