Changeset 12622

Show
Ignore:
Timestamp:
02/22/08 13:21:21 (11 months ago)
Author:
pottedmeat
Message:

Refs #5602. Make sure the resource tree is build properly

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/branches/dev/jsdoc/jsdoc.module

    r12621 r12622  
    367367    $files = variable_get('jsdoc_cron_files', array()); 
    368368    if (!empty($files)) { 
     369      // Call this without caring about its return, just to handle any set up it does 
    369370      call_user_func(_jsdoc_base() . '_get_files'); 
    370371      print count($files) . ' files left<br>'; 
     
    403404 
    404405      $ignores = array(); 
    405       $query = db_query("SELECT parent.title FROM jsdoc_variable_hierarchy AS jvh JOIN node AS child ON (child.vid = jvh.vid) JOIN jsdoc_objects AS jschild ON (jschild.vid = jvh.nid) JOIN node AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type NOT IN ('cascading', 'normal', 'alias') AND (parent.title LIKE 'dojo.%'  OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 
     406      $query = db_query("SELECT parent.title FROM {jsdoc_variable_hierarchy} AS jvh JOIN {node} AS child ON (child.vid = jvh.vid) JOIN {jsdoc_objects} AS jschild ON (jschild.vid = jvh.nid) JOIN {node} AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type NOT IN ('cascading', 'normal', 'alias') AND (parent.title LIKE 'dojo.%'  OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 
    406407      while ($result = db_fetch_object($query)) { 
    407408        $ignores[] = $result->title; 
    408409      } 
    409410      $namespaces = array(); 
    410       $query = db_query("SELECT parent.title FROM jsdoc_variable_hierarchy AS jvh JOIN node AS child ON (child.vid = jvh.vid) JOIN jsdoc_objects AS jschild ON (jschild.vid = jvh.nid) JOIN node AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type = 'normal' AND (parent.title LIKE 'dojo.%'  OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 
     411      $query = db_query("SELECT parent.title FROM {jsdoc_variable_hierarchy} AS jvh JOIN {node} AS child ON (child.vid = jvh.vid) JOIN {jsdoc_objects} AS jschild ON (jschild.vid = jvh.nid) JOIN {node} AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type = 'normal' AND (parent.title LIKE 'dojo.%'  OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 
    411412      while ($result = db_fetch_object($query)) { 
    412413        $found = false; 
     
    423424      cache_set('jsdoc_namespaces', 'cache', serialize($namespaces)); 
    424425 
    425       $timestamp = variable_get('jsdoc_cron_time', 0); 
    426       if ($timestamp && time() - $timestamp < 43200) { 
    427         // 12 hours 
    428         // return; 
    429       } 
    430       variable_set('jsdoc_cron_time', time()); 
    431  
     426      // Build an array of ctimes from our cache table 
    432427      $file_ctimes = array(); 
    433428      $query = db_query("SELECT ctime, cid, namespace, filepath FROM {jsdoc_cache}"); 
     
    439434      } 
    440435 
    441       $count = 0; 
    442436      while (count($files)) { 
    443437        $list = array_shift($files); 
     
    450444        } 
    451445 
    452         ++$count; 
    453446        list($namespace, $file_name) = $list; 
    454447        unset($list); 
     
    458451          print 'FINISHED'; 
    459452        } 
     453        flush(); 
    460454        ob_flush(); 
    461         flush(); 
    462  
    463         set_time_limit(300); // 5 minutes 
     455 
     456        set_time_limit(60); // 1 minute 
    464457        // Cache the results from a parse in the file and reuse it if we can. 
    465458        $cache_dir = _jsdoc_get_base_path() . '/' . drupal_get_path('module', 'jsdoc') . '/cache/'; 
     
    570563      } 
    571564 
    572       // TODO: Delete items from cache 
    573565      if (!db_result(db_query("SELECT 1 FROM {jsdoc_resources} WHERE used = 0"))) { 
    574         // If all items are used (typically happens the first pass), then none of them are new. 
    575         // We can do this because if nothing is missing, then all then new things are really new. 
     566        // If all items are used, then none of them are new. 
     567        // We can do this because if nothing is missing, 
     568        // then all then new things are really new. 
    576569        db_query("UPDATE {jsdoc_objects} SET new = 0"); 
    577570      } 
     
    29742967  } 
    29752968  if ($prototype) { 
    2976     if ($parent = jsdoc_object_node_load($prototype, jsdoc_get_project($node), jsdoc_get_version($node), $node->jsdoc_provide_nids)) { 
     2969    if ($parent = jsdoc_object_node_load($prototype, jsdoc_get_project($node), jsdoc_get_version($node), jsdoc_get_resources($node)->jsdoc_provide_nids)) { 
    29772970      return jsdoc_get_prototype_chain($parent, $environments, $output); 
    29782971    } 
     
    30793072  if ($parents[$parent]) { 
    30803073    foreach ($parents[$parent] as $parent) { 
    3081       if (isset($terms[$parent[1]])) { 
    3082         $term = $terms[$parent[1]]; 
     3074      if (isset($terms[$parent[0]])) { 
     3075        $term = $terms[$parent[0]]; 
    30833076      } 
    30843077      else { 
     
    30883081 
    30893082      $term->depth = $depth; 
    3090       $term->children = $children[$parent[1]]; 
     3083      $term->children = $children[$parent[0]]; 
    30913084      $tree[] = $term; 
    30923085 
    3093       if ($parents[$parent[1]]) { 
    3094         if (in_array($parent[1], $visited)) { 
     3086      if ($parents[$parent[0]]) { 
     3087        if (in_array($parent[0], $visited)) { 
    30953088          return $tree; 
    30963089        } 
    3097         $visited[] = $parent[1]; 
    3098         $tree = array_merge($tree, _jsdoc_get_tree($environments, $parent[1], $depth, $visited)); 
     3090        $visited[] = $parent[0]; 
     3091        $tree = array_merge($tree, _jsdoc_get_tree($environments, $parent[0], $depth, $visited)); 
    30993092      } 
    31003093    }