65 #11 $cf['contents']['tree'] = memcacheRead( $cf['memcache']['connection'], CONTENTS_TREE_KEY ); 66 #11 $cf['contents']['index'] = memcacheRead( $cf['memcache']['connection'], CONTENTS_INDEX_KEY ); 67 #11 $cf['contents']['shortcuts'] = memcacheRead( $cf['memcache']['connection'], CONTENTS_SHORTCUTS_KEY ); 77 #11 if( $cf['contents']['tree'] === false || $cf['contents']['index'] === false || $cf['contents']['shortcuts'] === false || defined( 'MEMCACHE_REFRESH' ) ) { 78 if(
$cf[
'contents'][
'cached'] ===
false || defined(
'MEMCACHE_REFRESH' ) ) {
81 $cf[
'contents'][
'tree'] = array();
84 $cf[
'contents'][
'index'] = array();
87 $cf[
'contents'][
'shortcuts'] = array();
90 foreach(
$cf[
'contents'][
'pages'] as
$k => &$v ) {
97 if( isset( $v[
'parent'] ) && is_array( $v[
'parent'] ) && array_key_exists(
'id', $v[
'parent'] ) ) {
99 # echo $v['id'].PHP_EOL; 102 if( ! isset(
$cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ] ) ) { $v[
'parent'][
'id'] = NULL; }
105 $v[
'tree'] = array(
$k => array() );
108 if( isset( $v[
'parent'][
'id'] ) ) {
109 $cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ][
'children'][
'id'][] =
$k;
113 if( isset( $v[
'short'] ) && ! empty( $v[
'short'] ) ) {
114 # print_r( $v['short'] ); 115 foreach( $v[
'short'] as $short ) {
116 if( ! empty( $short ) ) {
118 $cf[
'contents'][
'shortcuts'][ $short ] = $v[
'id'];
121 #X } elseif( isset( $v['forced'] ) && ! empty( $v['forced'] ) ) { 137 foreach(
$cf[
'localization'][
'languages'] as
$lk => $lv ) {
140 if( ! isset( $v[
'title'][
$lk ] ) ) { $v[
'title'][
$lk ] = NULL; }
141 if( ! isset( $v[
'h1'][ $lk ] ) ) { $v[
'h1'][
$lk ] = NULL; }
144 if( ! isset( $v[
'rewrited'] ) || ! is_array( $v[
'rewrited'] ) || ! array_key_exists( $lk, $v[
'rewrited'] ) ) {
146 ( isset( $v[
'custom'][ $lk ] ) && ! empty( $v[
'custom'][ $lk ] ) )
155 $cf[
'contents'][
'index'][
$lk ][ $v[
'rewrited'][
$lk ] ][] =
$k;
167 logWrite(
'la pagina ' .
$k .
' è malformata e blocca la costruzione della struttura',
'pages', LOG_EMERG );
170 die(
'PAGINA MALFORMATA: ' .
$k .
' -> ' . print_r( $v,
true ) );
184 foreach(
$cf[
'contents'][
'pages'] as
$k => &$v ) {
191 if( isset( $v[
'menu'] ) && is_array( $v[
'menu'] ) ) {
192 $menu = array_keys( $v[
'menu'] );
198 $k =
$cf[
'contents'][
'pages'][
$k ][
'parent'][
'id'];
199 $v[
'tree'] = array(
$k => $v[
'tree'] );
200 $v[
'parents'][
'id'][] =
$k;
201 $v[
'parents'][
'h1'][] =
$cf[
'contents'][
'pages'][
$k ][
'h1'];
202 $v[
'parents'][
'title'][] =
$cf[
'contents'][
'pages'][
$k ][
'title'];
203 $v[
'parents'][
'rewrited'][] =
$cf[
'contents'][
'pages'][
$k ][
'rewrited'];
204 if( isset(
$cf[
'contents'][
'pages'][
$k ][
'menu'] ) && is_array(
$cf[
'contents'][
'pages'][ $k ][
'menu'] ) ) {
205 $parentMenu = array_keys(
$cf[
'contents'][
'pages'][ $k ][
'menu'] );
207 $parentMenu = array();
214 if( is_array( $menu ) && is_array( $parentMenu ) ) {
215 foreach( array_diff( $menu, $parentMenu ) as $manca ) {
216 $cf[
'contents'][
'pages'][
$k ][
'menu'][ $manca ] = array(
222 }
while( $k !== NULL );
225 $v[
'parents'][
'id'] = array_reverse( $v[
'parents'][
'id'] );
226 $v[
'parents'][
'h1'] = array_reverse( $v[
'parents'][
'h1'] );
227 $v[
'parents'][
'title'] = array_reverse( $v[
'parents'][
'title'] );
228 $v[
'parents'][
'rewrited'] = array_reverse( $v[
'parents'][
'rewrited'] );
231 $v[
'parents'][
'id'][] = $v[
'id'];
232 $v[
'parents'][
'h1'][] = $v[
'h1'];
233 $v[
'parents'][
'title'][] = $v[
'title'];
234 $v[
'parents'][
'rewrited'][] = $v[
'rewrited'];
237 $v[
'parent'][
'title'] =
$cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ][
'title'];
238 $v[
'parent'][
'h1'] =
$cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ][
'h1'];
239 $v[
'parent'][
'rewrited'] =
$cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ][
'rewrited'];
251 foreach(
$cf[
'contents'][
'pages'] as $k => &$v ) {
254 foreach(
$cf[
'localization'][
'languages'] as $lk => $lv ) {
257 $col = array_column( $v[
'parents'][
'rewrited'], $lk );
263 $path = implode(
'/', $tcol ) . ( ( ! empty( $tcol ) ) ?
'.' . $lk .
'.html' : NULL );
266 if( isset( $v[
'forced'][ $lk ] ) ) {
267 $v[
'path'][
$lk ] = NULL;
273 if( isset( $v[
'forced'][ $lk ] ) ) {
274 $v[
'url'][
$lk ] = $v[
'forced'][
$lk ];
279 #L $v['url'][ $lk ] = $cf['site']['url'][ $lk ] . $path; 285 $cf[
'contents'][
'tree'] = array_replace_recursive(
$cf[
'contents'][
'tree'], $v[
'tree'] );
290 foreach(
$cf[
'contents'][
'pages'] as $k => &$v ) {
294 $k =
$cf[
'contents'][
'pages'][
$k ][
'parent'][
'id'];
295 $v[
'parents'][
'path'][] =
$cf[
'contents'][
'pages'][
$k ][
'path'];
296 }
while( $k !== NULL );
299 $v[
'parents'][
'path'] = array_reverse( $v[
'parents'][
'path'] );
302 $v[
'parents'][
'path'][] = $v[
'path'];
305 $v[
'parent'][
'path'] =
$cf[
'contents'][
'pages'][ $v[
'parent'][
'id'] ][
'path'];
310 #11 memcacheWrite( $cf['memcache']['connection'], CONTENTS_TREE_KEY, $cf['contents']['tree'] ); 311 #11 memcacheWrite( $cf['memcache']['connection'], CONTENTS_INDEX_KEY, $cf['contents']['index'] ); 312 #11 memcacheWrite( $cf['memcache']['connection'], CONTENTS_SHORTCUTS_KEY, $cf['contents']['shortcuts'] ); 313 # memcacheWrite( $cf['memcache']['connection'], CONTENTS_PAGES_KEY, $cf['contents']['pages'] ); 314 #11 $cf['pages']['cacheable'] = true; 318 # // lettura delle pagine dalla cache 319 # $cf['contents']['pages'] = memcacheRead( $cf['memcache']['connection'], CONTENTS_PAGES_KEY ); 320 #11 $cf['pages']['cacheable'] = false; 323 #11 logWrite( 'contents (pages, tree e index) letti dalla cache', 'memcache', LOG_INFO ); 326 timerCheck(
$cf[
'speed'],
' -> fine generazione dei path dei parent' );
logWrite( $m, $f='site', $l=LOG_NOTICE, $d=DIRECTORY_LOG, $t=CURRENT_LOG_LEVEL, $s=SITE_STATUS)
scrive un messaggio nei log del sito
$cf['ricerca']['template']